From 007a427e0af93529e483ebc78e50231bb055a8d3 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 18 Jan 2022 16:04:25 +0100 Subject: [PATCH] Viewports: Fixed active InputText() from preventing viewports to merge. (#4212) --- docs/CHANGELOG.txt | 1 + imgui.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 1b6fe962..92780a28 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -208,6 +208,7 @@ Docking+Viewports Branch: - Viewports: Fixed a CTRL+TAB crash with viewports enabled when the window list needs to appears in its own viewport (regression from 1.86). (#4023, #787) +- Viewports: Fixed active InputText() from preventing viewports to merge. (#4212) - (Breaking) Removed ImGuiPlatformIO::Platform_SetImeInputPos() in favor of newly standardized io.SetPlatformImeDataFn() function. Should not affect more than default backends. diff --git a/imgui.cpp b/imgui.cpp index ce2c9dd3..1420f67d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -12925,7 +12925,8 @@ static void ImGui::WindowSelectViewport(ImGuiWindow* window) { // 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); + // Testing (g.ActiveId == 0 || g.ActiveIdAllowOverlap) to avoid merging during a short-term widget interaction. Main intent was to avoid during resize (see #4212) + bool try_to_merge_into_host_viewport = (window->Viewport && window == window->Viewport->Window && (g.ActiveId == 0 || g.ActiveIdAllowOverlap)); if (try_to_merge_into_host_viewport) UpdateTryMergeWindowIntoHostViewports(window); }