diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 3029785fc..3f6644d05 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -156,6 +156,7 @@ Docking+Viewports Branch: - Fixed an assert in background dimming code, which could trigger after using gamepad/keyboard to move a window to another viewport. (#9053) [@lut0pia, @ocornut] +- Fixed implicit/fallback "Debug" window from staying visible if once docked. (#9151) - Backends: - Win32: viewports created by backend forcefully direct messages to DefWindowProcW() in order to support Unicode text input. (#9099, #3653, #5961) [@ulhc] diff --git a/imgui.cpp b/imgui.cpp index 5bdfbee6d..dba024628 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6201,7 +6201,7 @@ void ImGui::EndFrame() // Hide implicit/fallback "Debug" window if it hasn't been used g.WithinFrameScopeWithImplicitWindow = false; - if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) + if (g.CurrentWindow && g.CurrentWindow->IsFallbackWindow && g.CurrentWindow->WriteAccessed == false) g.CurrentWindow->Active = false; End(); @@ -18698,7 +18698,7 @@ static void ImGui::DockNodeUpdateFlagsAndCollapse(ImGuiDockNode* node) bool node_was_active = (node->LastFrameActive + 1 == g.FrameCount); bool remove = false; - remove |= node_was_active && (window->LastFrameActive + 1 < g.FrameCount); + remove |= node_was_active && (window->WasActive == false); // Can't use 'window->LastFrameActive + 1 < g.FrameCount'. (see #9151) remove |= node_was_active && (node->WantCloseAll || node->WantCloseTabId == window->TabId) && window->HasCloseButton && !(window->Flags & ImGuiWindowFlags_UnsavedDocument); // Submit all _expected_ closure from last frame remove |= (window->DockTabWantClose); if (remove) @@ -19405,7 +19405,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w { ImGuiWindow* window = node->Windows[window_n]; if (window->LastFrameActive + 1 < g.FrameCount && node_was_active) - continue; // FIXME: Not sure if that's still taken/useful. + continue; // FIXME: Not sure if that's still taken/useful, as windows are normally removed in DockNodeUpdateFlagsAndCollapse(). ImGuiTabItemFlags tab_item_flags = 0; tab_item_flags |= window->WindowClass.TabItemFlagsOverrideSet; @@ -20994,6 +20994,13 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open) // 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) + { + DockNodeHideWindowDuringHostWindowCreation(window); + return; + } + const bool auto_dock_node = GetWindowAlwaysWantOwnTabBar(window); if (auto_dock_node) {