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
23 changes: 21 additions & 2 deletions crates/bevy_winit/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,12 @@ impl<T: Event> ApplicationHandler<T> for WinitAppRunnerState<T> {
// https://github.com/bevyengine/bevy/issues/17488
#[cfg(target_os = "windows")]
{
self.redraw_requested = true;
self.redraw_requested(_event_loop);
// Have the startup behavior run in about_to_wait, which prevents issues with
// invisible window creation. https://github.com/bevyengine/bevy/issues/18027
if self.startup_forced_updates == 0 {
self.redraw_requested = true;
self.redraw_requested(_event_loop);
}
}
}
_ => {}
Expand Down Expand Up @@ -480,6 +484,21 @@ impl<T: Event> ApplicationHandler<T> for WinitAppRunnerState<T> {
// The monitor sync logic likely belongs in monitor event handlers and not here.
#[cfg(not(target_os = "windows"))]
self.redraw_requested(event_loop);

// Have the startup behavior run in about_to_wait, which prevents issues with
// invisible window creation. https://github.com/bevyengine/bevy/issues/18027
#[cfg(target_os = "windows")]
{
let winit_windows = self.world().non_send_resource::<WinitWindows>();
let headless = winit_windows.windows.is_empty();
let all_invisible = winit_windows
.windows
.iter()
.all(|(_, w)| !w.is_visible().unwrap_or(false));
if self.startup_forced_updates > 0 || headless || all_invisible {
self.redraw_requested(event_loop);
}
}
}

fn suspended(&mut self, _event_loop: &ActiveEventLoop) {
Expand Down