feat: add WindowExtWindows::has_undecorated_shadow on Windows (#1074)

This commit is contained in:
Amr Bashir
2025-02-25 22:03:59 +02:00
committed by GitHub
parent f4ec11d795
commit b296cf53f4
3 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"tao": "patch"
---
On Windows, add `WindowExtWindows::has_undecorated_shadow` to check if window has shadows for undecorated window or not.

View File

@@ -182,6 +182,9 @@ pub trait WindowExtWindows {
/// Enabling the shadow causes a thin 1px line to appear on the top of the window.
fn set_undecorated_shadow(&self, shadow: bool);
/// Returns whether this window has shadow for undecorated windows.
fn has_undecorated_shadow(&self) -> bool;
/// Sets right-to-left layout.
///
/// Enabling this mainly flips the orientation of menus and title bar buttons
@@ -236,6 +239,11 @@ impl WindowExtWindows for Window {
self.window.set_undecorated_shadow(shadow)
}
#[inline]
fn has_undecorated_shadow(&self) -> bool {
self.window.has_undecorated_shadow()
}
#[inline]
fn set_rtl(&self, rtl: bool) {
self.window.set_rtl(rtl)

View File

@@ -1116,6 +1116,15 @@ impl Window {
});
}
#[inline]
pub fn has_undecorated_shadow(&self) -> bool {
self
.window_state
.lock()
.window_flags
.contains(WindowFlags::MARKER_UNDECORATED_SHADOW)
}
pub fn set_content_protection(&self, enabled: bool) {
unsafe {
let _ = SetWindowDisplayAffinity(