From adb866947bb8574c2513963d078be20c4aa68beb Mon Sep 17 00:00:00 2001 From: Antony Date: Mon, 18 Mar 2024 13:41:42 -0400 Subject: [PATCH] Expose Winit's `with_skip_taskbar` on window creation (#12450) # Objective Resolves #12431. ## Solution Added a `skip_taskbar` field to the `Window` struct (defaults to `false`). Used in `create_windows` if the target OS is Windows. --- crates/bevy_window/src/window.rs | 12 ++++++++++++ crates/bevy_winit/src/winit_windows.rs | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index c241c9b71330a..ccc861a78d23b 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -259,6 +259,17 @@ pub struct Window { /// /// - **Android / Wayland / Web:** Unsupported. pub visible: bool, + /// Sets whether the window should be shown in the taskbar. + /// + /// If `true`, the window will not appear in the taskbar. + /// If `false`, the window will appear in the taskbar. + /// + /// Note that this will only take effect on window creation. + /// + /// ## Platform-specific + /// + /// - Only supported on Windows. + pub skip_taskbar: bool, } impl Default for Window { @@ -287,6 +298,7 @@ impl Default for Window { canvas: None, window_theme: None, visible: true, + skip_taskbar: false, } } } diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index 4375e7c277744..ff7d798d4bf33 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -104,6 +104,12 @@ impl WinitWindows { .with_transparent(window.transparent) .with_visible(window.visible); + #[cfg(target_os = "windows")] + { + use winit::platform::windows::WindowBuilderExtWindows; + winit_window_builder = winit_window_builder.with_skip_taskbar(window.skip_taskbar) + } + #[cfg(any( target_os = "linux", target_os = "dragonfly",