mac: Make sure menuWillShow is called when setting application menu.

This commit is contained in:
Cheng Zhao 2014-05-25 15:42:23 +08:00
parent 6a48568911
commit cd35430d0e

View file

@ -97,6 +97,12 @@ Menu.setApplicationMenu = (menu) ->
applicationMenu = menu # Keep a reference. applicationMenu = menu # Keep a reference.
if process.platform is 'darwin' if process.platform is 'darwin'
# Force menuWillShow to be called
menuWillShow = (menu) ->
menu.delegate.menuWillShow()
menuWillShow item.submenu for item in menu.items when item.submenu?
menuWillShow menu
bindings.setApplicationMenu menu bindings.setApplicationMenu menu
else else
windows = BrowserWindow.getAllWindows() windows = BrowserWindow.getAllWindows()