mirror of
https://github.com/ocornut/imgui.git
synced 2025-10-26 12:27:30 +00:00
Nav: Fixed an issue where Alt key would clear current active item on windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
This commit is contained in:
21
imgui.cpp
21
imgui.cpp
@@ -4356,7 +4356,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
||||
|
||||
// This could be written in a more general way (e.g associate a hook to ActiveId),
|
||||
// but since this is currently quite an exception we'll leave it as is.
|
||||
// One common scenario leading to this is: pressing Key ->NavMoveRequestApplyResult() -> ClearActiveId()
|
||||
// One common scenario leading to this is: pressing Key ->NavMoveRequestApplyResult() -> ClearActiveID()
|
||||
if (g.InputTextState.ID == g.ActiveId)
|
||||
InputTextDeactivateHook(g.ActiveId);
|
||||
}
|
||||
@@ -13625,15 +13625,16 @@ static void ImGui::NavUpdateWindowing()
|
||||
// Keyboard: Press and Release ALT to toggle menu layer
|
||||
const ImGuiKey windowing_toggle_keys[] = { ImGuiKey_LeftAlt, ImGuiKey_RightAlt };
|
||||
bool windowing_toggle_layer_start = false;
|
||||
for (ImGuiKey windowing_toggle_key : windowing_toggle_keys)
|
||||
if (nav_keyboard_active && IsKeyPressed(windowing_toggle_key, 0, ImGuiKeyOwner_NoOwner))
|
||||
{
|
||||
windowing_toggle_layer_start = true;
|
||||
g.NavWindowingToggleLayer = true;
|
||||
g.NavWindowingToggleKey = windowing_toggle_key;
|
||||
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||
break;
|
||||
}
|
||||
if (g.NavWindow != NULL && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs))
|
||||
for (ImGuiKey windowing_toggle_key : windowing_toggle_keys)
|
||||
if (nav_keyboard_active && IsKeyPressed(windowing_toggle_key, 0, ImGuiKeyOwner_NoOwner))
|
||||
{
|
||||
windowing_toggle_layer_start = true;
|
||||
g.NavWindowingToggleLayer = true;
|
||||
g.NavWindowingToggleKey = windowing_toggle_key;
|
||||
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||
break;
|
||||
}
|
||||
if (g.NavWindowingToggleLayer && g.NavInputSource == ImGuiInputSource_Keyboard)
|
||||
{
|
||||
// We cancel toggling nav layer when any text has been typed (generally while holding Alt). (See #370)
|
||||
|
||||
Reference in New Issue
Block a user