]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
macOS: Fix residual menu highlight on reopen
authorRoopesh Chander <roop@roopc.net>
Sat, 25 May 2019 18:38:13 +0000 (00:08 +0530)
committerRoopesh Chander <roop@roopc.net>
Sat, 25 May 2019 18:42:47 +0000 (00:12 +0530)
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>
WireGuard/WireGuard/UI/macOS/AppDelegate.swift

index d7a088bda7edcf8c84e1212725a236492327a7e8..ba2b0bdfbac7f3cf52d207fe62eee22eb3033473 100644 (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
     }