Nav: Added a way for code to cancel Alt for menu toggle (ImGuiNavInput_KeyMenu_). Cancelling out on platform window. close request. (#1542, #787)
This commit is contained in:
parent
df65d4a14f
commit
f29b3b4033
@ -5296,6 +5296,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
if (p_open != NULL && window->Viewport->PlatformRequestClose && window->Viewport != GetMainViewport())
|
if (p_open != NULL && window->Viewport->PlatformRequestClose && window->Viewport != GetMainViewport())
|
||||||
{
|
{
|
||||||
window->Viewport->PlatformRequestClose = false;
|
window->Viewport->PlatformRequestClose = false;
|
||||||
|
g.NavWindowingToggleLayer = false; // Assume user mapped PlatformRequestClose on ALT-F4 so we disable ALT for menu toggle. False positive not an issue.
|
||||||
*p_open = false;
|
*p_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8572,7 +8573,9 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
|
|
||||||
// Keyboard: Press and Release ALT to toggle menu layer
|
// 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 back-end clearing releases all keys on ALT-TAB
|
// FIXME: We lack an explicit IO variable for "is the imgui window focused", so compare mouse validity to detect the common case of back-end clearing releases all keys on ALT-TAB
|
||||||
if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released))
|
if (IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Pressed))
|
||||||
|
g.NavWindowingToggleLayer = true;
|
||||||
|
if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && g.NavWindowingToggleLayer && IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released))
|
||||||
if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev))
|
if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev))
|
||||||
apply_toggle_layer = true;
|
apply_toggle_layer = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user