diff --git a/docs/TODO.txt b/docs/TODO.txt index edc053a96..c8d77637f 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -287,7 +287,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - viewport: with platform decoration enabled, platform may force constraint (e.g. minimum size) - 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: implicit Debug window can hog a zombie viewport (harmless, noisy?) > could at least clear out the reference on a per session basis? + - viewport: implicit/fallback Debug window can hog a zombie viewport (harmless, noisy?) > could at least clear out the reference on a per session basis? - viewport: need to clarify how to use GetMousePos() from a user point of view. - platform: glfw: no support for ImGuiBackendFlags_HasMouseHoveredViewport. - platform: sdl: no support for ImGuiBackendFlags_HasMouseHoveredViewport. maybe we could use SDL_GetMouseFocus() / SDL_WINDOW_MOUSE_FOCUS if imgui could fallback on its heuristic when NoInputs is set diff --git a/imgui.cpp b/imgui.cpp index 631046383..3c4c20fae 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7487,10 +7487,6 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window) return; } - // Merge into host viewport - bool try_to_merge_into_host_viewport = false; - if (window->ViewportOwned && g.ActiveId == 0) - try_to_merge_into_host_viewport = true; window->ViewportOwned = false; // Appearing popups reset their viewport so they can inherit again @@ -7541,6 +7537,9 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window) } else { + // Merge into host viewport? + // We cannot test window->ViewportOwned as it set lower in the function. + bool try_to_merge_into_host_viewport = (window->Viewport && window == window->Viewport->Window && g.ActiveId == 0); if (try_to_merge_into_host_viewport) UpdateTryMergeWindowIntoHostViewport(window, g.Viewports[0]); } @@ -7594,7 +7593,7 @@ void ImGui::UpdatePlatformWindows() { ImGuiViewportP* viewport = g.Viewports[i]; - // Destroy platform window if the viewport hasn't been submitted or if it is hosting a hidden window (the implicit Debug window will be registered its viewport then be disabled) + // Destroy platform window if the viewport hasn't been submitted or if it is hosting a hidden window (the implicit/fallback Debug window will be registered its viewport then be disabled) bool destroy_platform_window = false; destroy_platform_window |= (viewport->LastFrameActive < g.FrameCount - 1); destroy_platform_window |= (viewport->Window && !IsWindowActiveAndVisible(viewport->Window));