From 52e257668dd55a78dec0cac3427e7002f441baef Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Mon, 14 Jan 2019 17:27:52 +0100 Subject: [PATCH] fix: windowmenu did not show the window list on macOS (#16387) --- atom/browser/ui/cocoa/atom_menu_controller.mm | 4 +++- lib/browser/api/menu-item-roles.js | 4 +--- spec/api-menu-item-spec.js | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/atom/browser/ui/cocoa/atom_menu_controller.mm b/atom/browser/ui/cocoa/atom_menu_controller.mm index 403e2fcf73b2..fe632fe24b33 100644 --- a/atom/browser/ui/cocoa/atom_menu_controller.mm +++ b/atom/browser/ui/cocoa/atom_menu_controller.mm @@ -231,7 +231,9 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; [item setSubmenu:submenu]; // Set submenu's role. - if (role == base::ASCIIToUTF16("window") && [submenu numberOfItems]) + if ((role == base::ASCIIToUTF16("window") || + role == base::ASCIIToUTF16("windowmenu")) && + [submenu numberOfItems]) [NSApp setWindowsMenu:submenu]; else if (role == base::ASCIIToUTF16("help")) [NSApp setHelpMenu:submenu]; diff --git a/lib/browser/api/menu-item-roles.js b/lib/browser/api/menu-item-roles.js index 192f993b501d..e5d47d665caf 100644 --- a/lib/browser/api/menu-item-roles.js +++ b/lib/browser/api/menu-item-roles.js @@ -247,9 +247,7 @@ const roles = { { role: 'zoom' }, ...(isMac ? [ { type: 'separator' }, - { role: 'front' }, - { type: 'separator' }, - { role: 'window' } + { role: 'front' } ] : [ { role: 'close' } ]) diff --git a/spec/api-menu-item-spec.js b/spec/api-menu-item-spec.js index 10d8e1279c5d..e44570e4352f 100644 --- a/spec/api-menu-item-spec.js +++ b/spec/api-menu-item-spec.js @@ -442,8 +442,6 @@ describe('MenuItems', () => { if (process.platform === 'darwin') { expect(item.submenu.items[2].type).to.equal('separator') expect(item.submenu.items[3].role).to.equal('front') - expect(item.submenu.items[4].type).to.equal('separator') - expect(item.submenu.items[5].role).to.equal('window') } else { expect(item.submenu.items[2].role).to.equal('close') }