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)

This commit is contained in:
omar 2017-10-11 20:37:45 +02:00
parent f0d437dd9c
commit b05b31e690

View File

@ -2224,6 +2224,7 @@ static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGu
if (g.NavId == id) if (g.NavId == id)
{ {
window->NavRectRel[window->DC.NavLayerCurrent] = nav_bb_rel; 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.NavIdIsAlive = true;
g.NavIdTabCounter = window->FocusIdxTabCounter; g.NavIdTabCounter = window->FocusIdxTabCounter;
} }