You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Process TAB/Shift-TAB to tab *OUT* of the currently focused item.
3159
3163
// (Note that we can always TAB out of a widget that doesn't allow tabbing in)
3160
-
if (g.ActiveId == id && g.FocusTabPressed && !(g.ActiveIdBlockNavInputFlags & (1 << ImGuiNavInput_KeyTab_)) && g.FocusRequestNextWindow == NULL)
3164
+
if (g.ActiveId == id && g.FocusTabPressed && !IsActiveIdUsingKey(ImGuiKey_Tab) && g.FocusRequestNextWindow == NULL)
3161
3165
{
3162
3166
g.FocusRequestNextWindow = window;
3163
3167
g.FocusRequestNextCounterTab = window->DC.FocusCounterTab + (g.IO.KeyShift ? (is_tab_stop ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items.
@@ -3782,6 +3786,11 @@ void ImGui::NewFrame()
3782
3786
g.ActiveIdIsJustActivated = false;
3783
3787
if (g.TempInputTextId != 0 && g.ActiveId != g.TempInputTextId)
// If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match
Copy file name to clipboardExpand all lines: imgui.h
-1
Original file line number
Diff line number
Diff line change
@@ -986,7 +986,6 @@ enum ImGuiNavInput_
986
986
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
987
987
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[].
988
988
ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt
989
-
ImGuiNavInput_KeyTab_, // tab // = Tab key
990
989
ImGuiNavInput_KeyLeft_, // move left // = Arrow keys
Copy file name to clipboardExpand all lines: imgui_internal.h
+12-6
Original file line number
Diff line number
Diff line change
@@ -900,8 +900,9 @@ struct ImGuiContext
900
900
bool ActiveIdHasBeenPressedBefore; // Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.
901
901
bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state.
902
902
bool ActiveIdHasBeenEditedThisFrame;
903
-
int ActiveIdAllowNavDirFlags; // Active widget allows using directional navigation (e.g. can activate a button and move away from it)
904
-
int ActiveIdBlockNavInputFlags;
903
+
ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those directional navigation requests (e.g. can activate a button and move away from it)
904
+
ImU32 ActiveIdUsingNavInputMask; // Active widget will want to read those nav inputs.
905
+
ImU64 ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
905
906
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
906
907
ImGuiWindow* ActiveIdWindow;
907
908
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
@@ -1092,8 +1093,9 @@ struct ImGuiContext
1092
1093
ActiveIdHasBeenPressedBefore = false;
1093
1094
ActiveIdHasBeenEditedBefore = false;
1094
1095
ActiveIdHasBeenEditedThisFrame = false;
1095
-
ActiveIdAllowNavDirFlags = 0x00;
1096
-
ActiveIdBlockNavInputFlags = 0x00;
1096
+
ActiveIdUsingNavDirMask = 0x00;
1097
+
ActiveIdUsingNavInputMask = 0x00;
1098
+
ActiveIdUsingKeyInputMask = 0x00;
1097
1099
ActiveIdClickOffset = ImVec2(-1,-1);
1098
1100
ActiveIdWindow = NULL;
1099
1101
ActiveIdSource = ImGuiInputSource_None;
@@ -1584,9 +1586,13 @@ namespace ImGui
1584
1586
IMGUI_API voidSetNavIDWithRectRel(ImGuiID id, int nav_layer, const ImRect& rect_rel);
1585
1587
1586
1588
// Inputs
1589
+
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_PageUp) | ((ImU64)1 << ImGuiKey_PageDown); // FIXME-NAV: Page up/down actually not supported yet by widget, but claim them ahead.
3510
3516
if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) // Disable keyboard tabbing out as we will use the \t character.
// We have an edge case if ActiveId was set through another widget (e.g. widget being swapped), clear id immediately (don't wait until the end of the function)
0 commit comments