From: Roopesh Chander Date: Sat, 5 Jan 2019 08:46:28 +0000 (+0530) Subject: macOS: Present errors as a sheet when applicable X-Git-Tag: 0.0.20190207-1~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=252d940d34484a9f0580d36ea29e44b9c1738561;p=thirdparty%2Fwireguard-apple.git macOS: Present errors as a sheet when applicable Signed-off-by: Roopesh Chander --- 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?() + } } }