From: Roopesh Chander Date: Sat, 25 May 2019 18:38:13 +0000 (+0530) Subject: macOS: Fix residual menu highlight on reopen X-Git-Tag: 0.0.20190531-9~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a18614d6b3251a66f8d30df9d53072c7b3589b12;p=thirdparty%2Fwireguard-apple.git 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 --- diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index d7a088b..ba2b0bd 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -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 }