Viewport: Renamed member + added note about a Docking issue with restoring focus.

This commit is contained in:
omar
2019-03-28 18:02:03 +01:00
parent 47219dd5c6
commit 5af385ea78
2 changed files with 10 additions and 6 deletions

View File

@ -6260,6 +6260,10 @@ void ImGui::FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window)
if (window != ignore_window && window->WasActive && !(window->Flags & ImGuiWindowFlags_ChildWindow))
if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs))
{
// FIXME-DOCKING: This is failing (lagging by one frame) for docked windows.
// If A and B are docked into window and B disappear, at the NewFrame() call site window->NavLastChildNavWindow will still point to B.
// We might leverage the tab order implicitly stored in window->DockNodeAsHost->TabBar (essentially the 'most_recently_selected_tab' code in tab bar will do that but on next update)
// to tell which is the "previous" window. Or we may leverage 'LastFrameFocused/LastFrameJustFocused' and have this function handle child window itself?
ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window);
FocusWindow(focus_window);
return;
@ -10554,8 +10558,8 @@ void ImGui::UpdatePlatformWindows()
// Even without focus, we assume the window becomes front-most.
// This is useful for our platform z-order heuristic when io.MouseHoveredViewport is not available.
if (viewport->LastFrontMostStampCount != g.WindowsFrontMostStampCount)
viewport->LastFrontMostStampCount = ++g.WindowsFrontMostStampCount;
if (viewport->LastFrontMostStampCount != g.ViewportFrontMostStampCount)
viewport->LastFrontMostStampCount = ++g.ViewportFrontMostStampCount;
}
// Clear request flags
@ -10576,8 +10580,8 @@ void ImGui::UpdatePlatformWindows()
}
if (focused_viewport && g.PlatformLastFocusedViewport != focused_viewport->ID)
{
if (focused_viewport->LastFrontMostStampCount != g.WindowsFrontMostStampCount)
focused_viewport->LastFrontMostStampCount = ++g.WindowsFrontMostStampCount;
if (focused_viewport->LastFrontMostStampCount != g.ViewportFrontMostStampCount)
focused_viewport->LastFrontMostStampCount = ++g.ViewportFrontMostStampCount;
g.PlatformLastFocusedViewport = focused_viewport->ID;
}
}