Skip to content

fix borderless game presentation options not sticking after switching spaces#4482

Merged
madsmtm merged 5 commits intorust-windowing:masterfrom
TarekAS:fix/borderless-game-undoing-after-screen-change
Feb 11, 2026
Merged

fix borderless game presentation options not sticking after switching spaces#4482
madsmtm merged 5 commits intorust-windowing:masterfrom
TarekAS:fix/borderless-game-undoing-after-screen-change

Conversation

@TarekAS
Copy link
Contributor

@TarekAS TarekAS commented Feb 8, 2026

Fixes: #4477

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

Moving the borderless game presentation options to windowDidChangeOcclusionState was sufficient to fix this issue.

To test using the updated example:

  • Launch cargo run --example application
  • CTRL+B to enable borderless_game (nothing happens visually yet)
  • CTRL+F to go borderless fullscreen (notice menu bar is hidden and non-interactable as expected)
  • Toggle Mission Control or change spaces using alt-tab and back
  • Notice the menu bar is still hidden and non-interactable (this is the fix)

@TarekAS TarekAS requested a review from madsmtm as a code owner February 8, 2026 13:44
@madsmtm madsmtm added DS - appkit Affects the AppKit/macOS backend B - bug Dang, that shouldn't have happened labels Feb 8, 2026
Copy link
Member

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@TarekAS
Copy link
Contributor Author

TarekAS commented Feb 8, 2026

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 windowDidChangeOcclusionState.

Having it only in window:willUseFullScreenPresentationOptions worked, but the menu bar became interactable when switching spaces, despite being hidden. That's why the current solution has that comment, but a regression happened somewhere that caused the menu bar to show after the spaces switched (or maybe it wasn't tested at that time).

Moving it exclusively to windowDidChangeOcclusionState made it work in all cases, unless I missed something.

I tested it by alt-tabbing, mission control, switching spaces, toggling exclusive fullscreen, launching the window in borderlessfullscreen and minimizing/resizing, etc.

@TarekAS TarekAS changed the title fix borderless game presentation options not sticking after screen ch… fix borderless game presentation options not sticking after switching spaces Feb 8, 2026
@TarekAS
Copy link
Contributor Author

TarekAS commented Feb 8, 2026

CORRECTION: I meant switching spaces, not physical screens :)

github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this pull request Feb 9, 2026
## 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
Copy link
Member

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I'll trust that then.

Could I get you to document it with a code-comment? And fix CI.

@TarekAS
Copy link
Contributor Author

TarekAS commented Feb 11, 2026

Fair enough, I'll trust that then.

Could I get you to document it with a code-comment? And fix CI.

Done

Copy link
Member

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@madsmtm madsmtm merged commit 983e509 into rust-windowing:master Feb 11, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B - bug Dang, that shouldn't have happened DS - appkit Affects the AppKit/macOS backend

Development

Successfully merging this pull request may close these issues.

Menu bar regains visibility when switching spaces in borderless_game mode

2 participants