diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 72ff5f4e..75dcc4b6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -138,7 +138,8 @@ Docking Branch: - 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. -- Docking: Fixed multiple simultaneously reappearing window from appearing undocked in their initial frame. +- Docking: Fixed reappearing docked windows with no close button showing a tab with extraneous space for one frame. +- Docking: Fixed multiple simultaneously reappearing window from appearing undocked for one frame. - 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 4086b326..65225622 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -16260,7 +16260,12 @@ void ImGui::ShowMetricsWindow(bool* p_open) if (TreeNode("TabBars", "Tab Bars (%d)", g.TabBars.GetSize())) { for (int n = 0; n < g.TabBars.GetSize(); n++) - DebugNodeTabBar(g.TabBars.GetByIndex(n), "TabBar"); + { + ImGuiTabBar* tab_bar = g.TabBars.GetByIndex(n); + PushID(tab_bar); + DebugNodeTabBar(tab_bar, "TabBar"); + PopID(); + } TreePop(); } @@ -16702,7 +16707,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label) } p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } "); if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } - bool open = TreeNode(tab_bar, "%s", buf); + bool open = TreeNode(label, "%s", buf); if (!is_active) { PopStyleColor(); } if (is_active && IsItemHovered()) { diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 31e2a640..bdc32963 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7422,6 +7422,9 @@ void ImGui::TabBarAddTab(ImGuiTabBar* tab_bar, ImGuiTabItemFlags tab_flags, ImGu IM_ASSERT(TabBarFindTabByID(tab_bar, window->ID) == NULL); IM_ASSERT(g.CurrentTabBar != tab_bar); // Can't work while the tab bar is active as our tab doesn't have an X offset yet, in theory we could/should test something like (tab_bar->CurrFrameVisible < g.FrameCount) but we'd need to solve why triggers the commented early-out assert in BeginTabBarEx() (probably dock node going from implicit to explicit in same frame) + if (!window->HasCloseButton) + tab_flags |= ImGuiTabItemFlags_NoCloseButton; // Set _NoCloseButton immediately because it will be used for first-frame width calculation. + ImGuiTabItem new_tab; new_tab.ID = window->ID; new_tab.Flags = tab_flags;