@@ -23,10 +23,12 @@ use winit::window::Window;
2323use winit:: window:: WindowId ;
2424
2525use crate :: cef;
26+ use crate :: native_window;
2627
2728pub ( crate ) struct WinitApp {
2829 cef_context : Box < dyn cef:: CefContext > ,
2930 window : Option < Arc < Window > > ,
31+ native_window : native_window:: NativeWindowHandle ,
3032 cef_schedule : Option < Instant > ,
3133 window_size_sender : Sender < WindowSize > ,
3234 graphics_state : Option < GraphicsState > ,
@@ -71,6 +73,7 @@ impl WinitApp {
7173 web_communication_initialized : false ,
7274 web_communication_startup_buffer : Vec :: new ( ) ,
7375 persistent_data,
76+ native_window : Default :: default ( ) ,
7477 }
7578 }
7679
@@ -277,22 +280,15 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
277280 . with_title ( APP_NAME )
278281 . with_min_inner_size ( winit:: dpi:: LogicalSize :: new ( 400 , 300 ) )
279282 . with_inner_size ( winit:: dpi:: LogicalSize :: new ( 1200 , 800 ) )
280- . with_decorations ( false )
281283 . with_resizable ( true ) ;
282284
283- #[ cfg( target_os = "linux" ) ]
284- {
285- use crate :: consts:: APP_ID ;
286- use winit:: platform:: wayland:: ActiveEventLoopExtWayland ;
285+ window = self . native_window . build ( window, event_loop) ;
287286
288- window = if event_loop. is_wayland ( ) {
289- winit:: platform:: wayland:: WindowAttributesExtWayland :: with_name ( window, APP_ID , "" )
290- } else {
291- winit:: platform:: x11:: WindowAttributesExtX11 :: with_name ( window, APP_ID , APP_NAME )
292- }
293- }
287+ let window = event_loop. create_window ( window) . unwrap ( ) ;
288+
289+ self . native_window . setup ( & window) ;
294290
295- let window = Arc :: new ( event_loop . create_window ( window) . unwrap ( ) ) ;
291+ let window = Arc :: new ( window) ;
296292 let graphics_state = GraphicsState :: new ( window. clone ( ) , self . wgpu_context . clone ( ) ) ;
297293
298294 self . window = Some ( window) ;
0 commit comments