From 5e528d9eea9688d59d990140f65ca10866b10509 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 3 Jun 2021 17:22:18 +0200 Subject: [PATCH] Docking: Clicking on the right-most close button of a docking node closes all windows. (#4186) --- docs/CHANGELOG.txt | 1 + imgui.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 23a83868acfd..0c60fe1a26d3 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -111,6 +111,7 @@ Other Changes: Docking+Viewports Branch: +- Docking: Clicking on the right-most close button of a docking node closes all windows. (#4186) - Docking: Fix IsWindowAppearing() and ImGuiCond_Appearing on docked windows. (#4177, #3982, #1497, #1061) diff --git a/imgui.cpp b/imgui.cpp index 1d1d2981d25a..e3ea26ea60d6 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -14027,11 +14027,11 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_Text] * ImVec4(1.0f,1.0f,1.0f,0.4f)); } if (CloseButton(host_window->GetID("#CLOSE"), close_button_pos)) - if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_bar->VisibleTabId)) - { - node->WantCloseTabId = tab->ID; - TabBarCloseTab(tab_bar, tab); - } + { + node->WantCloseAll = true; + for (int n = 0; n < tab_bar->Tabs.Size; n++) + TabBarCloseTab(tab_bar, &tab_bar->Tabs[n]); + } //if (IsItemActive()) // focus_tab_id = tab_bar->SelectedTabId; if (!close_button_is_enabled)