From c363b6df2b4d4aeb7978b71b03ae5002bd5ae6ca Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 27 Oct 2021 12:02:42 +0200 Subject: [PATCH] Modals: fixed issue hovering popups inside a child inside a modal. Fixed IsWindowFocused()/IsWindowHovered() issues with childs inside popups. (#4676)(#4676, #4527) Amend/fix 6b1e094f, fc4988ffb (Sep 24) --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 90033f79..0ae0d0b8 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -39,6 +39,8 @@ Breaking Changes: Other Changes: - Added IsMouseTripleClicked() function. Tracking multi-click count in IO structure. (#3229) [@kudaba] +- Modals: fixed issue hovering popups inside a child inside a modal. (#4676, #4527) +- Fixed IsWindowFocused()/IsWindowHovered() issues with childs inside popups. (#4676) - InputText: made double-click select word, triple-line select line. Word delimitation logic differs slightly from the one used by CTRL+arrows. (#2244) - Backends: Vulkan: Call vkCmdSetScissor() at the end of render with a full-viewport to reduce diff --git a/imgui.cpp b/imgui.cpp index 880c9334..912d6c9d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6719,9 +6719,14 @@ void ImGui::PopTextWrapPos() static ImGuiWindow* GetCombinedRootWindow(ImGuiWindow* window, bool popup_hierarchy) { - window = window->RootWindow; - if (popup_hierarchy) - window = window->RootWindowPopupTree; + ImGuiWindow* last_window = NULL; + while (last_window != window) + { + last_window = window; + window = window->RootWindow; + if (popup_hierarchy) + window = window->RootWindowPopupTree; + } return window; }