From ed9d1e742793f7e4333565f891b4e3821b205f09 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 27 Apr 2026 16:53:57 +0200 Subject: [PATCH] Docking, Tabs: toggling tab bar visibility marks saved settings as dirty. (#9380) + tweak/improve packing for ImGuiDockNode. --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 3 +++ imgui_internal.h | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 09ee63137..81864930b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -177,6 +177,8 @@ Other Changes: Docking+Viewports Branch: +- Docking: + - Toggling tab bar visibility marks saved settings as dirty. (#9380) - Viewports: - Added opaque `void* PlatformIconData` storage in viewport and ImGuiWindowClass to allow passing icon information to a custom backend or hook. (#2715) diff --git a/imgui.cpp b/imgui.cpp index c9ffc66f6..cb73b8dcb 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -18922,10 +18922,13 @@ static void ImGui::DockNodeUpdateFlagsAndCollapse(ImGuiDockNode* node) node->WantHiddenTabBarToggle = false; // Apply toggles at a single point of the frame (here!) + const ImGuiDockNodeFlags prev_local_flags = node->LocalFlags; if (node->Windows.Size > 1) node->SetLocalFlags(node->LocalFlags & ~ImGuiDockNodeFlags_HiddenTabBar); else if (node->WantHiddenTabBarToggle) node->SetLocalFlags(node->LocalFlags ^ ImGuiDockNodeFlags_HiddenTabBar); + if ((node->LocalFlags ^ prev_local_flags) & ImGuiDockNodeFlags_SavedFlagsMask_) + MarkIniSettingsDirty(); // Bit flaky to only do this here. Perhaps compare node flags every frame? #9380 node->WantHiddenTabBarToggle = false; DockNodeUpdateVisibleFlag(node); diff --git a/imgui_internal.h b/imgui_internal.h index af03aa3b5..a9e2cb187 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2031,7 +2031,7 @@ enum ImGuiDockNodeState ImGuiDockNodeState_HostWindowVisible, }; -// sizeof() 156~192 +// sizeof() 176~216 struct IMGUI_API ImGuiDockNode { ImGuiID ID; @@ -2048,8 +2048,8 @@ struct IMGUI_API ImGuiDockNode ImVec2 Size; // Current size ImVec2 SizeRef; // [Split node only] Last explicitly written-to size (overridden when using a splitter affecting the node), used to calculate Size. ImGuiAxis SplitAxis; // [Split node only] Split axis (X or Y) - ImGuiWindowClass WindowClass; // [Root node only] ImU32 LastBgColor; + ImGuiWindowClass WindowClass; // [Root node only] ImGuiWindow* HostWindow; ImGuiWindow* VisibleWindow; // Generally point to window which is ID is == SelectedTabID, but when CTRL+Tabbing this can be a different window.