Viewport: Removed unnecessary fields (now that the coordinate system is consistent accross viewports): MouseRefPrevViewport, MouseClickedPosViewportId. (#1542)
@ -258,8 +258,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame)
- focus: unable to use SetKeyboardFocusHere() on clipped widgets. (#787)
- viewport: popup/tooltip glitches when appearing near the monitor limits (e.g. opening a menu).
- 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.
- viewport: use getfocus/setfocus api to synchronize imgui<>platform focus better (e.g imgui-side ctrl-tab can focus os window, OS initial setup and alt-tab can focus imgui window etc.)
- 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.
- viewport: vulkan renderer implementation.
- viewport: need to clarify how to use GetMousePos() from a user point of view.
// This code supports multiple OS Windows mapped into different ImGui viewports,
// So it is a little more complicated than your typical binding code (which only needs to set io.MousePos in your WM_MOUSEMOVE handler)
// So it is a little more complicated than your typical single-viewport binding code (which only needs to set io.MousePos from the WM_MOUSEMOVE handler)
// This is what imgui needs from the back-end to support multiple windows:
// - io.MousePos = mouse position (e.g. io.MousePos == viewport->Pos when we are on the upper-left of our viewport)
// - io.MousePos = mouse position in absolute coordinate (e.g. io.MousePos == ImVec2(0,0) when it is on the upper-left of the primary monitor)
// - io.MousePosViewport = viewport which mouse position is based from (generally the focused/active/capturing viewport)
// - io.MouseHoveredWindow = viewport which mouse is hovering, **regardless of it being the active/focused window**, **regardless of another window holding mouse captured**. [Optional]
// This function overwrite the value of io.MousePos normally updated by the WM_MOUSEMOVE handler.
ImVector<ImGuiViewportP*>Viewports;// Active viewports (always 1+, and generally 1 unless multi-viewports are enabled). Each viewports hold their copy of ImDrawData.
ImGuiViewportP*CurrentViewport;// We track changes of viewport (happening in Begin) so we can call Platform_OnChangedViewport()
ImGuiViewportP*MouseRefViewport;
ImGuiViewportP*MouseRefPrevViewport;
ImGuiViewportP*MouseHoveredLastViewport;// Last viewport that was hovered by mouse (even if we are not hovering any viewport any more)
ImGuiIDMouseClickedPosViewportId[5];// For rarely used fields we only compare to, store viewport ID only so we don't have to clean dangling pointers
ImGuiViewportP*MouseLastHoveredViewport;// Last known viewport that was hovered by mouse (even if we are not hovering any viewport any more)
ImGuiIDPlatformLastFocusedViewport;// Record of last focused platform window/viewport, when this changes we stamp the viewport as front-most