From 3b1b5266e54fa6daba32cdf0da95b8d709312d1b Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 2 Jan 2020 22:50:56 +0100 Subject: [PATCH] Docking: Fixed a bug where the tab bar of a hidden dockspace would keep requesting focus. (#2960) --- imgui.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 84b9ed6b..74863074 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -13703,6 +13703,12 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable)) return; + // Early out if parent window is hidden/collapsed + // This is faster but also DockNodeUpdateTabBar() relies on TabBarLayout() running (which won't if SkipItems=true) to set NextSelectedTabId = 0). See #2960. + // If for whichever reason this is causing problem we would need to ensure that DockNodeUpdateTabBar() ends up clearing NextSelectedTabId even if SkipItems=true. + if (window->SkipItems) + flags |= ImGuiDockNodeFlags_KeepAliveOnly; + IM_ASSERT((flags & ImGuiDockNodeFlags_DockSpace) == 0); ImGuiDockNode* node = DockContextFindNodeByID(ctx, id); if (!node)