Skip to content

Commit f14042c

Browse files
committed
Viewports Added ImGui::GetMainViewport() as a way to get the bounds and work area of the host display. (ocornut#3789, ocornut#1542)
Viewports: Backport a few constructs from 'docking' branch. Viewports: Added ImGuiViewportFlags_IsPlatformWindow, ImGuiViewportFlags_IsPlatformMonitor, ImGuiViewportFlags_OwnedByApp (none of them were in docking branch yet). ImGuiViewportFlags_IsPlatformMonitor is merely there to convey future intent, not yet used. Reduce uses of io.DisplaySize. MainMenuBar: Backport work area handling code from 'docking' branch. Metrics: Backported "Viewports" debug visualizer from 'docking' branch. Demo: Rework 'Examples->Fullscreen Window'. Demo: 'Simple Overlay' demo now moves under main menu-bar (if any) using GetMainViewport()'s work area.
1 parent 3b4d3a9 commit f14042c

6 files changed

+443
-122
lines changed

docs/CHANGELOG.txt

+18-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ Breaking Changes:
5252

5353
Other Changes:
5454

55+
- Viewports Added ImGui::GetMainViewport() as a way to get the bounds and work area of the host display. (#3789, #1542)
56+
- In 'master' branch or without multi-viewports feature enabled:
57+
- GetMainViewport()->Pos is always == (0,0)
58+
- GetMainViewport()->Size is always == io.DisplaySize
59+
- In 'docking' branch and with the multi-viewports feature enabled:
60+
- GetMainViewport() will return information from your host Platform Window.
61+
- In the future, we will support a "no main viewport" mode and this may return bounds of your main monitor.
62+
- For forward compatibility with multi-viewports/multi-monitors:
63+
- Code using (0,0) as a way to signify "upper-left of the host window" should use GetMainViewport()->Pos.
64+
- Code using io.DisplaySize as a way to signify "size of the host window" should use GetMainViewport()->Size.
65+
- We are also exposing a work area in ImGuiViewport ('WorkPos', 'WorkSize' vs 'Pos', 'Size' for full area):
66+
- For a Platform Window, the work area is generally the full area minus space used by menu-bars.
67+
- For a Platform Monitor, the work area is generally the full area minus space used by task-bars.
68+
- All of this has been the case in 'docking' branch for a long time. What we've done is merely merging
69+
a small chunk of the multi-viewport logic into 'master' to standardize some concepts ahead of time.
5570
- Tables: Fixed PopItemWidth() or multi-components items not restoring per-colum ItemWidth correctly. (#3760)
5671
- Window: Fixed minor title bar text clipping issue when FramePadding is small/zero and there are no
5772
close button in the window. (#3731)
@@ -80,7 +95,9 @@ Other Changes:
8095
Would lead to a buffer read overflow.
8196
- ImDrawList: Clarified PathArcTo() need for a_min <= a_max with an assert.
8297
- ImDrawList: Fixed PathArcToFast() handling of a_min > a_max.
83-
- Demo: Added 'Examples->Fullscreen Window' demo. (#3789)
98+
- Metrics: Backported "Viewports" debug visualizer from 'docking' branch.
99+
- Demo: Added 'Examples->Fullscreen Window' demo using GetMainViewport() values. (#3789)
100+
- Demo: 'Simple Overlay' demo now moves under main menu-bar (if any) using GetMainViewport()'s work area.
84101
- Backends: Win32: Dynamically loading XInput DLL instead of linking with it, facilite compiling with
85102
old WindowSDK versions or running on Windows 7. (#3646, #3645, #3248, #2716) [@Demonese]
86103
- Backends: Vulkan: Add support for custom Vulkan function loader and VK_NO_PROTOTYPES. (#3759, #3227) [@Hossein-Noroozpour]

0 commit comments

Comments
 (0)