mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 14:16:36 +00:00
Viewport: Renamed member + added note about a Docking issue with restoring focus.
This commit is contained in:
parent
47219dd5c6
commit
5af385ea78
12
imgui.cpp
12
imgui.cpp
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -951,7 +951,6 @@ struct ImGuiContext
|
||||
ImVector<ImGuiWindow*> CurrentWindowStack;
|
||||
ImGuiStorage WindowsById;
|
||||
int WindowsActiveCount;
|
||||
int WindowsFrontMostStampCount; // Every time the front-most window changes, we stamp its viewport with an incrementing counter
|
||||
ImGuiWindow* CurrentWindow; // Being drawn into
|
||||
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
||||
ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
|
||||
@ -996,6 +995,7 @@ struct ImGuiContext
|
||||
ImGuiViewportP* MouseViewport;
|
||||
ImGuiViewportP* MouseLastHoveredViewport; // Last known viewport that was hovered by mouse (even if we are not hovering any viewport any more) + honoring the _NoInputs flag.
|
||||
ImGuiID PlatformLastFocusedViewport; // Record of last focused platform window/viewport, when this changes we stamp the viewport as front-most
|
||||
int ViewportFrontMostStampCount; // Every time the front-most window changes, we stamp its viewport with an incrementing counter
|
||||
|
||||
// Navigation data (for gamepad/keyboard)
|
||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusWindow'
|
||||
@ -1141,7 +1141,6 @@ struct ImGuiContext
|
||||
FrameCount = 0;
|
||||
FrameCountEnded = FrameCountPlatformEnded = FrameCountRendered = -1;
|
||||
WindowsActiveCount = 0;
|
||||
WindowsFrontMostStampCount = 0;
|
||||
CurrentWindow = NULL;
|
||||
HoveredWindow = NULL;
|
||||
HoveredRootWindow = NULL;
|
||||
@ -1175,6 +1174,7 @@ struct ImGuiContext
|
||||
CurrentViewport = NULL;
|
||||
MouseViewport = MouseLastHoveredViewport = NULL;
|
||||
PlatformLastFocusedViewport = 0;
|
||||
ViewportFrontMostStampCount = 0;
|
||||
|
||||
NavWindow = NULL;
|
||||
NavId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user