diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index 31ff212ebe..4f7d7b2f7b 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -225,6 +225,15 @@ pub struct Window { /// You should also set the window `composite_alpha_mode` to `CompositeAlphaMode::PostMultiplied`. pub transparent: bool, /// Get/set whether the window is focused. + /// + /// It cannot be set unfocused after creation. + /// + /// ## Platform-specific + /// + /// - iOS / Android / X11 / Wayland: Spawning unfocused is + /// [not supported](https://docs.rs/winit/latest/winit/window/struct.WindowAttributes.html#method.with_active). + /// - iOS / Android / Web / Wayland: Setting focused after creation is + /// [not supported](https://docs.rs/winit/latest/winit/window/struct.Window.html#method.focus_window). pub focused: bool, /// Where should the window appear relative to other overlapping window. /// diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index d666491311..8bf326f453 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -129,7 +129,8 @@ impl WinitWindows { .with_resizable(window.resizable) .with_enabled_buttons(convert_enabled_buttons(window.enabled_buttons)) .with_decorations(window.decorations) - .with_transparent(window.transparent); + .with_transparent(window.transparent) + .with_active(window.focused); #[cfg(target_os = "windows")] {