Skip to content

Commit

Permalink
feat: support for clip children on windows (#16545)
Browse files Browse the repository at this point in the history
# 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 <[email protected]>
  • Loading branch information
nicholasc and jf908 authored Jan 14, 2025
1 parent dcff8f3 commit f2e00c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/bevy_window/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_winit/src/winit_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit f2e00c8

Please sign in to comment.