fix borderless game presentation options not sticking after switching spaces#4482
Conversation
There was a problem hiding this comment.
Hmm, I'm not too big a fan of this (neither the current solution, nor the solution in this PR), it feels brittle.
It feels like the better place to properly set the presentation options would be in window:willUseFullScreenPresentationOptions:? Have you tried that?
|
Yes, I tried that pretty extensively. I tried almost all combinations of delegates + presentation options. I was surprised that the working minimal solution was to just have that logic in Having it only in Moving it exclusively to I tested it by alt-tabbing, mission control, switching spaces, toggling exclusive fullscreen, launching the window in borderlessfullscreen and minimizing/resizing, etc. |
|
CORRECTION: I meant switching spaces, not physical screens :) |
## Problem Borderless Fullscreen on macOS does not hide the menu bar. Fixes: #14783 ## Solution winit 0.30 added a window attribute that hides the dock and menu bar when using on macOS. This exposes that option as a field on Bevy's component, defaulting to true since this is the expected behavior in games. ## Testing Tested by setting ``` DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { mode: WindowMode::BorderlessFullscreen(MonitorSelection::Primary), ... ``` Launch the bevy app, and you should see that the menu bar is hidden. ## Showcase Before: <img width="3024" height="1964" alt="image" src="https://github.com/user-attachments/assets/52baa247-c329-42e7-81f7-ec330e20ab15" /> After: <img width="3022" height="1964" alt="image" src="https://github.com/user-attachments/assets/a0732d44-d369-4069-97bc-c55b310c989c" /> ## Known Issues rust-windowing/winit#4477 - when switching spaces (e.g. using mission control), the menu bar regains visibility -- fixed by rust-windowing/winit#4482
madsmtm
left a comment
There was a problem hiding this comment.
Fair enough, I'll trust that then.
Could I get you to document it with a code-comment? And fix CI.
Done |
Fixes: #4477
changelogmodule if knowledge of this change could be valuable to usersMoving the borderless game presentation options to
windowDidChangeOcclusionStatewas sufficient to fix this issue.To test using the updated example:
cargo run --example applicationCTRL+Bto enable borderless_game (nothing happens visually yet)CTRL+Fto go borderless fullscreen (notice menu bar is hidden and non-interactable as expected)