From 01a4cff8f9190b7f3731e4d1cef818ca675e9a42 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 5 Jan 2026 14:40:29 +0100 Subject: [PATCH] Docking: moving redundant clears in one place for simplicity. --- imgui.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index dba024628..3182b4fae 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7786,10 +7786,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) SetWindowDock(window, g.NextWindowData.DockId, g.NextWindowData.DockCond); if (first_begin_of_the_frame) { - bool has_dock_node = (window->DockId != 0 || window->DockNode != NULL); - bool new_auto_dock_node = !has_dock_node && GetWindowAlwaysWantOwnTabBar(window); - bool dock_node_was_visible = window->DockNodeIsVisible; - bool dock_tab_was_visible = window->DockTabIsVisible; + const bool has_dock_node = (window->DockId != 0 || window->DockNode != NULL); + const bool new_auto_dock_node = !has_dock_node && GetWindowAlwaysWantOwnTabBar(window); + const bool dock_node_was_visible = window->DockNodeIsVisible; + const bool dock_tab_was_visible = window->DockTabIsVisible; + window->DockIsActive = window->DockNodeIsVisible = window->DockTabIsVisible = false; + if (has_dock_node || new_auto_dock_node) { BeginDocked(window, p_open); @@ -7807,10 +7809,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true); } } - else - { - window->DockIsActive = window->DockNodeIsVisible = window->DockTabIsVisible = false; - } } // Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack @@ -20991,9 +20989,6 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open) { ImGuiContext& g = *GImGui; - // Clear fields ahead so most early-out paths don't have to do it - window->DockIsActive = window->DockNodeIsVisible = window->DockTabIsVisible = false; - // Specific extra processing for fallback window (#9151), could be in Begin() as well. if (window->IsFallbackWindow && !window->WasActive) {