Nav: workaround to kindly handle ALT-TAB without detecting TAB-release on backends that clear all keys on unfocus. (#787)

This commit is contained in:
omar
2018-01-29 23:49:51 +01:00
parent c851b33352
commit bed6ef03f5
2 changed files with 6 additions and 2 deletions

View File

@ -2780,9 +2780,11 @@ static void ImGui::NavUpdateWindowing()
apply_focus_window = g.NavWindowingTarget;
}
// 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 backend clearing releases all keys on ALT-TAB
if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && IsNavInputPressed(ImGuiNavInput_KeyMenu, ImGuiInputReadMode_Released))
apply_toggle_layer = true;
if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev))
apply_toggle_layer = true;
// Move window
if (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoMove))