mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-23 10:26:34 +11:00
feat: add Window::is_decorated
(#2172)
* feat: add `Window::is_decorated` * move it right after `set_decorations`
This commit is contained in:
parent
cd9ec0afc7
commit
fa14863284
10 changed files with 51 additions and 0 deletions
|
@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre
|
||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Added `Window::is_decorated`.
|
||||||
- On X11, fix for repeated event loop iteration when `ControlFlow` was `Wait`
|
- On X11, fix for repeated event loop iteration when `ControlFlow` was `Wait`
|
||||||
- On Wayland, report unaccelerated mouse deltas in `DeviceEvent::MouseMotion`.
|
- On Wayland, report unaccelerated mouse deltas in `DeviceEvent::MouseMotion`.
|
||||||
- **Breaking:** Bump `ndk` version to 0.6, ndk-sys to `v0.3`, `ndk-glue` to `0.6`.
|
- **Breaking:** Bump `ndk` version to 0.6, ndk-sys to `v0.3`, `ndk-glue` to `0.6`.
|
||||||
|
|
|
@ -561,6 +561,10 @@ impl Window {
|
||||||
|
|
||||||
pub fn set_decorations(&self, _decorations: bool) {}
|
pub fn set_decorations(&self, _decorations: bool) {}
|
||||||
|
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_always_on_top(&self, _always_on_top: bool) {}
|
pub fn set_always_on_top(&self, _always_on_top: bool) {}
|
||||||
|
|
||||||
pub fn set_window_icon(&self, _window_icon: Option<crate::icon::Icon>) {}
|
pub fn set_window_icon(&self, _window_icon: Option<crate::icon::Icon>) {}
|
||||||
|
|
|
@ -260,6 +260,11 @@ impl Inner {
|
||||||
warn!("`Window::set_decorations` is ignored on iOS")
|
warn!("`Window::set_decorations` is ignored on iOS")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
warn!("`Window::is_decorated` is ignored on iOS");
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_always_on_top(&self, _always_on_top: bool) {
|
pub fn set_always_on_top(&self, _always_on_top: bool) {
|
||||||
warn!("`Window::set_always_on_top` is ignored on iOS")
|
warn!("`Window::set_always_on_top` is ignored on iOS")
|
||||||
}
|
}
|
||||||
|
|
|
@ -426,6 +426,11 @@ impl Window {
|
||||||
x11_or_wayland!(match self; Window(w) => w.set_decorations(decorations))
|
x11_or_wayland!(match self; Window(w) => w.set_decorations(decorations))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
x11_or_wayland!(match self; Window(w) => w.is_decorated())
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_always_on_top(&self, _always_on_top: bool) {
|
pub fn set_always_on_top(&self, _always_on_top: bool) {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -348,6 +348,11 @@ impl Window {
|
||||||
self.send_request(WindowRequest::Decorate(decorate));
|
self.send_request(WindowRequest::Decorate(decorate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_minimized(&self, minimized: bool) {
|
pub fn set_minimized(&self, minimized: bool) {
|
||||||
// You can't unminimize the window on Wayland.
|
// You can't unminimize the window on Wayland.
|
||||||
|
|
|
@ -895,6 +895,11 @@ impl UnownedWindow {
|
||||||
self.invalidate_cached_frame_extents();
|
self.invalidate_cached_frame_extents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
fn set_maximizable_inner(&self, maximizable: bool) -> util::Flusher<'_> {
|
fn set_maximizable_inner(&self, maximizable: bool) -> util::Flusher<'_> {
|
||||||
let mut hints = self.xconn.get_motif_hints(self.xwindow);
|
let mut hints = self.xconn.get_motif_hints(self.xwindow);
|
||||||
|
|
||||||
|
|
|
@ -1003,6 +1003,11 @@ impl UnownedWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
self.decorations.load(Ordering::Acquire)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_always_on_top(&self, always_on_top: bool) {
|
pub fn set_always_on_top(&self, always_on_top: bool) {
|
||||||
let level = if always_on_top {
|
let level = if always_on_top {
|
||||||
|
|
|
@ -269,6 +269,10 @@ impl Window {
|
||||||
// Intentionally a no-op, no canvas decorations
|
// Intentionally a no-op, no canvas decorations
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_always_on_top(&self, _always_on_top: bool) {
|
pub fn set_always_on_top(&self, _always_on_top: bool) {
|
||||||
// Intentionally a no-op, no window ordering
|
// Intentionally a no-op, no window ordering
|
||||||
|
|
|
@ -544,6 +544,12 @@ impl Window {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
let window_state = self.window_state.lock();
|
||||||
|
window_state.window_flags.contains(WindowFlags::DECORATIONS)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_always_on_top(&self, always_on_top: bool) {
|
pub fn set_always_on_top(&self, always_on_top: bool) {
|
||||||
let window = self.window.clone();
|
let window = self.window.clone();
|
||||||
|
|
|
@ -750,6 +750,17 @@ impl Window {
|
||||||
self.window.set_decorations(decorations)
|
self.window.set_decorations(decorations)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the window's current decorations state.
|
||||||
|
///
|
||||||
|
/// ## Platform-specific
|
||||||
|
///
|
||||||
|
/// - **Wayland / X11:** Not implemented.
|
||||||
|
/// - **iOS / Android / Web:** Unsupported.
|
||||||
|
#[inline]
|
||||||
|
pub fn is_decorated(&self) -> bool {
|
||||||
|
self.window.is_decorated()
|
||||||
|
}
|
||||||
|
|
||||||
/// Change whether or not the window will always be on top of other windows.
|
/// Change whether or not the window will always be on top of other windows.
|
||||||
///
|
///
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
|
|
Loading…
Add table
Reference in a new issue