Docking, Viwport: Fixed a regression in 1.92.4 where partially moving a floating docking node with split over the main viewport would set the window in an invalid state.

This was revealed by better merging in dfe308b (#8948) but isn't technically caused by it.
Added a agressive assert in UpdateTryMergeWindowIntoHostViewport() For good measure.
This commit is contained in:
ocornut
2026-01-29 18:55:30 +01:00
parent 91ce8ccdbc
commit 10ebda0b5e
2 changed files with 7 additions and 1 deletions

View File

@@ -245,6 +245,10 @@ Docking+Viewports Branch:
- Demo: rework 'Dockspace' demo to increase clarity and put more emphasis on the
basic path of simply calling `DockSpaceOverViewport()`.
- Viewports:
- Fixed a regression in 1.92.4 where partially moving a floating docking node
with horizontal/vertical split over the main viewport would set the window in
an invalid state in some situations, making user unable to further interact
with the window.
- Fixed a regression in 1.92.4 which could cause combos/popups window from
appearing under their parent viewport if their geometry overlapped the main
viewport. (#8948, #9172, #9131, #9128)

View File

@@ -5365,7 +5365,7 @@ void ImGui::StopMouseMovingWindow()
// Try to merge the window back into the main viewport.
// This works because MouseViewport should be != MovingWindow->Viewport on release (as per code in UpdateViewports)
if (g.ConfigFlagsCurrFrame & ImGuiConfigFlags_ViewportsEnable)
UpdateTryMergeWindowIntoHostViewport(window, g.MouseViewport);
UpdateTryMergeWindowIntoHostViewport(window->RootWindowDockTree, g.MouseViewport);
// Restore the mouse viewport so that we don't hover the viewport _under_ the moved window during the frame we released the mouse button.
if (!IsDragDropPayloadBeingAccepted())
@@ -16553,6 +16553,7 @@ static bool IsViewportAbove(ImGuiViewportP* potential_above, ImGuiViewportP* pot
static bool ImGui::UpdateTryMergeWindowIntoHostViewport(ImGuiWindow* window, ImGuiViewportP* viewport_dst)
{
ImGuiContext& g = *GImGui;
IM_ASSERT(window == window->RootWindowDockTree);
ImGuiViewportP* viewport_src = window->Viewport; // Current viewport
if (viewport_src == viewport_dst)
return false;
@@ -16576,6 +16577,7 @@ static bool ImGui::UpdateTryMergeWindowIntoHostViewport(ImGuiWindow* window, ImG
}
// Move to the existing viewport, Move child/hosted windows as well (FIXME-OPT: iterate child)
IMGUI_DEBUG_LOG_VIEWPORT("[viewport] Window '%s' merge into Viewport 0X%08X\n", window->Name, viewport_dst->ID);
if (window->ViewportOwned)
for (int n = 0; n < g.Windows.Size; n++)
if (g.Windows[n]->Viewport == viewport_src)