macOS: Fix residual menu highlight on reopen

If we close the window with Cmd+W or Cmd+Q and then re-launch the app,
the main menu shows residual highlight from the close action. This
commit fixes that.

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2019-05-26 00:08:13 +05:30
parent 5100e597aa
commit a18614d6b3
1 changed files with 3 additions and 1 deletions

View File

@ -135,7 +135,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
func applicationShouldTerminateAfterLastWindowClosed(_ application: NSApplication) -> Bool {
setDockIconAndMainMenuVisibility(isVisible: false)
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(200)) { [weak self] in
self?.setDockIconAndMainMenuVisibility(isVisible: false)
}
return false
}