Skip to content

On macOS, add fullscreen auxiliary window support#4614

Open
smoe wants to merge 1 commit into
rust-windowing:masterfrom
smoe:macos-fullscreen-auxiliary
Open

On macOS, add fullscreen auxiliary window support#4614
smoe wants to merge 1 commit into
rust-windowing:masterfrom
smoe:macos-fullscreen-auxiliary

Conversation

@smoe

@smoe smoe commented Jul 3, 2026

Copy link
Copy Markdown

Hello,

The backstory is that I was updating egui to 0.34 (still in 0.35) and with it came a weird flicker when maximising the screen for our nested windows. First reported as emilk/egui#8043, I was asked to separate my observation. I freely admit that I alone would not have found this issue, and it was very apparently so also not immediately obvious to the egui devs. But Claude Fable surfaced and I thought like "hey, give it a shot". Fable then addressed this via the Objective C interface to the MacOS routines directly in egui, and I have seen that it fixes the bug, indeed. In the description and reasoning on what it did, Fable then stated that it should have been winit to expose these fullscreen-auxiliary flags. I then asked if this should then not better be fixed in winit, instead. And so, here we are.

I had a look at the generated code and liked it. Please tell me if you need anything extra. Below, please find the PR description prepared by Fable.


Add WindowAttributesMacOS::with_fullscreen_auxiliary and WindowExtMacOS::set_fullscreen_auxiliary / fullscreen_auxiliary, exposing NSWindowCollectionBehaviorFullScreenAuxiliary.

An auxiliary window can be shown on the same Space as a fullscreen window. Without this, ordering a new window on screen while another window of the application is fullscreen on the active Space makes macOS switch Spaces or attempt Split View tiling, which flickers and can abort the fullscreen state. This affects any application that opens secondary windows (palettes, inspectors, tool windows) from a fullscreen main window; see e.g.
emilk/egui#8259 for a downstream bug caused by this.

The attribute is applied in new_window so the collection behavior is already in place when the window is first ordered on screen, which is required for the fullscreen Space to remain undisturbed (and is not achievable through the runtime setter, since winit shows the window during creation).

Since toggleFullScreen: is silently ignored by AppKit on windows with the auxiliary collection behavior, set_fullscreen now warns and bails out early on such windows instead of recording a fullscreen state that never materializes.

Add `WindowAttributesMacOS::with_fullscreen_auxiliary` and
`WindowExtMacOS::set_fullscreen_auxiliary` / `fullscreen_auxiliary`,
exposing `NSWindowCollectionBehaviorFullScreenAuxiliary`.

An auxiliary window can be shown on the same Space as a fullscreen
window. Without this, ordering a new window on screen while another
window of the application is fullscreen on the active Space makes macOS
switch Spaces or attempt Split View tiling, which flickers and can
abort the fullscreen state. This affects any application that opens
secondary windows (palettes, inspectors, tool windows) from a
fullscreen main window; see e.g.
emilk/egui#8259 for a downstream bug caused
by this.

The attribute is applied in `new_window` so the collection behavior is
already in place when the window is first ordered on screen, which is
required for the fullscreen Space to remain undisturbed (and is not
achievable through the runtime setter, since winit shows the window
during creation).

Since `toggleFullScreen:` is silently ignored by AppKit on windows with
the auxiliary collection behavior, `set_fullscreen` now warns and bails
out early on such windows instead of recording a fullscreen state that
never materializes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant