Skip to content

Commit 8ce23b3

Browse files
committed
Nav: Ctrl+tabbing to cycle through windows is now enabled regardless of _NavEnableKeyboard. (#4023, #767)
1 parent bce1ba4 commit 8ce23b3

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

docs/CHANGELOG.txt

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Other Changes:
4444
- Added IsMouseTripleClicked() function. Tracking multi-click count in IO structure. (#3229) [@kudaba]
4545
- Modals: fixed issue hovering popups inside a child inside a modal. (#4676, #4527)
4646
- Fixed IsWindowFocused()/IsWindowHovered() issues with childs inside popups. (#4676)
47+
- Nav: Ctrl+tabbing to cycle through windows is now enabled regardless of using the _NavEnableKeyboard
48+
configuration flag. This is part of an effort to generalize the use of keyboard inputs. (#4023, #787).
4749
- Nav: tabbing now cycles through clipped items and scroll accordingly. (#4449)
4850
- Nav: pressing PageUp/PageDown/Home/End when in Menu layer automatically moves back to Main layer.
4951
- Nav: fixed resizing window from borders setting navigation to Menu layer.

imgui.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -10019,10 +10019,9 @@ static void ImGui::NavUpdateWindowing()
1001910019
g.NavWindowingTargetAnim = NULL;
1002010020
}
1002110021

10022-
// Start CTRL-TAB or Square+L/R window selection
10023-
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
10022+
// Start CTRL+Tab or Square+L/R window selection
1002410023
const bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
10025-
const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && nav_keyboard_active && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab);
10024+
const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab);
1002610025
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
1002710026
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
1002810027
{
@@ -10073,6 +10072,7 @@ static void ImGui::NavUpdateWindowing()
1007310072
// Keyboard: Press and Release ALT to toggle menu layer
1007410073
// - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer.
1007510074
// - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway.
10075+
const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
1007610076
if (nav_keyboard_active && io.KeyMods == ImGuiKeyModFlags_Alt && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) == 0)
1007710077
{
1007810078
g.NavWindowingToggleLayer = true;

imgui_demo.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ void ImGui::ShowUserGuide()
210210
"(double-click to auto fit window to its contents).");
211211
ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
212212
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
213-
if (io.FontAllowUserScaling)
213+
ImGui::BulletText("CTRL+Tab to select a window.");
214+
if (io.FontAllowUserScaling)
214215
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
215216
ImGui::BulletText("While inputing text:\n");
216217
ImGui::Indent();
@@ -228,7 +229,6 @@ void ImGui::ShowUserGuide()
228229
ImGui::BulletText("Return to input text into a widget.");
229230
ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
230231
ImGui::BulletText("Alt to jump to the menu layer of a window.");
231-
ImGui::BulletText("CTRL+Tab to select a window.");
232232
ImGui::Unindent();
233233
}
234234

0 commit comments

Comments
 (0)