From 05bc323be0aaf31704a7f959160f73b64abef284 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 3 Jan 2019 20:16:40 +0100 Subject: [PATCH] Viewport: Fixed minimization of main viewport leading to it being omitted from platform_io.Viewport list where the users assume it is at index 0. Fix d8ab2c1ac. It wasn't a problem when other viewports were child of the main viewport because they would all be minimized together. (#1542) --- imgui.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 763d58d2..cae05b0e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7419,7 +7419,6 @@ static void ImGui::UpdateViewportsNewFrame() ImGuiContext& g = *GImGui; IM_ASSERT(g.PlatformIO.Viewports.Size <= g.Viewports.Size); - // Update main viewport with current platform position and size ImGuiViewportP* main_viewport = g.Viewports[0]; IM_ASSERT(main_viewport->ID == IMGUI_VIEWPORT_DEFAULT_ID); IM_ASSERT(main_viewport->Window == NULL); @@ -7461,9 +7460,6 @@ static void ImGui::UpdateViewportsNewFrame() const bool platform_funcs_available = (n == 0 || viewport->PlatformWindowCreated); if ((g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable)) { - if (g.PlatformIO.Platform_GetWindowMinimized && platform_funcs_available) - viewport->PlatformWindowMinimized = g.PlatformIO.Platform_GetWindowMinimized(viewport); - // Update Position and Size (from Platform Window to ImGui) if requested. // We do it early in the frame instead of waiting for UpdatePlatformWindows() to avoid a frame of lag when moving/resizing using OS facilities. if (!viewport->PlatformWindowMinimized && platform_funcs_available) @@ -7577,7 +7573,8 @@ static void ImGui::UpdateViewportsEndFrame() ImGuiViewportP* viewport = g.Viewports[i]; viewport->LastPos = viewport->Pos; if (viewport->LastFrameActive < g.FrameCount || viewport->Size.x <= 0.0f || viewport->Size.y <= 0.0f) - continue; + if (i > 0) // Always include main viewport in the list + continue; if (viewport->Window && !IsWindowActiveAndVisible(viewport->Window)) continue; if (i > 0)