Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In MacOS, only disable menu bar in exclusive fullscreen mode #1326

Closed
wants to merge 2 commits into from

Conversation

cixel
Copy link
Contributor

@cixel cixel commented Dec 19, 2019

My attempt at a quick patch for #1195, which causes alacritty/alacritty#3023. It seems to fix the issue in Alacritty.

@aleksijuvani mentioned wanting proposed_options to be be replaced with user configured options via something like window.set_fullscreen_presentation_options. I'm happy to take a crack at this, but I'm inexperienced with Rust and figured a quick patch might suffice for now.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

window:willUseFullScreenPresentationOptions: is not invoked if the user switches between borderless and exclusive fullscreen mode (because the window is already in "fullscreen" mode). I think what we need to do is to set presentationOptions manually in set_fullscreen when transitioning between the two. This can be tested with the "multithreaded" example.

@cixel
Copy link
Contributor Author

cixel commented Dec 21, 2019

Ok, I spent a bit more time with this. Here's where I'm at.

In the transition from Borderless-->Exclusive, I used the shared_state lock to save app.presentationOptions_() the way set_simple_fullscreen does. Then, I disable the menu bar the same way window:willUseFullscreenPresentationOptions does.

In the transition from Exclusive-->Borderless, I read save_presentation_opts from shared_state, and if they have been set, I give them to app.setPresentationOptions_().

I'm still noticing a little bit of weirdness, but I'm not sure how to interpret it. Here's a screen recording to demonstrate.
In the video:

  1. start --multithreaded example
  2. Press F to enter borderless fullscreen. Notice the menu bar is hidden.
  3. Press alt-F to enter exclusive fullscreen. This works as intended.
  4. Press F to enter borderless fullscreen. This still has no menu bar.
  5. Move to a different desktop and select a different window (in this case my terminal)
  6. Move back to the fullscreen window. Notice that the menu bar now appears.
  7. Press alt-F to enter exclusive fullscreen. This is still hiding the menu bar as expected.
  8. Press F to restore borderless fullscreen. The menu bar still appears as it did before (before your proposed change it did not).

I'm not sure why I have to go through the ceremony of switching desktops and selecting another window to get the menu bar to appear in the first place, but once it appears, it seems to be saved and restored correctly when transitioning between Borderless<-->Exclusive modes.

Any thoughts? Also, should I be loading/retreiving shared_state.save_presentation_opts with every transition to Exclusive, not just ones between Borderless and Exclusive?

@cixel cixel force-pushed the fix-1195 branch 2 times, most recently from 7d01703 to 15884fe Compare December 28, 2019 01:21
@Osspial
Copy link
Contributor

Osspial commented Jan 6, 2020

@vbogaevsky could you review this?

@felipesere
Copy link

I've tested this on my Mac with the merge-conflict resolved and it worked like a charm.
Is there anything holiding this up? I'd love to see it land and then used in Alacritty.

@ArturKovacs ArturKovacs self-requested a review January 17, 2021 14:10
@ArturKovacs
Copy link
Contributor

I assume one of you fixed the problem that the menubar was hidden when first entering borderless fullscreen, because I could not reproduce it.

Please merge with the master first because there are a few issues that show up otherwise.

After merging with master I do get one strange behaviour. Running cargo run --example multithreaded:

  1. Press esc twice to close the first two windows
  2. Press alt+F. The window goes into exclusive fullscreen
  3. Press F. The window seems to change to borderless fullscreen which is indicated by the fact that I can use cmd+tab to switch between applications. But now the menu bar isn't shown.

Let me know if you need help investigating this.

@felipesere
Copy link

If I go from alt+F back to borderless fullscreen then the menu is blacked out.
If I go directly to borderless fullscreen then its fine and can get to the menu.

This feels odd...

@madsmtm
Copy link
Member

madsmtm commented Apr 29, 2021

I get the same reproduction as @ArturKovacs on MacOS 10.14.6 Mojave, with the latest master - this seems like it can be fixed, but damn is it hard to keep track of all these state changes!

@irh
Copy link
Contributor

irh commented Oct 4, 2021

If I go from alt+F back to borderless fullscreen then the menu is blacked out.
If I go directly to borderless fullscreen then its fine and can get to the menu.

I think I have a fix for this, see irh@99d3054

Are there any other issues remaining? I'd be happy to spend some more time on helping to push this forward.

@madsmtm
Copy link
Member

madsmtm commented Jan 3, 2022

Closing since this was merged in #2053, and remaining issues are tracked in #2068

@madsmtm madsmtm closed this Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - waiting on maintainer A maintainer must review this code DS - macos
Development

Successfully merging this pull request may close these issues.

7 participants