|
@@ -7183,13 +7183,15 @@ void ImGui::EndMenu()
|
|
|
// FIXME: This doesn't work if the parent BeginMenu() is not on a menu.
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
|
|
- if (g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
|
|
- if (g.NavWindow && (g.NavWindow->RootWindowForNav->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->RootWindowForNav->ParentWindow == window)
|
|
|
- {
|
|
|
- ClosePopupToLevel(g.BeginPopupStack.Size, true);
|
|
|
- NavMoveRequestCancel();
|
|
|
- }
|
|
|
+ IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginMenu()/EndMenu() calls
|
|
|
|
|
|
+ if (window->BeginCount == window->BeginCountPreviousFrame)
|
|
|
+ if (g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
|
|
+ if (g.NavWindow && (g.NavWindow->RootWindowForNav->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->RootWindowForNav->ParentWindow == window)
|
|
|
+ {
|
|
|
+ ClosePopupToLevel(g.BeginPopupStack.Size, true);
|
|
|
+ NavMoveRequestCancel();
|
|
|
+ }
|
|
|
EndPopup();
|
|
|
}
|
|
|
|