From 71eb4034eba128f01aebc856e9ce65fd38edea86 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 12 Apr 2020 17:48:24 +0200 Subject: [PATCH] Viewports: Fixed viewport merge code not testing the Minimized flag correctly. (#3118) --- imgui.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 4fcfd055..31d7a416 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3552,7 +3552,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame() if (g.NavWindow && g.NavWindow->Appearing) return; - // Click on void to focus window and start moving + // Click on void to focus window and start moving // (after we're done with all our widgets, so e.g. clicking on docking tab-bar which have set HoveredId already and not get us here!) if (g.IO.MouseClicked[0]) { @@ -4424,7 +4424,7 @@ void ImGui::EndFrame() { ImGuiContext& g = *GImGui; IM_ASSERT(g.Initialized); - + // Don't process EndFrame() multiple times. if (g.FrameCountEnded == g.FrameCount) return; @@ -10679,7 +10679,11 @@ static bool ImGui::GetWindowAlwaysWantOwnViewport(ImGuiWindow* window) static bool ImGui::UpdateTryMergeWindowIntoHostViewport(ImGuiWindow* window, ImGuiViewportP* viewport) { ImGuiContext& g = *GImGui; - if (!(viewport->Flags & (ImGuiViewportFlags_CanHostOtherWindows | ImGuiViewportFlags_Minimized)) || window->Viewport == viewport) + if (window->Viewport == viewport) + return false; + if ((viewport->Flags & ImGuiViewportFlags_CanHostOtherWindows) == 0) + return false; + if ((viewport->Flags & ImGuiViewportFlags_Minimized) != 0) return false; if (!viewport->GetMainRect().Contains(window->Rect())) return false; @@ -10793,7 +10797,7 @@ static void ImGui::UpdateViewportsNewFrame() } } - // Create/update main viewport with current platform position. + // Create/update main viewport with current platform position. // FIXME-VIEWPORT: Size is driven by back-end/user code for backward-compatibility but we should aim to make this more consistent. ImGuiViewportP* main_viewport = g.Viewports[0]; IM_ASSERT(main_viewport->ID == IMGUI_VIEWPORT_DEFAULT_ID);