From 7e772f6a51d0db5d00d9e9b4649cbe4cb0da79b9 Mon Sep 17 00:00:00 2001 From: omar Date: Sat, 18 May 2019 18:42:59 +0200 Subject: [PATCH] Docking: Fixed undocking whole node (from collapse/docking menu button) from losing its size/pos. Made collapose/docking menu id easier to compute for testing. --- imgui.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 26b39a98..e64b6d33 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11609,6 +11609,7 @@ void ImGui::DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node) DockSettingsRenameNodeReferences(node->ID, new_node->ID); for (int n = 0; n < new_node->Windows.Size; n++) UpdateWindowParentAndRootLinks(new_node->Windows[n], new_node->Windows[n]->Flags, NULL); + new_node->AuthorityForPos = new_node->AuthorityForSize = ImGuiDataAuthority_Window; new_node->WantMouseMove = true; } else @@ -12348,7 +12349,10 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w host_window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu); } - PushID(node->ID); + // Use PushOverrideID() instead of PushID() to use the node id _without_ the host window ID. + // This is to facilitate computing those ID from the outside, and will affect more or less only the ID of the collapse button, popup and tabs, + // as docked windows themselves will override the stack with their own root ID. + PushOverrideID(node->ID); ImGuiTabBar* tab_bar = node->TabBar; bool tab_bar_is_recreated = (tab_bar == NULL); // Tab bar are automatically destroyed when a node gets hidden if (tab_bar == NULL) @@ -12361,6 +12365,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w node->IsFocused = is_focused; // Collapse button changes shape and display a list + // FIXME-DOCK: Could we recycle popups id? if (IsPopupOpen("#TabListMenu")) { if (ImGuiID tab_id = DockNodeUpdateTabListMenu(node, tab_bar))