From 229275f106371d79800e0ca1cbc7b6c1827bc2ac Mon Sep 17 00:00:00 2001 From: david Date: Fri, 7 May 2021 13:19:16 -0400 Subject: [PATCH] fix: macOS windows order (#242) * Make sure window is always on top on webview creation --- .changes/macos-window-order.md | 5 +++++ src/webview/macos/mod.rs | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .changes/macos-window-order.md diff --git a/.changes/macos-window-order.md b/.changes/macos-window-order.md new file mode 100644 index 000000000..86887aa7d --- /dev/null +++ b/.changes/macos-window-order.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Fix macOS windows order for tray (statusbar) applications. diff --git a/src/webview/macos/mod.rs b/src/webview/macos/mod.rs index f2d7a6cb4..5852d8b7c 100644 --- a/src/webview/macos/mod.rs +++ b/src/webview/macos/mod.rs @@ -296,6 +296,10 @@ impl InnerWebView { let _: () = msg_send![webview, setWantsLayer: YES]; // Inject the web view into the window as main content let _: () = msg_send![ns_window, setContentView: webview]; + // make sure the window is always on top when we create a new webview + let app_class = class!(NSApplication); + let app: id = msg_send![app_class, sharedApplication]; + let _: () = msg_send![app, activateIgnoringOtherApps: YES]; Ok(w) }