From f6f5c511063d53256fadaf1ce0575a3d684a53ba Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 14 Dec 2018 18:42:11 +0100 Subject: [PATCH] Internals: Popups: EndMenu() calls ClosePopupToLevel(g.CurrentPopupStack.Size) which is more correct. --- imgui_widgets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 3bc83441..d3edd7bf 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -5687,14 +5687,14 @@ bool ImGui::BeginMenu(const char* label, bool enabled) void ImGui::EndMenu() { - // Nav: When a left move request _within our child menu_ failed, close the menu. + // Nav: When a left move request _within our child menu_ failed, close ourselves (the _parent_ menu). // A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs. // However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction. ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical) { - ClosePopupToLevel(g.OpenPopupStack.Size - 1); + ClosePopupToLevel(g.CurrentPopupStack.Size); NavMoveRequestCancel(); }