Skip to content

Commit b185c0d

Browse files
ocornutmatthew-mccall
authored andcommitted
Nav: Fixed an issue where Alt key would clear current active item on windows with the ImGuiWindowFlags_NoNavInputs flag. (ocornut#8231)
1 parent cda2c90 commit b185c0d

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

docs/CHANGELOG.txt

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Other changes:
4848
- Drags: Added ImGuiSliderFlags_NoSpeedTweaks flag to disable keyboard
4949
modifiers altering the tweak speed. Useful if you want to alter tweak speed
5050
yourself based on your own logic. (#8223)
51+
- Nav: Fixed an issue where Alt key would clear current active item on
52+
windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
5153
- Backends: Vulkan: Fixed setting VkSwapchainCreateInfoKHR::preTransform for
5254
platforms not supporting VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR. (#8222) [@Zer0xFF]
5355

imgui.cpp

+11-10
Original file line numberDiff line numberDiff line change
@@ -4356,7 +4356,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
43564356

43574357
// This could be written in a more general way (e.g associate a hook to ActiveId),
43584358
// but since this is currently quite an exception we'll leave it as is.
4359-
// One common scenario leading to this is: pressing Key ->NavMoveRequestApplyResult() -> ClearActiveId()
4359+
// One common scenario leading to this is: pressing Key ->NavMoveRequestApplyResult() -> ClearActiveID()
43604360
if (g.InputTextState.ID == g.ActiveId)
43614361
InputTextDeactivateHook(g.ActiveId);
43624362
}
@@ -13625,15 +13625,16 @@ static void ImGui::NavUpdateWindowing()
1362513625
// Keyboard: Press and Release ALT to toggle menu layer
1362613626
const ImGuiKey windowing_toggle_keys[] = { ImGuiKey_LeftAlt, ImGuiKey_RightAlt };
1362713627
bool windowing_toggle_layer_start = false;
13628-
for (ImGuiKey windowing_toggle_key : windowing_toggle_keys)
13629-
if (nav_keyboard_active && IsKeyPressed(windowing_toggle_key, 0, ImGuiKeyOwner_NoOwner))
13630-
{
13631-
windowing_toggle_layer_start = true;
13632-
g.NavWindowingToggleLayer = true;
13633-
g.NavWindowingToggleKey = windowing_toggle_key;
13634-
g.NavInputSource = ImGuiInputSource_Keyboard;
13635-
break;
13636-
}
13628+
if (g.NavWindow != NULL && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
13629+
for (ImGuiKey windowing_toggle_key : windowing_toggle_keys)
13630+
if (nav_keyboard_active && IsKeyPressed(windowing_toggle_key, 0, ImGuiKeyOwner_NoOwner))
13631+
{
13632+
windowing_toggle_layer_start = true;
13633+
g.NavWindowingToggleLayer = true;
13634+
g.NavWindowingToggleKey = windowing_toggle_key;
13635+
g.NavInputSource = ImGuiInputSource_Keyboard;
13636+
break;
13637+
}
1363713638
if (g.NavWindowingToggleLayer && g.NavInputSource == ImGuiInputSource_Keyboard)
1363813639
{
1363913640
// We cancel toggling nav layer when any text has been typed (generally while holding Alt). (See #370)

0 commit comments

Comments
 (0)