Nav: SetFocusID() clears NavInitRequest for consistency (repro would a same frame interaction / race condition). (#787)
This commit is contained in:
parent
ef2c3bcdee
commit
fd6d8863f7
@ -2027,6 +2027,8 @@ void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
|
||||
|
||||
// Assume that SetFocusID() is called in the context where its NavLayer is the current layer, which is the case everywhere we call it.
|
||||
const int nav_layer = window->DC.NavLayerCurrent;
|
||||
if (g.NavWindow != window)
|
||||
g.NavInitRequest = false;
|
||||
g.NavId = id;
|
||||
g.NavWindow = window;
|
||||
g.NavLayer = nav_layer;
|
||||
@ -6238,8 +6240,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
||||
g.NavMousePosDirty = true;
|
||||
if (window && window->NavLastChildNavWindow != NULL)
|
||||
window->NavLastChildNavWindow = NULL;
|
||||
if (g.NavInitRequest)
|
||||
g.NavInitRequest = false;
|
||||
g.NavInitRequest = false;
|
||||
}
|
||||
|
||||
// Passing NULL allow to disable keyboard focus
|
||||
|
@ -621,7 +621,7 @@ struct ImGuiContext
|
||||
int NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
||||
int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
|
||||
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRefRectRel is valid
|
||||
bool NavMousePosDirty;
|
||||
bool NavMousePosDirty; // When set we will update mouse position if (NavFlags & ImGuiNavFlags_MoveMouse) if set
|
||||
bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (nb: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
|
||||
bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
|
||||
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest
|
||||
|
Loading…
Reference in New Issue
Block a user