1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Docking: moving redundant clears in one place for simplicity.

This commit is contained in:
ocornut 2026-01-05 14:40:29 +01:00
parent 00dfb3c896
commit 01a4cff8f9

View file

@ -7786,10 +7786,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
SetWindowDock(window, g.NextWindowData.DockId, g.NextWindowData.DockCond); SetWindowDock(window, g.NextWindowData.DockId, g.NextWindowData.DockCond);
if (first_begin_of_the_frame) if (first_begin_of_the_frame)
{ {
bool has_dock_node = (window->DockId != 0 || window->DockNode != NULL); const bool has_dock_node = (window->DockId != 0 || window->DockNode != NULL);
bool new_auto_dock_node = !has_dock_node && GetWindowAlwaysWantOwnTabBar(window); const bool new_auto_dock_node = !has_dock_node && GetWindowAlwaysWantOwnTabBar(window);
bool dock_node_was_visible = window->DockNodeIsVisible; const bool dock_node_was_visible = window->DockNodeIsVisible;
bool dock_tab_was_visible = window->DockTabIsVisible; const bool dock_tab_was_visible = window->DockTabIsVisible;
window->DockIsActive = window->DockNodeIsVisible = window->DockTabIsVisible = false;
if (has_dock_node || new_auto_dock_node) if (has_dock_node || new_auto_dock_node)
{ {
BeginDocked(window, p_open); BeginDocked(window, p_open);
@ -7807,10 +7809,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true); 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 // 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; 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. // Specific extra processing for fallback window (#9151), could be in Begin() as well.
if (window->IsFallbackWindow && !window->WasActive) if (window->IsFallbackWindow && !window->WasActive)
{ {