Skip to content

Commit 8dc1a7c

Browse files
aloucksmockersf
authored andcommitted
Fix UpdateMode::Reactive behavior on Windows (#18493)
# Objective The fix in #17488 forced Windows to always behave as if it were in `UpdateMode::Continuous`. CC #17991 ## Solution Removed the unconditional `redraw_requested = true` and added a check for `Reactive` in `about_to_wait`. ## Testing - Verified that the `low_power` example worked as expected with all `UpdateMode` options. - Verified that animation continued in both `eased_motion ` and `low_power` examples when in `Continuous` update mode while: - Resizing the Window - Moving the window via clicking and dragging the title bar - Verified that `window_settings` example still worked as expected. - Verified that `monitor_info` example still worked as expected.
1 parent b1c1aac commit 8dc1a7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/bevy_winit/src/state.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ impl<T: Event> ApplicationHandler<T> for WinitAppRunnerState<T> {
456456
// Have the startup behavior run in about_to_wait, which prevents issues with
457457
// invisible window creation. https://github.com/bevyengine/bevy/issues/18027
458458
if self.startup_forced_updates == 0 {
459-
self.redraw_requested = true;
460459
self.redraw_requested(_event_loop);
461460
}
462461
}
@@ -510,11 +509,14 @@ impl<T: Event> ApplicationHandler<T> for WinitAppRunnerState<T> {
510509
let winit_windows = self.world().non_send_resource::<WinitWindows>();
511510
let headless = winit_windows.windows.is_empty();
512511
let exiting = self.app_exit.is_some();
512+
let reactive = matches!(self.update_mode, UpdateMode::Reactive { .. });
513513
let all_invisible = winit_windows
514514
.windows
515515
.iter()
516516
.all(|(_, w)| !w.is_visible().unwrap_or(false));
517-
if !exiting && (self.startup_forced_updates > 0 || headless || all_invisible) {
517+
if !exiting
518+
&& (self.startup_forced_updates > 0 || headless || all_invisible || reactive)
519+
{
518520
self.redraw_requested(event_loop);
519521
}
520522
}

0 commit comments

Comments
 (0)