Skip to content
Open
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
11 changes: 8 additions & 3 deletions core/src/window/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ pub struct Settings {
/// [`Settings::transparent`] and set a proper opacity value to the background color with
/// `Application::style`.
///
/// This option is only supported on macOS and Linux. Please read the [winit document][winit]
/// for more details.
/// This option is only supported on macOS, Windows 11 and Linux. Please read the [winit
/// document][winit_set_blur] for more details.
///
/// [winit]: https://docs.rs/winit/0.30/winit/window/struct.Window.html#method.set_blur
/// On Windows, it sets the [backdrop][winit_backdrop] to `TransientWindow`, making the
/// window [acrylic][acrylic].
///
/// [winit_set_blur]: https://docs.rs/winit/0.30/winit/window/struct.Window.html#method.set_blur
/// [winit_backdrop]: https://docs.rs/winit/0.30/winit/platform/windows/enum.BackdropType.html
/// [acrylic]: https://learn.microsoft.com/en-us/windows/apps/design/style/acrylic
pub blur: bool,

/// The window [`Level`].
Expand Down
8 changes: 7 additions & 1 deletion winit/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ pub fn window_attributes(
#[cfg(target_os = "windows")]
{
use window::settings::platform;
use winit::platform::windows::{CornerPreference, WindowAttributesExtWindows};
use winit::platform::windows::{
BackdropType, CornerPreference, WindowAttributesExtWindows,
};

attributes = attributes.with_drag_and_drop(settings.platform_specific.drag_and_drop);

Expand All @@ -106,6 +108,10 @@ pub fn window_attributes(
platform::CornerPreference::Round => CornerPreference::Round,
platform::CornerPreference::RoundSmall => CornerPreference::RoundSmall,
});

if settings.blur {
attributes = attributes.with_system_backdrop(BackdropType::TransientWindow);
}
}

#[cfg(target_os = "macos")]
Expand Down
Loading