mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-01 11:39:15 +08:00
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)
This commit is contained in:
parent
599a52629a
commit
05bc323be0
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user