mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-23 02:04:22 +00:00
Viewports: update LastFocusedStampCount earlier. Fix (#8948, #9172, #9131, #9128) but probably have other side effects too.
Amend f1ae07e532. Initial value of LastFocusedStampCount was set at the time of platform ShowWindow which is too late for first-frame UpdateTryMergeWindowIntoHostViewport() evaluation.
This commit is contained in:
parent
7038e71ae2
commit
9eebd37b59
2 changed files with 10 additions and 7 deletions
|
|
@ -16989,6 +16989,10 @@ ImGuiViewportP* ImGui::AddUpdateViewport(ImGuiWindow* window, ImGuiID id, const
|
|||
g.ViewportCreatedCount++;
|
||||
IMGUI_DEBUG_LOG_VIEWPORT("[viewport] Add Viewport %08X '%s'\n", id, window ? window->Name : "<NULL>");
|
||||
|
||||
// We assume the window becomes front-most (even when ImGuiViewportFlags_NoFocusOnAppearing is used).
|
||||
// This is useful for our platform z-order heuristic when io.MouseHoveredViewport is not available.
|
||||
viewport->LastFocusedStampCount = ++g.ViewportFocusedStampCount;
|
||||
|
||||
// We normally setup for all viewports in NewFrame() but here need to handle the mid-frame creation of a new viewport.
|
||||
// We need to extend the fullscreen clip rect so the OverlayDrawList clip is correct for that the first frame
|
||||
g.DrawListSharedData.ClipRectFullscreen.x = ImMin(g.DrawListSharedData.ClipRectFullscreen.x, viewport->Pos.x);
|
||||
|
|
@ -17363,11 +17367,6 @@ void ImGui::UpdatePlatformWindows()
|
|||
|
||||
// Show window
|
||||
g.PlatformIO.Platform_ShowWindow(viewport);
|
||||
|
||||
// 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->LastFocusedStampCount != g.ViewportFocusedStampCount)
|
||||
viewport->LastFocusedStampCount = ++g.ViewportFocusedStampCount;
|
||||
}
|
||||
|
||||
// Clear request flags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue