From aca23fd3f0eb1b6fb109840f5fc942c49312d096 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 20 Oct 2017 19:25:34 +0200 Subject: [PATCH] Popups: similarly to previous commit, we fix reopening a popup within a popup stack from truncating the whole stack. This is done by properly refocusing the lower level popup. (~#439) --- imgui.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index d40bacde..8849021f 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3567,6 +3567,11 @@ void ImGui::OpenPopupEx(ImGuiID id, bool reopen_existing) { g.OpenPopupStack.resize(current_stack_size+1); g.OpenPopupStack[current_stack_size] = popup_ref; + + // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by CloseInactivePopups(). + // This is equivalent to what ClosePopupToLevel() does. + if (g.OpenPopupStack[current_stack_size].PopupId == id) + FocusWindow(window); } }