From b05b31e6905384c71dbdb223e1ca080cf42033b9 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 11 Oct 2017 20:37:45 +0200 Subject: [PATCH] Nav: Made NavWindow always refresh from NavId so we can lazily retrieve the window for user functions that don't have it. This is not required by current commit but I'd rather test it earlier. Idea: eventually if we switch to 64-bit identifiers we could reserve e.g. 20 bits to store a simplified window identifier so we can always retrieve a window from an id. (#787) --- imgui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/imgui.cpp b/imgui.cpp index 8d5de35cb..cb5c8bf31 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2224,6 +2224,7 @@ static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGu if (g.NavId == id) { window->NavRectRel[window->DC.NavLayerCurrent] = nav_bb_rel; + g.NavWindow = window; // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window. g.NavIdIsAlive = true; g.NavIdTabCounter = window->FocusIdxTabCounter; }