@@ -348,27 +348,26 @@ impl WidgetFactory {
348348
349349 info ! ( "Positioning widget to {:?} {:?}" , size, position) ;
350350
351- // Convert to logical coordinates using the target monitor's scale
352- // factor. Using the physical size/position directly positions the
353- // window incorrectly on macOS.
354- let scale = coordinates. monitor . scale_factor as f64 ;
355- let size = tauri:: LogicalSize :: new (
356- size. width as f64 / scale,
357- size. height as f64 / scale,
358- ) ;
359- let position = tauri:: LogicalPosition :: new (
360- position. x as f64 / scale,
361- position. y as f64 / scale,
362- ) ;
363- let _ = window. set_size ( size) ;
364- let _ = window. set_position ( position) ;
365-
366351 // On Windows, we need to set the position twice to account for
367- // different monitor scale factors.
352+ // different monitor scale factors. Using the logical position/size
353+ // positions the window incorrectly (see: https://github.com/glzr-io/zebar/issues/273).
368354 #[ cfg( windows) ]
369355 {
370356 let _ = window. set_size ( size) ;
371357 let _ = window. set_position ( position) ;
358+ let _ = window. set_size ( size) ;
359+ let _ = window. set_position ( position) ;
360+ }
361+
362+ // On macOS/Linux, convert to logical coordinates using the target
363+ // monitor's scale factor. Using the physical position/size positions
364+ // the window incorrectly.
365+ #[ cfg( not( windows) ) ]
366+ {
367+ let scale_factor = coordinates. monitor . scale_factor as f64 ;
368+ let _ = window. set_size ( size. to_logical :: < f64 > ( scale_factor) ) ;
369+ let _ =
370+ window. set_position ( position. to_logical :: < f64 > ( scale_factor) ) ;
372371 }
373372
374373 // On Windows, Tauri's `skip_taskbar` option isn't 100% reliable,
0 commit comments