mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
Nav: Alt doesn't toggle menu layer if other modifiers are held. (#4439)
This commit is contained in:
parent
c7529c8ea8
commit
8fa502ca42
@ -72,6 +72,7 @@ Other Changes:
|
||||
- Menus: MenuItem() and BeginMenu() are not affected/overlapping when style.SelectableTextAlign is altered.
|
||||
- Menus: fix hovering a disabled menu or menu item not closing other menus. (#211)
|
||||
- Popups: fix BeginPopup/OpenPopup sequence failing when there are no focused windows. (#4308) [@rokups]
|
||||
- Nav: Alt doesn't toggle menu layer if other modifiers are held. (#4439)
|
||||
- Nav: Disabled items are not candidate for default focus. (#211, #787)
|
||||
- Disabled: disabled items set HoveredId, allowing e.g. HoveredIdTimer to function. (#211, #3419) [@rokups]
|
||||
- Disabled: disabled mode more consistently release active id if the active item got disabled. (#211)
|
||||
|
19
imgui.cpp
19
imgui.cpp
@ -9123,9 +9123,15 @@ static void ImGui::NavUpdate()
|
||||
if (io.KeyAlt && !io.KeyCtrl)
|
||||
io.NavInputs[ImGuiNavInput_KeyMenu_] = 1.0f;
|
||||
|
||||
// We automatically cancel toggling nav layer when any text has been typed while holding Alt. (See #370)
|
||||
if (io.KeyAlt && !io.KeyCtrl && g.NavWindowingToggleLayer && io.InputQueueCharacters.Size > 0)
|
||||
g.NavWindowingToggleLayer = false;
|
||||
// We cancel toggling nav layer when any text has been typed while holding Alt. (See #370)
|
||||
// We cancel toggling nav layer when other modifiers are pressed. (See #4439)
|
||||
if (g.NavWindowingToggleLayer && g.NavInputSource == ImGuiInputSource_Keyboard)
|
||||
{
|
||||
if (io.KeyAlt && !io.KeyCtrl && io.InputQueueCharacters.Size > 0)
|
||||
g.NavWindowingToggleLayer = false;
|
||||
if (io.KeyCtrl || io.KeyShift || io.KeySuper)
|
||||
g.NavWindowingToggleLayer = false;
|
||||
}
|
||||
|
||||
#undef NAV_MAP_KEY
|
||||
}
|
||||
@ -9643,7 +9649,7 @@ static void ImGui::NavUpdateWindowing()
|
||||
{
|
||||
g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow;
|
||||
g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
||||
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
||||
g.NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false; // Gamepad starts toggling layer
|
||||
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;
|
||||
}
|
||||
|
||||
@ -9687,8 +9693,11 @@ static void ImGui::NavUpdateWindowing()
|
||||
|
||||
// Keyboard: Press and Release ALT to toggle menu layer
|
||||
// FIXME: We lack an explicit IO variable for "is the imgui window focused", so compare mouse validity to detect the common case of backend clearing releases all keys on ALT-TAB
|
||||
if (IsNavInputTest(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Pressed))
|
||||
if (IsNavInputTest(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Pressed) && g.IO.KeyMods == ImGuiKeyModFlags_Alt)
|
||||
{
|
||||
g.NavWindowingToggleLayer = true;
|
||||
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||
}
|
||||
if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && g.NavWindowingToggleLayer && IsNavInputTest(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released))
|
||||
if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev))
|
||||
apply_toggle_layer = true;
|
||||
|
Loading…
Reference in New Issue
Block a user