|
@@ -8755,18 +8755,29 @@ bool ImGui::BeginMainMenuBar()
|
|
|
float height = GetFrameHeight();
|
|
|
bool is_open = BeginViewportSideBar("##MainMenuBar", viewport, ImGuiDir_Up, height, window_flags);
|
|
|
g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
|
|
|
-
|
|
|
- if (is_open)
|
|
|
- BeginMenuBar();
|
|
|
- else
|
|
|
+ if (!is_open)
|
|
|
+ {
|
|
|
End();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Temporarily disable _NoSavedSettings, in the off-chance that tables or child windows submitted within the menu-bar may want to use settings. (#8356)
|
|
|
+ g.CurrentWindow->Flags &= ~ImGuiWindowFlags_NoSavedSettings;
|
|
|
+ BeginMenuBar();
|
|
|
return is_open;
|
|
|
}
|
|
|
|
|
|
void ImGui::EndMainMenuBar()
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
+ if (!g.CurrentWindow->DC.MenuBarAppending)
|
|
|
+ {
|
|
|
+ IM_ASSERT_USER_ERROR(0, "Calling EndMainMenuBar() not from a menu-bar!"); // Not technically testing that it is the main menu bar
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
EndMenuBar();
|
|
|
+ g.CurrentWindow->Flags |= ImGuiWindowFlags_NoSavedSettings; // Restore _NoSavedSettings (#8356)
|
|
|
|
|
|
// When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
|
|
|
// FIXME: With this strategy we won't be able to restore a NULL focus.
|