Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions modules/juce_gui_basics/native/juce_MainMenu_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,9 @@ void updateTopLevelMenu (NSMenuItem* parentItem, const PopupMenu& menuToCopy, co
// Note: This method used to update the contents of the existing menu in-place, but that caused
// weird side-effects which messed-up keyboard focus when switching between windows. By creating
// a new menu and replacing the old one with it, that problem seems to be avoided..
NSMenu* menu = [[NSMenu alloc] initWithTitle: juceStringToNS (name)];

for (PopupMenu::MenuItemIterator iter (menuToCopy); iter.next();)
addMenuItem (iter, menu, menuId, topLevelIndex);

[menu update];
// The new menu needs the delegate too, so that it keeps receiving menuNeedsUpdate: and
// its items' enabled states don't stay frozen at the last rebuild.
NSMenu* menu = createMenu (menuToCopy, name, menuId, topLevelIndex, true);

removeItemRecursive ([parentItem submenu]);
[parentItem setSubmenu: menu];
Expand Down