Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions crates/bevy_winit/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,26 @@ pub(crate) fn changed_windows(
}
}

// Set position before size so the window is on the correct monitor
// (and thus using the correct scale factor) when size is applied.
if window.position != cache.position
&& let Some(position) = crate::winit_window_position(
&window.position,
&window.resolution,
&monitors,
winit_window.primary_monitor(),
winit_window.current_monitor(),
) {
let should_set = match winit_window.outer_position() {
Ok(current_position) => current_position != position,
_ => true,
};

if should_set {
winit_window.set_outer_position(position);
}
}

if window.resolution != cache.resolution {
let mut physical_size = PhysicalSize::new(
window.resolution.physical_width(),
Expand Down Expand Up @@ -444,24 +464,6 @@ pub(crate) fn changed_windows(
);
}

if window.position != cache.position
&& let Some(position) = crate::winit_window_position(
&window.position,
&window.resolution,
&monitors,
winit_window.primary_monitor(),
winit_window.current_monitor(),
) {
let should_set = match winit_window.outer_position() {
Ok(current_position) => current_position != position,
_ => true,
};

if should_set {
winit_window.set_outer_position(position);
}
}

if let Some(maximized) = window.internal.take_maximize_request() {
winit_window.set_maximized(maximized);
}
Expand Down