From bf87fbcbcc8ffb8ec70a447dfdccadfe6eefe2c2 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 22 Mar 2023 18:48:16 +0100 Subject: [PATCH] Docking: Fixed using GetItemXXX() or IsItemXXX() functions after a DockSpace(). (#6217) --- docs/CHANGELOG.txt | 1 + imgui.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 07195c317..f68974ba3 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -122,6 +122,7 @@ Other changes: Docking+Viewports Branch: +- Docking: Fixed using GetItemXXX() or IsItemXXX() functions after a DockSpace(). (#6217) - Backends: GLFW: Fixed key modifiers handling on secondary viewports. (#6248, #6034) [@aiekick] - Backends: GLFW: Fixed Emscripten erroneously enabling multi-viewport support, leading to assert. (#5683) - Backends: SDL3: Fixed for compilation with multi-viewports. (#6255) [@P3RK4N] diff --git a/imgui.cpp b/imgui.cpp index 3fa36cd90..a397355a9 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -17494,7 +17494,13 @@ ImGuiID ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags DockNodeUpdate(node); End(); + + ImRect bb(node->Pos, node->Pos + size); ItemSize(size); + ItemAdd(bb, id, NULL, ImGuiItemFlags_NoNav); // Not a nav point (could be, would need to draw the nav rect and replicate/refactor activation from BeginChild(), but seems like CTRL+Tab works better here?) + if ((g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HoveredRect) && IsWindowChildOf(g.HoveredWindow, host_window, false, true)) // To fullfill IsItemHovered(), similar to EndChild() + g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow; + return id; }