From d1ceada11996a0137e8fb4377f1011af3f08d24f Mon Sep 17 00:00:00 2001 From: Night_Hunter Date: Thu, 5 Sep 2024 21:17:44 +1200 Subject: [PATCH] add option for undecorated_shadow on windows (#2285) * add option for undecorated_shadow on windows * formated --- core/src/window/settings/windows.rs | 7 +++++++ winit/src/conversion.rs | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/core/src/window/settings/windows.rs b/core/src/window/settings/windows.rs index 88fe2fbd6a..a47582a63a 100644 --- a/core/src/window/settings/windows.rs +++ b/core/src/window/settings/windows.rs @@ -8,6 +8,12 @@ pub struct PlatformSpecific { /// Whether show or hide the window icon in the taskbar. pub skip_taskbar: bool, + + /// Shows or hides the background drop shadow for undecorated windows. + /// + /// The shadow is hidden by default. + /// Enabling the shadow causes a thin 1px line to appear on the top of the window. + pub undecorated_shadow: bool, } impl Default for PlatformSpecific { @@ -15,6 +21,7 @@ impl Default for PlatformSpecific { Self { drag_and_drop: true, skip_taskbar: false, + undecorated_shadow: false, } } } diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index e88ff84d78..cc1959eb31 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -79,6 +79,10 @@ pub fn window_attributes( attributes = attributes .with_skip_taskbar(settings.platform_specific.skip_taskbar); + + window_builder = window_builder.with_undecorated_shadow( + settings.platform_specific.undecorated_shadow, + ); } #[cfg(target_os = "macos")]