You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Viewport, Platform: Using Platform_GetWindowFocus to provide a much stronger heuristic of platform z-order, in replacement for when the back-end cannot provide io.MouseHoveredViewport. The pressure for it to work well increased with the use of viewports by popups/menus. (#1542)
Copy file name to clipboardExpand all lines: TODO.txt
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -262,7 +262,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
262
262
- viewport: platform: introduce getfocus/setfocus api, so e.g. focus flags can be honored, imgui-side ctrl-tab can focus os window, OS alt-tab can focus imgui window etc.
263
263
- viewport: store per-viewport/monitor DPI in .ini file so an application reload or main window changing DPI on reload can be properly patched for.
264
264
- viewport: vulkan renderer implementation.
265
-
- viewport: fallback calculation of hovered window is very currently wrong without ImGuiBackendFlags_HasMouseHoveredViewport. typically affect half-overlapping viewported menus.
266
265
- viewport: need to clarify how to use GetMousePos() from a user point of view.
267
266
268
267
- inputs: we need an explicit flag about whether the imgui window is focused, to be able to distinguish focused key releases vs alt-tabbing all release behaviors.
// Even without focus, we assume the window becomes front-most. This is used by our platform z-order heuristic when io.MouseHoveredViewport is not available.
3681
+
if (is_new_window && viewport->LastFrontMostStampCount != g.WindowsFrontMostStampCount)
Copy file name to clipboardExpand all lines: imgui.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1073,7 +1073,7 @@ struct ImGuiIO
1073
1073
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
1074
1074
float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all back-ends.
1075
1075
ImGuiID MousePosViewport; // (Optional) When using multiple viewports: viewport from which io.MousePos is based from (when dragging this is generally the captured/focused viewport, even though we can drag outside of it and then it's not hovered anymore). (0 == default viewport)
1076
-
ImGuiID MouseHoveredViewport; // (Optional) When using multiple viewports: viewport the OS mouse cursor is hovering. (0 == default viewport) _IGNORING_ viewports with the ImGuiBackendFlags_HasMouseHoveredViewport flag, and _REGARDLESS_ of whether another viewport is focused. Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this information.
1076
+
ImGuiID MouseHoveredViewport; // (Optional) When using multiple viewports: viewport the OS mouse cursor is hovering_IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag, and _REGARDLESS_ of whether another viewport is focused. Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this info. If you don't imgui will use a decent heuristic instead.
1077
1077
bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
1078
1078
bool KeyCtrl; // Keyboard modifier pressed: Control
Copy file name to clipboardExpand all lines: imgui_internal.h
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -511,8 +511,8 @@ struct ImGuiViewportP : public ImGuiViewport
511
511
{
512
512
int Idx;
513
513
int LastFrameActive; // Last frame number this viewport was activated by a window
514
-
int LastFrameAsRefViewport; // Last frame number this viewport was io.MouseViewportRef
515
514
int LastFrameOverlayDrawList;
515
+
int LastFrontMostStampCount; // Last stamp number from when a window hosted by this viewport was made front-most (by comparing this value between two viewport we have an implicit viewport z-order
516
516
ImGuiID LastNameHash;
517
517
ImVec2 LastPos;
518
518
float Alpha; // Window opacity (when dragging dockable windows/viewports we make them transparent)
@@ -524,7 +524,7 @@ struct ImGuiViewportP : public ImGuiViewport
0 commit comments