From 72090b646f00b53bb9e0adc0bff7b8d37388d1bf Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 22 Aug 2019 11:34:17 +0200 Subject: [PATCH] Fixed incorrect assignment of IsFallbackWindow which would tag dock node host windows created in NewFrame() as such, messing with popup viewport inheritance. --- imgui.cpp | 12 ++++++------ imgui_internal.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index a2ba3d8d..e02578b8 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2733,7 +2733,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) SkipItems = false; Appearing = false; Hidden = false; - FallbackWindow = false; + IsFallbackWindow = false; HasCloseButton = false; ResizeBorderHeld = -1; BeginCount = 0; @@ -4062,10 +4062,10 @@ void ImGui::NewFrame() // Create implicit/fallback window - which we will only render it if the user has added something to it. // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. // This fallback is particularly important as it avoid ImGui:: calls from crashing. + g.FrameScopePushedFallbackWindow = true; SetNextWindowSize(ImVec2(400,400), ImGuiCond_FirstUseEver); Begin("Debug##Default"); - IM_ASSERT(g.CurrentWindow->FallbackWindow == true); - g.FrameScopePushedFallbackWindow = true; + IM_ASSERT(g.CurrentWindow->IsFallbackWindow == true); #ifdef IMGUI_ENABLE_TEST_ENGINE ImGuiTestEngineHook_PostNewFrame(&g); @@ -5796,7 +5796,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) const int current_frame = g.FrameCount; const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame); - window->FallbackWindow = (g.CurrentWindowStack.Size == 0); + window->IsFallbackWindow = (g.CurrentWindowStack.Size == 0 && g.FrameScopePushedFallbackWindow); // Update the Appearing flag bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on @@ -10731,7 +10731,7 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window) if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasViewport) == 0) { // By default inherit from parent window - if (window->Viewport == NULL && window->ParentWindow && !window->ParentWindow->FallbackWindow) + if (window->Viewport == NULL && window->ParentWindow && !window->ParentWindow->IsFallbackWindow) window->Viewport = window->ParentWindow->Viewport; // Attempt to restore saved viewport id (= window that hasn't been activated yet), try to restore the viewport based on saved 'window->ViewportPos' restored from .ini file @@ -14024,7 +14024,7 @@ bool ImGui::GetWindowAlwaysWantOwnTabBar(ImGuiWindow* window) ImGuiContext& g = *GImGui; if (g.IO.ConfigDockingAlwaysTabBar || window->WindowClass.DockingAlwaysTabBar) if ((window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoDocking)) == 0) - if (!window->FallbackWindow) // We don't support AlwaysTabBar on the fallback/implicit window to avoid unused dock-node overhead/noise + if (!window->IsFallbackWindow) // We don't support AlwaysTabBar on the fallback/implicit window to avoid unused dock-node overhead/noise return true; return false; } diff --git a/imgui_internal.h b/imgui_internal.h index 91bab1da..ea1709ff 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1465,7 +1465,7 @@ struct IMGUI_API ImGuiWindow bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed) bool Appearing; // Set during the frame where the window is appearing (or re-appearing) bool Hidden; // Do not display (== (HiddenFrames*** > 0)) - bool FallbackWindow; + bool IsFallbackWindow; bool HasCloseButton; // Set when the window has a close button (p_open != NULL) signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3) short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)