From 539de4387bf553a58ccd1658176d4bc9507145b0 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 12 Apr 2021 16:51:05 +0200 Subject: [PATCH] Docking: Fixed restoring of tab order within a dockspace or a split node. (tests in "docking_tab_order") --- docs/CHANGELOG.txt | 1 + imgui.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index cdb70c921..4ec781ad2 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -137,6 +137,7 @@ Docking Branch: - Docking: DockSpace() returns its node ID. - Docking: Dockspace() never draws a background. (#3924) - Docking: undocking nodes/windows covering most of the monitor max their size down to 90% to ease further manipulations. +- Docking: Fixed restoring of tab order within a dockspace or a split node. - Viewports: Hotfix for crash in monitor array access, caused by 4b9bc4902. (#3967) - Backends, Viewports: GLFW: Add a workaround for stuck keys after closing a GLFW window (#3837). - Backends, Viewports: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (#3881) diff --git a/imgui.cpp b/imgui.cpp index 717243364..d9376ef1b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -15464,9 +15464,9 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open) else window->Flags &= ~ImGuiWindowFlags_NoTitleBar; // Clear the NoTitleBar flag in case the user set it: confusingly enough we need a title bar height so we are correctly offset, but it won't be displayed! - // Save new dock order only if the tab bar has been visible once. + // Save new dock order only if the window has been visible once already // This allows multiple windows to be created in the same frame and have their respective dock orders preserved. - if (node->TabBar && node->TabBar->CurrFrameVisible != -1) + if (node->TabBar && window->WasActive) window->DockOrder = (short)DockNodeGetTabOrder(window); if ((node->WantCloseAll || node->WantCloseTabId == window->ID) && p_open != NULL)