@@ -23,8 +23,11 @@ use tauri_runtime::window::MenuEvent;
2323use tauri_runtime:: { SystemTray , SystemTrayEvent } ;
2424#[ cfg( windows) ]
2525use winapi:: shared:: windef:: HWND ;
26+ #[ cfg( target_os = "linux" ) ]
27+ use wry:: application:: platform:: unix:: { WindowBuilderExtUnix , WindowExtUnix } ;
2628#[ cfg( windows) ]
27- use wry:: application:: platform:: windows:: WindowBuilderExtWindows ;
29+ use wry:: application:: platform:: windows:: { WindowBuilderExtWindows , WindowExtWindows } ;
30+
2831#[ cfg( feature = "system-tray" ) ]
2932use wry:: application:: system_tray:: { SystemTray as WrySystemTray , SystemTrayBuilder } ;
3033
@@ -446,10 +449,6 @@ impl WindowBuilder for WindowBuilderWrapper {
446449 window = window. center ( ) ;
447450 }
448451
449- if config. focus {
450- window = window. focus ( ) ;
451- }
452-
453452 window
454453 }
455454
@@ -511,8 +510,9 @@ impl WindowBuilder for WindowBuilderWrapper {
511510 self
512511 }
513512
514- fn focus ( mut self ) -> Self {
515- self . inner = self . inner . with_focus ( ) ;
513+ /// Deprecated since 0.1.4 (noop)
514+ /// Windows is automatically focused when created.
515+ fn focus ( self ) -> Self {
516516 self
517517 }
518518
@@ -560,11 +560,17 @@ impl WindowBuilder for WindowBuilderWrapper {
560560 Ok ( self )
561561 }
562562
563+ #[ cfg( any( target_os = "windows" , target_os = "linux" ) ) ]
563564 fn skip_taskbar ( mut self , skip : bool ) -> Self {
564565 self . inner = self . inner . with_skip_taskbar ( skip) ;
565566 self
566567 }
567568
569+ #[ cfg( target_os = "macos" ) ]
570+ fn skip_taskbar ( self , _skip : bool ) -> Self {
571+ self
572+ }
573+
568574 fn has_icon ( & self ) -> bool {
569575 self . inner . window . window_icon . is_some ( )
570576 }
@@ -593,7 +599,9 @@ impl From<FileDropEventWrapper> for FileDropEvent {
593599 match event. 0 {
594600 WryFileDropEvent :: Hovered ( paths) => FileDropEvent :: Hovered ( paths) ,
595601 WryFileDropEvent :: Dropped ( paths) => FileDropEvent :: Dropped ( paths) ,
596- WryFileDropEvent :: Cancelled => FileDropEvent :: Cancelled ,
602+ // default to cancelled
603+ // FIXME(maybe): Add `FileDropEvent::Unknown` event?
604+ _ => FileDropEvent :: Cancelled ,
597605 }
598606 }
599607}
@@ -1511,6 +1519,7 @@ fn handle_event_loop(
15111519 window_id,
15121520 menu_id,
15131521 origin : MenuType :: MenuBar ,
1522+ ..
15141523 } => {
15151524 let window_id = window_id. unwrap ( ) ; // always Some on MenuBar event
15161525 let event = MenuEvent {
@@ -1527,6 +1536,7 @@ fn handle_event_loop(
15271536 window_id : _,
15281537 menu_id,
15291538 origin : MenuType :: ContextMenu ,
1539+ ..
15301540 } => {
15311541 let event = SystemTrayEvent :: MenuItemClick ( menu_id. 0 ) ;
15321542 for handler in tray_context. listeners . lock ( ) . unwrap ( ) . values ( ) {
@@ -1538,21 +1548,25 @@ fn handle_event_loop(
15381548 bounds,
15391549 event,
15401550 position : _cursor_position,
1551+ ..
15411552 } => {
15421553 let ( position, size) = (
15431554 PhysicalPositionWrapper ( bounds. position ) . into ( ) ,
15441555 PhysicalSizeWrapper ( bounds. size ) . into ( ) ,
15451556 ) ;
15461557 let event = match event {
1547- TrayEvent :: LeftClick => SystemTrayEvent :: LeftClick { position, size } ,
15481558 TrayEvent :: RightClick => SystemTrayEvent :: RightClick { position, size } ,
15491559 TrayEvent :: DoubleClick => SystemTrayEvent :: DoubleClick { position, size } ,
1560+ // default to left click
1561+ _ => SystemTrayEvent :: LeftClick { position, size } ,
15501562 } ;
15511563 for handler in tray_context. listeners . lock ( ) . unwrap ( ) . values ( ) {
15521564 handler ( & event) ;
15531565 }
15541566 }
1555- Event :: WindowEvent { event, window_id } => {
1567+ Event :: WindowEvent {
1568+ event, window_id, ..
1569+ } => {
15561570 if let Some ( event) = WindowEventWrapper :: from ( & event) . 0 {
15571571 for handler in window_event_listeners
15581572 . lock ( )
@@ -1642,10 +1656,7 @@ fn handle_event_loop(
16421656 tx. send ( window. available_monitors ( ) . collect ( ) ) . unwrap ( )
16431657 }
16441658 #[ cfg( windows) ]
1645- WindowMessage :: Hwnd ( tx) => {
1646- use wry:: application:: platform:: windows:: WindowExtWindows ;
1647- tx. send ( Hwnd ( window. hwnd ( ) as HWND ) ) . unwrap ( )
1648- }
1659+ WindowMessage :: Hwnd ( tx) => tx. send ( Hwnd ( window. hwnd ( ) as HWND ) ) . unwrap ( ) ,
16491660 #[ cfg( any(
16501661 target_os = "linux" ,
16511662 target_os = "dragonfly" ,
@@ -1654,7 +1665,6 @@ fn handle_event_loop(
16541665 target_os = "openbsd"
16551666 ) ) ]
16561667 WindowMessage :: GtkWindow ( tx) => {
1657- use wry:: application:: platform:: unix:: WindowExtUnix ;
16581668 tx. send ( GtkWindow ( window. gtk_window ( ) . clone ( ) ) ) . unwrap ( )
16591669 }
16601670 // Setters
@@ -1721,8 +1731,9 @@ fn handle_event_loop(
17211731 WindowMessage :: SetIcon ( icon) => {
17221732 window. set_window_icon ( Some ( icon) ) ;
17231733 }
1724- WindowMessage :: SetSkipTaskbar ( skip) => {
1725- window. set_skip_taskbar ( skip) ;
1734+ WindowMessage :: SetSkipTaskbar ( _skip) => {
1735+ #[ cfg( any( target_os = "windows" , target_os = "linux" ) ) ]
1736+ window. set_skip_taskbar ( _skip) ;
17261737 }
17271738 WindowMessage :: DragWindow => {
17281739 let _ = window. drag_window ( ) ;
0 commit comments