File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
druid-shell/src/platform/x11 Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ use x11rb::wrapper::ConnectionExt as _;
3939use x11rb:: xcb_ffi:: XCBConnection ;
4040
4141#[ cfg( feature = "raw-win-handle" ) ]
42- use raw_window_handle:: { HasRawWindowHandle , RawWindowHandle } ;
42+ use raw_window_handle:: { unix :: XcbHandle , HasRawWindowHandle , RawWindowHandle } ;
4343
4444use crate :: common_util:: IdleCallback ;
4545use crate :: dialog:: FileDialogOptions ;
@@ -1589,7 +1589,19 @@ impl WindowHandle {
15891589#[ cfg( feature = "raw-win-handle" ) ]
15901590unsafe impl HasRawWindowHandle for WindowHandle {
15911591 fn raw_window_handle ( & self ) -> RawWindowHandle {
1592- error ! ( "HasRawWindowHandle trait not implemented for x11." ) ;
1593- RawWindowHandle :: Xcb ( XcbHandle :: empty ( ) )
1592+ let mut handle = XcbHandle {
1593+ window : self . id ,
1594+ ..XcbHandle :: empty ( )
1595+ } ;
1596+
1597+ if let Some ( window) = self . window . upgrade ( ) {
1598+ handle. connection = window. app . connection ( ) . get_raw_xcb_connection ( ) ;
1599+ } else {
1600+ // Documentation for HasRawWindowHandle encourages filling in all fields possible,
1601+ // leaving those empty that cannot be derived.
1602+ error ! ( "Failed to get XCBConnection, returning incomplete handle" ) ;
1603+ }
1604+
1605+ RawWindowHandle :: Xcb ( handle)
15941606 }
15951607}
You can’t perform that action at this time.
0 commit comments