@@ -339,9 +339,7 @@ impl GlfwContext {
339339 self . window . focus ( ) ;
340340 }
341341
342- let ( cx, cy) = self . window . get_pos ( ) ;
343- let ( inset_l, inset_t, _, _) = self . window . get_frame_size ( ) ;
344- let frame_pos = IVec2 :: new ( cx - inset_l, cy - inset_t) ;
342+ let frame_pos = self . frame_pos ( ) ;
345343 let _ = app_mut ( |app| {
346344 let world = app. world_mut ( ) ;
347345 if let Some ( mut window) = world. get_mut :: < BevyWindow > ( surface) {
@@ -358,13 +356,26 @@ impl GlfwContext {
358356 self . last_applied . position = frame_pos;
359357 }
360358
359+ #[ cfg( not( feature = "wayland" ) ) ]
360+ fn frame_pos ( & self ) -> IVec2 {
361+ let ( cx, cy) = self . window . get_pos ( ) ;
362+ let ( inset_l, inset_t, _, _) = self . window . get_frame_size ( ) ;
363+ IVec2 :: new ( cx - inset_l, cy - inset_t)
364+ }
365+
366+ #[ cfg( feature = "wayland" ) ]
367+ fn frame_pos ( & self ) -> IVec2 {
368+ self . last_applied . position
369+ }
370+
361371 fn apply_window ( & mut self , desired : & DesiredWindow ) {
362372 let last = & mut self . last_applied ;
363373
364374 if desired. title != last. title {
365375 self . window . set_title ( & desired. title ) ;
366376 last. title . clone_from ( & desired. title ) ;
367377 }
378+ #[ cfg( not( feature = "wayland" ) ) ]
368379 if let Some ( pos) = desired. position
369380 && pos != last. position
370381 {
@@ -413,9 +424,9 @@ impl GlfwContext {
413424 match target {
414425 Some ( monitor_entity) => {
415426 if self . last_applied . fullscreen_on . is_none ( ) {
416- let ( x, y) = self . window . get_pos ( ) ;
417427 let ( w, h) = self . window . get_size ( ) ;
418- self . windowed_geometry = Some ( ( x, y, w as u32 , h as u32 ) ) ;
428+ let pos = self . frame_pos ( ) ;
429+ self . windowed_geometry = Some ( ( pos. x , pos. y , w as u32 , h as u32 ) ) ;
419430 }
420431 let target_name = monitor_name ( monitor_entity) ;
421432 let window = & mut self . window ;
@@ -438,9 +449,9 @@ impl GlfwContext {
438449 }
439450 None => {
440451 let ( x, y, w, h) = self . windowed_geometry . take ( ) . unwrap_or_else ( || {
441- let ( x, y) = self . window . get_pos ( ) ;
442452 let ( w, h) = self . window . get_size ( ) ;
443- ( x, y, w as u32 , h as u32 )
453+ let pos = self . frame_pos ( ) ;
454+ ( pos. x , pos. y , w as u32 , h as u32 )
444455 } ) ;
445456 self . window
446457 . set_monitor ( WindowMode :: Windowed , x, y, w, h, None ) ;
@@ -475,6 +486,7 @@ impl GlfwContext {
475486#[ derive( Clone , Debug ) ]
476487struct DesiredWindow {
477488 title : String ,
489+ #[ cfg( not( feature = "wayland" ) ) ]
478490 position : Option < IVec2 > ,
479491 size : bevy:: math:: UVec2 ,
480492 visible : bool ,
@@ -507,6 +519,7 @@ fn read_desired_window(surface: Entity) -> Option<DesiredWindow> {
507519 } ;
508520 Ok ( Some ( DesiredWindow {
509521 title : window. title . clone ( ) ,
522+ #[ cfg( not( feature = "wayland" ) ) ]
510523 position : match window. position {
511524 WindowPosition :: At ( p) => Some ( p) ,
512525 _ => None ,
0 commit comments