Skip to content

Commit

Permalink
Viewports: Fixed main viewport size not matching ImDrawData::DisplayS…
Browse files Browse the repository at this point in the history
…ize for one frame during resize when multi-viewports are disabled. (#4900)
  • Loading branch information
ocornut committed Feb 10, 2022
1 parent aa86800 commit 1e14cc5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
-----------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 1e14cc5

Please sign in to comment.