From 8648346eab5a485c5006a6a9473fe6c9d3eb4fe6 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 10 May 2016 17:02:10 +0200 Subject: [PATCH] Modal: fixed non-child window stacked over a modal losing its hoverabilty/focusability (#615, #604) --- imgui.cpp | 5 ++++- imgui_demo.cpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index a849ba5a..b77a00aa 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2085,7 +2085,10 @@ void ImGui::NewFrame() if (ImGuiWindow* modal_window = GetFrontMostModalRootWindow()) { g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f); - if (g.HoveredRootWindow != modal_window) + ImGuiWindow* window = g.HoveredRootWindow; + while (window && window != modal_window) + window = window->ParentWindow; + if (!window) g.HoveredRootWindow = g.HoveredWindow = NULL; } else diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 9a6a8522..3a2296e6 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1244,6 +1244,9 @@ void ImGui::ShowTestWindow(bool* p_open) ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n"); ImGui::Separator(); + //static int dummy_i = 0; + //ImGui::Combo("Combo", &dummy_i, "Delete\0Delete harder\0"); + static bool dont_ask_me_next_time = false; ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); ImGui::Checkbox("Don't ask me next time", &dont_ask_me_next_time);