@@ -599,6 +599,23 @@ struct Hwnd(HWND);
599599#[ cfg( windows) ]
600600unsafe impl Send for Hwnd { }
601601
602+ #[ cfg( any(
603+ target_os = "linux" ,
604+ target_os = "dragonfly" ,
605+ target_os = "freebsd" ,
606+ target_os = "netbsd" ,
607+ target_os = "openbsd"
608+ ) ) ]
609+ struct GtkWindow ( gtk:: ApplicationWindow ) ;
610+ #[ cfg( any(
611+ target_os = "linux" ,
612+ target_os = "dragonfly" ,
613+ target_os = "freebsd" ,
614+ target_os = "netbsd" ,
615+ target_os = "openbsd"
616+ ) ) ]
617+ unsafe impl Send for GtkWindow { }
618+
602619#[ derive( Debug , Clone ) ]
603620enum WindowMessage {
604621 // Getters
@@ -619,6 +636,14 @@ enum WindowMessage {
619636 AvailableMonitors ( Sender < Vec < MonitorHandle > > ) ,
620637 #[ cfg( windows) ]
621638 Hwnd ( Sender < Hwnd > ) ,
639+ #[ cfg( any(
640+ target_os = "linux" ,
641+ target_os = "dragonfly" ,
642+ target_os = "freebsd" ,
643+ target_os = "netbsd" ,
644+ target_os = "openbsd"
645+ ) ) ]
646+ GtkWindow ( Sender < GtkWindow > ) ,
622647 // Setters
623648 Center ( Sender < Result < ( ) > > ) ,
624649 RequestUserAttention ( Option < UserAttentionTypeWrapper > ) ,
@@ -830,6 +855,18 @@ impl Dispatch for WryDispatcher {
830855 Ok ( dispatcher_getter ! ( self , WindowMessage :: Hwnd ) . 0 )
831856 }
832857
858+ /// Returns the `ApplicatonWindow` from gtk crate that is used by this window.
859+ #[ cfg( any(
860+ target_os = "linux" ,
861+ target_os = "dragonfly" ,
862+ target_os = "freebsd" ,
863+ target_os = "netbsd" ,
864+ target_os = "openbsd"
865+ ) ) ]
866+ fn gtk_window ( & self ) -> Result < gtk:: ApplicationWindow > {
867+ Ok ( dispatcher_getter ! ( self , WindowMessage :: GtkWindow ) . 0 )
868+ }
869+
833870 // Setters
834871
835872 fn center ( & self ) -> Result < ( ) > {
@@ -1592,6 +1629,17 @@ fn handle_event_loop(
15921629 use wry:: application:: platform:: windows:: WindowExtWindows ;
15931630 tx. send ( Hwnd ( window. hwnd ( ) as HWND ) ) . unwrap ( )
15941631 }
1632+ #[ cfg( any(
1633+ target_os = "linux" ,
1634+ target_os = "dragonfly" ,
1635+ target_os = "freebsd" ,
1636+ target_os = "netbsd" ,
1637+ target_os = "openbsd"
1638+ ) ) ]
1639+ WindowMessage :: GtkWindow ( tx) => {
1640+ use wry:: application:: platform:: unix:: WindowExtUnix ;
1641+ tx. send ( GtkWindow ( window. gtk_window ( ) . clone ( ) ) ) . unwrap ( )
1642+ }
15951643 // Setters
15961644 WindowMessage :: Center ( tx) => {
15971645 tx. send ( center_window ( window) ) . unwrap ( ) ;
0 commit comments