diff --git a/crates/bevy_window/src/system.rs b/crates/bevy_window/src/system.rs index 112770e6097f4..e53f0101f22b9 100644 --- a/crates/bevy_window/src/system.rs +++ b/crates/bevy_window/src/system.rs @@ -10,7 +10,10 @@ use bevy_ecs::prelude::*; /// Ensure that you read the caveats documented on that field if doing so. /// /// [`WindowPlugin`]: crate::WindowPlugin -pub fn exit_on_all_closed(mut app_exit_writer: MessageWriter, windows: Query<&Window>) { +pub fn exit_on_all_closed( + mut app_exit_writer: MessageWriter, + windows: Query<(), With>, +) { if windows.is_empty() { log::info!("No windows are open, exiting"); app_exit_writer.write(AppExit::Success); diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 2bd3456e96259..7ae6c47b8576c 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -23,7 +23,7 @@ use winit::{event_loop::EventLoop, window::WindowId}; use bevy_a11y::AccessibilityRequested; use bevy_app::{App, Last, Plugin}; use bevy_ecs::prelude::*; -use bevy_window::{exit_on_all_closed, CursorOptions, Window, WindowCreated}; +use bevy_window::{CursorOptions, Window, WindowCreated}; use system::{changed_cursor_options, changed_windows, check_keyboard_focus_lost, despawn_windows}; pub use system::{create_monitors, create_windows}; #[cfg(all(target_family = "wasm", target_os = "unknown"))] @@ -136,9 +136,7 @@ impl Plugin for WinitPlugin { .add_systems( Last, ( - // `exit_on_all_closed` only checks if windows exist but doesn't access data, - // so we don't need to care about its ordering relative to `changed_windows` - changed_windows.ambiguous_with(exit_on_all_closed), + changed_windows, changed_cursor_options, despawn_windows, check_keyboard_focus_lost,