From 1a4f369d4a13cb37a996a2546e90100685cb9a8d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 3 Feb 2022 01:59:56 +0100 Subject: [PATCH] Backport 19471da from ImGui. https://github.com/ocornut/imgui/issues/4920 --- imgui/imgui.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui/imgui.cpp b/imgui/imgui.cpp index b9b835f1..579d8356 100644 --- a/imgui/imgui.cpp +++ b/imgui/imgui.cpp @@ -6270,7 +6270,9 @@ static ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window) for (int i = g.OpenPopupStack.Size - 1; i >= 0; i--) { ImGuiWindow* popup_window = g.OpenPopupStack.Data[i].Window; - if (popup_window == NULL || !popup_window->WasActive || !(popup_window->Flags & ImGuiWindowFlags_Modal)) // Check WasActive, because this code may run before popup renders on current frame. + if (popup_window == NULL || !(popup_window->Flags & ImGuiWindowFlags_Modal)) + continue; + if (!popup_window->Active && !popup_window->WasActive) // Check WasActive, because this code may run before popup renders on current frame, also check Active to handle newly created windows. continue; if (IsWindowWithinBeginStackOf(window, popup_window)) // Window is rendered over last modal, no render order change needed. break;