From e07fb23632d17951b194c026f5fd7e23b2a45294 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Fri, 10 Oct 2025 15:28:07 -0400 Subject: [PATCH] Add with_simple_fullscreen to WindowAttributesMacOS --- winit-appkit/src/lib.rs | 8 ++++++++ winit-appkit/src/window_delegate.rs | 2 ++ winit/src/changelog/unreleased.md | 1 + 3 files changed, 11 insertions(+) diff --git a/winit-appkit/src/lib.rs b/winit-appkit/src/lib.rs index 949e2f799b..211fdb4cbf 100644 --- a/winit-appkit/src/lib.rs +++ b/winit-appkit/src/lib.rs @@ -341,6 +341,7 @@ pub struct WindowAttributesMacOS { pub(crate) borderless_game: bool, pub(crate) unified_titlebar: bool, pub(crate) panel: bool, + pub(crate) simple_fullscreen: bool, } impl WindowAttributesMacOS { @@ -437,6 +438,12 @@ impl WindowAttributesMacOS { self } + /// See [`WindowExtMacOS::set_simple_fullscreen`] for details on what this means if set. + pub fn with_simple_fullscreen(mut self, simple_fullscreen: bool) -> Self { + self.simple_fullscreen = simple_fullscreen; + self + } + /// Use [`NSPanel`] window with [`NonactivatingPanel`] window style mask instead of /// [`NSWindow`]. /// @@ -468,6 +475,7 @@ impl Default for WindowAttributesMacOS { borderless_game: false, unified_titlebar: false, panel: false, + simple_fullscreen: false, } } } diff --git a/winit-appkit/src/window_delegate.rs b/winit-appkit/src/window_delegate.rs index 980ad63276..794f0f2600 100644 --- a/winit-appkit/src/window_delegate.rs +++ b/winit-appkit/src/window_delegate.rs @@ -847,6 +847,8 @@ impl WindowDelegate { // Set fullscreen mode after we setup everything delegate.set_fullscreen(attrs.fullscreen); + delegate.set_simple_fullscreen(macos_attrs.simple_fullscreen); + // Setting the window as key has to happen *after* we set the fullscreen // state, since otherwise we'll briefly see the window at normal size // before it transitions. diff --git a/winit/src/changelog/unreleased.md b/winit/src/changelog/unreleased.md index 7b166c417c..7238fa2cc1 100644 --- a/winit/src/changelog/unreleased.md +++ b/winit/src/changelog/unreleased.md @@ -16,6 +16,7 @@ on how to add them: - On X11, add `Window::even_more_rare_api`. - On Wayland, add `Window::common_api`. - On Windows, add `Window::some_rare_api`. +- On macOS, add `WindowAttributesMacOS::with_simple_fullscreen`. ``` When the change requires non-trivial amount of work for users to comply