From a18614d6b3251a66f8d30df9d53072c7b3589b12 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Sun, 26 May 2019 00:08:13 +0530 Subject: 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 --- WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'WireGuard') 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 } -- cgit v1.2.3-59-g8ed1b