From f2e00c8ed5b8eddf9c38fdc7cf6f0056f4ee00c2 Mon Sep 17 00:00:00 2001 From: Nicholas Charbonneau Date: Tue, 14 Jan 2025 17:22:20 -0500 Subject: [PATCH] feat: support for clip children on windows (#16545) # Objective Support the parametrization of the WS_CLIPCHILDREN style on Windows. Fixes #16544 ## Solution Added a window configuration in bevy_winit to control the usage of the WS_CLIPCHILDREN style. ## Testing - Did you test these changes? If so, how? I did. I was able to create a Wry Webview with a transparent HTML document and was also able to see my Bevy scene behind the webview elements. - Are there any parts that need more testing? I don't believe so. I assume the option is extensively tested within winit itself. - How can other people (reviewers) test your changes? Is there anything specific they need to know? Test repositiory [here](https://github.com/nicholasc/bevy_wry_test). Bevy's path will need to be updated in the Cargo.toml - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? This is a Windows specific issue. Should be tested accordingly. --------- Co-authored-by: jf908 --- crates/bevy_window/src/window.rs | 10 ++++++++++ crates/bevy_winit/src/winit_windows.rs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index ac442f05f5..1acf96ee41 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -291,6 +291,15 @@ pub struct Window { /// /// - Only supported on Windows. pub skip_taskbar: bool, + /// Sets whether the window should draw over its child windows. + /// + /// If `true`, the window excludes drawing over areas obscured by child windows. + /// If `false`, the window can draw over child windows. + /// + /// ## Platform-specific + /// + /// - Only supported on Windows. + pub clip_children: bool, /// Optional hint given to the rendering API regarding the maximum number of queued frames admissible on the GPU. /// /// Given values are usually within the 1-3 range. If not provided, this will default to 2. @@ -451,6 +460,7 @@ impl Default for Window { window_theme: None, visible: true, skip_taskbar: false, + clip_children: true, desired_maximum_frame_latency: None, recognize_pinch_gesture: false, recognize_rotation_gesture: false, diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index be4a7c21e5..f7b948a6bd 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -126,6 +126,8 @@ impl WinitWindows { use winit::platform::windows::WindowAttributesExtWindows; winit_window_attributes = winit_window_attributes.with_skip_taskbar(window.skip_taskbar); + winit_window_attributes = + winit_window_attributes.with_clip_children(window.clip_children); } #[cfg(target_os = "macos")]