]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
macOS: If a sheet is being shown, ignore quit and bring window to front
authorRoopesh Chander <roop@roopc.net>
Thu, 28 Mar 2019 18:32:54 +0000 (00:02 +0530)
committerRoopesh Chander <roop@roopc.net>
Thu, 28 Mar 2019 18:47:37 +0000 (00:17 +0530)
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 <roop@roopc.net>
WireGuard/WireGuard/UI/macOS/AppDelegate.swift

index 1d6d29423bd8f946d47fb3eec5431a1575d2ad1e..990a3797d39d0475b20d39aab58a3670ebec4698 100644 (file)
@@ -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)