File tree Expand file tree Collapse file tree
core/tauri-runtime-wry/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ " tauri-runtime-wry " : patch
4+ ---
5+
6+ Account the monitor position when centering a window.
Original file line number Diff line number Diff line change @@ -2854,9 +2854,13 @@ fn on_window_close(
28542854fn center_window ( window : & Window , window_size : WryPhysicalSize < u32 > ) -> Result < ( ) > {
28552855 if let Some ( monitor) = window. current_monitor ( ) {
28562856 let screen_size = monitor. size ( ) ;
2857+ let monitor_pos = monitor. position ( ) ;
28572858 let x = ( screen_size. width as i32 - window_size. width as i32 ) / 2 ;
28582859 let y = ( screen_size. height as i32 - window_size. height as i32 ) / 2 ;
2859- window. set_outer_position ( WryPhysicalPosition :: new ( x, y) ) ;
2860+ window. set_outer_position ( WryPhysicalPosition :: new (
2861+ monitor_pos. x + x,
2862+ monitor_pos. y + y,
2863+ ) ) ;
28602864 Ok ( ( ) )
28612865 } else {
28622866 Err ( Error :: FailedToGetMonitor )
You can’t perform that action at this time.
0 commit comments