1
0
mirror of https://github.com/ocornut/imgui.git synced 2025-02-18 03:27:18 +01:00

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)

This commit is contained in:
omar 2017-10-20 19:24:12 +02:00
parent 43df7eb5ea
commit 59a89774d7

View File

@ -2802,9 +2802,7 @@ void ImGui::EndFrame()
// With right mouse button we close popups without changing focus // With right mouse button we close popups without changing focus
// (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger) // (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger)
if (g.IO.MouseClicked[1]) if (g.IO.MouseClicked[1])
{
CloseInactivePopups(g.HoveredWindow); CloseInactivePopups(g.HoveredWindow);
}
} }
} }
@ -3605,8 +3603,8 @@ static void CloseInactivePopups(ImGuiWindow* ref_window)
break; break;
} }
} }
if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a useful breakpoint on the line below if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the block below
g.OpenPopupStack.resize(n); ClosePopupToLevel(n);
} }
static ImGuiWindow* GetFrontMostModalRootWindow() static ImGuiWindow* GetFrontMostModalRootWindow()