Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion crates/bevy_window/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AppExit>, windows: Query<&Window>) {
pub fn exit_on_all_closed(
mut app_exit_writer: MessageWriter<AppExit>,
windows: Query<(), With<Window>>,
) {
if windows.is_empty() {
log::info!("No windows are open, exiting");
app_exit_writer.write(AppExit::Success);
Expand Down
6 changes: 2 additions & 4 deletions crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down Expand Up @@ -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,
Expand Down