From a63220e3e0b28dfcd51e2e23aa79c1359fcace78 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 4 Nov 2024 11:52:56 +0100 Subject: [PATCH] Docking: fixed using ImGuiDockNodeFlags_KeepAliveOnly with DockSpaceOverViewport(). (#8125) --- docs/CHANGELOG.txt | 7 +++++++ imgui.cpp | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 1808e40f5..101ba26fc 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -53,6 +53,13 @@ Other changes: by 100.0f on Emscripten target. (#4019, #6096, #1463) - Examples: Added SDL3+Vulkan example. (#8084, #8085) +Docking+Viewports Branch: + +- Docking: fixed using ImGuiDockNodeFlags_KeepAliveOnly with DockSpaceOverViewport(): + the normally invisible space did erroneously claim mouse hover and could be potentially + focused. (#8125) [@kcbanner] + + ----------------------------------------------------------------------- VERSION 1.91.4 (Released 2024-10-18) ----------------------------------------------------------------------- diff --git a/imgui.cpp b/imgui.cpp index 34611e295..abb387504 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -19542,6 +19542,11 @@ ImGuiID ImGui::DockSpaceOverViewport(ImGuiID dockspace_id, const ImGuiViewport* if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode) host_window_flags |= ImGuiWindowFlags_NoBackground; + // FIXME-OPT: When using ImGuiDockNodeFlags_KeepAliveOnly with DockSpaceOverViewport() we might be able to spare submitting the window, + // since DockSpace() with that flag doesn't need a window. We'd only need to compute the default ID accordingly. + if (dockspace_flags & ImGuiDockNodeFlags_KeepAliveOnly) + host_window_flags |= ImGuiWindowFlags_NoMouseInputs; + char label[32]; ImFormatString(label, IM_ARRAYSIZE(label), "WindowOverViewport_%08X", viewport->ID);