From 59a89774d79ee5d39c38a0f0721702e2322e7bf5 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 20 Oct 2017 19:24:12 +0200 Subject: [PATCH] Popups: fixed CloseInactivePopups() so that right-clicking to close one level of popups in a popups stack won't close the whole stack. This is done by properly refocusing the lower level popup. Fixes 87ae40843c0b5c526edd9cdb62b072cd0bcc49ff (~#439) --- imgui.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 189fa669..d40bacde 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2802,9 +2802,7 @@ void ImGui::EndFrame() // With right mouse button we close popups without changing focus // (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger) if (g.IO.MouseClicked[1]) - { CloseInactivePopups(g.HoveredWindow); - } } } @@ -3605,8 +3603,8 @@ static void CloseInactivePopups(ImGuiWindow* ref_window) break; } } - if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a useful breakpoint on the line below - g.OpenPopupStack.resize(n); + if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the block below + ClosePopupToLevel(n); } static ImGuiWindow* GetFrontMostModalRootWindow()