mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Viewports: Comments, removed unnecessary use of ViewportFrontMostStampCount (the LastFrontMostStampCount is enough)
This commit is contained in:
parent
e230ec5a01
commit
6bc526676c
13
imgui.cpp
13
imgui.cpp
@ -3493,7 +3493,7 @@ void ImGui::UpdateMouseMovingWindowNewFrame()
|
||||
g.MouseViewport = moving_window->Viewport;
|
||||
|
||||
// Clear the NoInput window flag set by the Viewport system
|
||||
moving_window->Viewport->Flags &= ~ImGuiViewportFlags_NoInputs;
|
||||
moving_window->Viewport->Flags &= ~ImGuiViewportFlags_NoInputs; // FIXME-VIEWPORT: Test engine managed to crash here because Viewport was NULL.
|
||||
|
||||
ClearActiveID();
|
||||
g.MovingWindow = NULL;
|
||||
@ -11523,6 +11523,7 @@ void ImGui::UpdatePlatformWindows()
|
||||
|
||||
// Update our implicit z-order knowledge of platform windows, which is used when the back-end cannot provide io.MouseHoveredViewport.
|
||||
// When setting Platform_GetWindowFocus, it is expected that the platform back-end can handle calls without crashing if it doesn't have data stored.
|
||||
// FIXME-VIEWPORT: We should use this information to also set dear imgui-side focus, allowing us to handle os-level alt+tab.
|
||||
if (g.PlatformIO.Platform_GetWindowFocus != NULL)
|
||||
{
|
||||
ImGuiViewportP* focused_viewport = NULL;
|
||||
@ -11533,12 +11534,10 @@ void ImGui::UpdatePlatformWindows()
|
||||
if (g.PlatformIO.Platform_GetWindowFocus(viewport))
|
||||
focused_viewport = viewport;
|
||||
}
|
||||
if (focused_viewport && g.PlatformLastFocusedViewport != focused_viewport->ID)
|
||||
{
|
||||
if (focused_viewport->LastFrontMostStampCount != g.ViewportFrontMostStampCount)
|
||||
focused_viewport->LastFrontMostStampCount = ++g.ViewportFrontMostStampCount;
|
||||
g.PlatformLastFocusedViewport = focused_viewport->ID;
|
||||
}
|
||||
|
||||
// Store a tag so we can infer z-order easily from all our windows
|
||||
if (focused_viewport && focused_viewport->LastFrontMostStampCount != g.ViewportFrontMostStampCount)
|
||||
focused_viewport->LastFrontMostStampCount = ++g.ViewportFrontMostStampCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1353,7 +1353,6 @@ struct ImGuiContext
|
||||
ImGuiViewportP* CurrentViewport; // We track changes of viewport (happening in Begin) so we can call Platform_OnChangedViewport()
|
||||
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
|
||||
|
||||
// Gamepad/keyboard Navigation
|
||||
@ -1558,7 +1557,6 @@ struct ImGuiContext
|
||||
CurrentDpiScale = 0.0f;
|
||||
CurrentViewport = NULL;
|
||||
MouseViewport = MouseLastHoveredViewport = NULL;
|
||||
PlatformLastFocusedViewport = 0;
|
||||
ViewportFrontMostStampCount = 0;
|
||||
|
||||
NavWindow = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user