From 010757266e587252774575d624f371e9db17cc35 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 23 Apr 2018 23:00:14 +0200 Subject: [PATCH] Viewports: Todos, Tooltips/menus not automatically forced into their own viewport when the NoMerge flag is set (however the multiplication of viewports makes them more likely to protude and create their own). Win32: try to make primary monitor the first tin the list. (#1542) --- TODO.txt | 8 ++++++++ imgui.cpp | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/TODO.txt b/TODO.txt index 2ddd1cf9..28a1db8a 100644 --- a/TODO.txt +++ b/TODO.txt @@ -258,6 +258,14 @@ 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: clamp windows position within monitors (especially important on monitor configuration change) -> clamp to closest rectangle. + - 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: 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: IME positioning are wrong. + - viewport: vulkan renderer implementation. + - viewport: need to clarify how to use GetMousePos() from a user point of view. + - 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. - inputs: rework IO system to be able to pass actual ordered/timestamped events. use an event queue? (~#335, #71) - inputs: support track pad style scrolling & slider edit. diff --git a/imgui.cpp b/imgui.cpp index d423d425..e3aa2608 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3307,10 +3307,11 @@ static void SetWindowViewport(ImGuiWindow* window, ImGuiViewportP* viewport) static bool GetWindowAlwaysWantOwnViewport(ImGuiWindow* window) { + // Tooltips and menus are not automatically forced into their own viewport when the NoMerge flag is set, however the multiplication of viewports makes them more likely to protude and create their own. ImGuiContext& g = *GImGui; - if ((g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) && (g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsNoMerge)) + if ((g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsNoMerge) && (g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)) //if (window->DockStatus == ImGuiDockStatus_Floating) - if ((window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_ChildMenu)) == 0) + if ((window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_Tooltip)) == 0) return true; return false; }