@@ -23,8 +23,6 @@ use tauri_runtime::window::MenuEvent;
2323use tauri_runtime:: { SystemTray , SystemTrayEvent } ;
2424#[ cfg( windows) ]
2525use winapi:: shared:: windef:: HWND ;
26- #[ cfg( target_os = "macos" ) ]
27- use wry:: application:: platform:: macos:: WindowExtMacOS ;
2826#[ cfg( all( feature = "system-tray" , target_os = "macos" ) ) ]
2927use wry:: application:: platform:: macos:: { SystemTrayBuilderExtMacOS , SystemTrayExtMacOS } ;
3028#[ cfg( target_os = "linux" ) ]
@@ -68,10 +66,11 @@ pub use wry::application::window::{Window, WindowBuilder as WryWindowBuilder, Wi
6866use wry:: webview:: WebviewExtWindows ;
6967
7068#[ cfg( target_os = "macos" ) ]
71- use tauri_runtime:: menu:: NativeImage ;
69+ use tauri_runtime:: { menu:: NativeImage , ActivationPolicy } ;
7270#[ cfg( target_os = "macos" ) ]
7371pub use wry:: application:: platform:: macos:: {
74- CustomMenuItemExtMacOS , NativeImage as WryNativeImage ,
72+ ActivationPolicy as WryActivationPolicy , CustomMenuItemExtMacOS , EventLoopExtMacOS ,
73+ NativeImage as WryNativeImage , WindowExtMacOS ,
7574} ;
7675
7776use std:: {
@@ -1653,6 +1652,18 @@ impl Runtime for Wry {
16531652 id
16541653 }
16551654
1655+ #[ cfg( target_os = "macos" ) ]
1656+ fn set_activation_policy ( & mut self , activation_policy : ActivationPolicy ) {
1657+ self
1658+ . event_loop
1659+ . set_activation_policy ( match activation_policy {
1660+ ActivationPolicy :: Regular => WryActivationPolicy :: Regular ,
1661+ ActivationPolicy :: Accessory => WryActivationPolicy :: Accessory ,
1662+ ActivationPolicy :: Prohibited => WryActivationPolicy :: Prohibited ,
1663+ _ => unimplemented ! ( ) ,
1664+ } ) ;
1665+ }
1666+
16561667 #[ cfg( any( target_os = "windows" , target_os = "macos" ) ) ]
16571668 fn run_iteration < F : Fn ( RunEvent ) + ' static > ( & mut self , callback : F ) -> RunIteration {
16581669 use wry:: application:: platform:: run_return:: EventLoopExtRunReturn ;
0 commit comments