Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize when multi-viewports are disabled. (#4900)

This commit is contained in:
ocornut 2022-02-10 18:50:28 +01:00
parent aa86800092
commit 1e14cc5cae
2 changed files with 13 additions and 2 deletions

View File

@ -98,6 +98,16 @@ Other changes:
Note that Linux/Mac still have inconsistent support for multi-viewports. If you want to help see https://github.com/ocornut/imgui/issues/2117.
-----------------------------------------------------------------------
VERSION 1.88 WIP (In Progress)
-----------------------------------------------------------------------
Docking+Viewports Branch:
- Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize
when multi-viewports are disabled. (#4900)
-----------------------------------------------------------------------
VERSION 1.87 (Released 2022-02-07)
-----------------------------------------------------------------------

View File

@ -12903,9 +12903,10 @@ ImGuiViewportP* ImGui::AddUpdateViewport(ImGuiWindow* window, ImGuiID id, const
ImGuiViewportP* viewport = (ImGuiViewportP*)FindViewportByID(id);
if (viewport)
{
if (!viewport->PlatformRequestMove)
// Always update for main viewport as we are already pulling correct platform pos/size (see #4900)
if (!viewport->PlatformRequestMove || viewport->ID == IMGUI_VIEWPORT_DEFAULT_ID)
viewport->Pos = pos;
if (!viewport->PlatformRequestResize)
if (!viewport->PlatformRequestResize || viewport->ID == IMGUI_VIEWPORT_DEFAULT_ID)
viewport->Size = size;
viewport->Flags = flags | (viewport->Flags & ImGuiViewportFlags_Minimized); // Preserve existing flags
}