From: Roopesh Chander Date: Thu, 28 Mar 2019 18:32:54 +0000 (+0530) Subject: macOS: If a sheet is being shown, ignore quit and bring window to front X-Git-Tag: 0.0.20190409-6~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd9506eceeae1144078aa33cd55bf5bff8aa7dc7;p=thirdparty%2Fwireguard-apple.git macOS: If a sheet is being shown, ignore quit and bring window to front Otherwise, the 'exiting with an active tunnel' alert could get queued up to be shown after the current sheet is dismissed. Signed-off-by: Roopesh Chander --- diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index 1d6d294..990a379 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -44,6 +44,11 @@ class AppDelegate: NSObject, NSApplicationDelegate { } @objc func quit() { + if let manageWindow = manageTunnelsWindowObject, manageWindow.attachedSheet != nil { + NSApp.activate(ignoringOtherApps: true) + manageWindow.orderFront(self) + return + } registerLoginItem(shouldLaunchAtLogin: false) guard let currentTunnel = tunnelsTracker?.currentTunnel, currentTunnel.status == .active || currentTunnel.status == .activating else { NSApp.terminate(nil)