From 8b190f11006d4588c1ad2bec5ff51a197c8ecd6f Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 31 Jul 2016 16:12:01 +0200 Subject: [PATCH] Nav: quick tap on NavMenu with no focused window doesn't focus one (holding still does) (#323) --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index e0f5a2426..65001eb5b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2501,7 +2501,7 @@ static void NavUpdate() if (!IsKeyDownMap(ImGuiKey_NavMenu)) { // Apply actual focus only when releasing the NavMenu button (until then the window was merely rendered front-most) - if (g.NavWindowingTarget && (!g.NavWindow || g.NavWindowingTarget != g.NavWindow->RootNonPopupWindow)) + if (g.NavWindowingTarget && !g.NavWindowingToggleLayer && (!g.NavWindow || g.NavWindowingTarget != g.NavWindow->RootNonPopupWindow)) { ImGui::FocusWindow(g.NavWindowingTarget); g.NavDisableHighlight = false; @@ -2511,7 +2511,7 @@ static void NavUpdate() } // Single press toggles NavLayer - if (g.NavWindowingToggleLayer) + if (g.NavWindowingToggleLayer && g.NavWindow) { if ((g.NavWindow->DC.NavLayerActiveFlags & (1<<1)) == 0 && (g.NavWindow->RootWindow->DC.NavLayerActiveFlags & (1<<1)) != 0) ImGui::FocusWindow(g.NavWindow->RootWindow);