aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift12
1 files changed, 10 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift
index c83a339..69ea731 100644
--- a/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift
+++ b/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift
@@ -9,7 +9,15 @@ class ErrorPresenter: ErrorPresenterProtocol {
alert.messageText = title
alert.informativeText = message
onPresented?()
- alert.runModal()
- onDismissal?()
+ if let sourceVC = sourceVC as? NSViewController {
+ NSApp.activate(ignoringOtherApps: true)
+ sourceVC.view.window!.makeKeyAndOrderFront(nil)
+ alert.beginSheetModal(for: sourceVC.view.window!) { _ in
+ onDismissal?()
+ }
+ } else {
+ alert.runModal()
+ onDismissal?()
+ }
}
}