fix: handle failing to enter fullscreen on macOS#43112
Merged
codebytere merged 2 commits intoelectron:mainfrom Aug 1, 2024
Merged
fix: handle failing to enter fullscreen on macOS#43112codebytere merged 2 commits intoelectron:mainfrom
codebytere merged 2 commits intoelectron:mainfrom
Conversation
On macOS, failing to enter/exit fullscreen can fail. If this happens, properly restore the original window state.
codebytere
reviewed
Jul 30, 2024
Member
codebytere
left a comment
There was a problem hiding this comment.
Thanks for tackling this! Generally this looks good - just one change/removal i think we can make.
Seem to be unnecessary since the window exits fullscreen anyway.
codebytere
approved these changes
Jul 31, 2024
ckerr
approved these changes
Jul 31, 2024
|
Release Notes Persisted
|
This was referenced Aug 1, 2024
Contributor
|
I have automatically backported this PR to "30-x-y", please check out #43151 |
Contributor
|
I have automatically backported this PR to "32-x-y", please check out #43152 |
Contributor
|
I have automatically backported this PR to "29-x-y", please check out #43153 |
Contributor
|
I have automatically backported this PR to "31-x-y", please check out #43154 |
codebytere
pushed a commit
that referenced
this pull request
Aug 1, 2024
* fix: handle failing to enter/exit fullscreen on macOS On macOS, failing to enter/exit fullscreen can fail. If this happens, properly restore the original window state. * refactor: remove fail to exit fullscreen handlers Seem to be unnecessary since the window exits fullscreen anyway.
Contributor
|
This is 👍 , I am sure some VS Code users (including myself) have had this issue in the past and I was never sure what caused it. |
3 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
On macOS, entering or exiting fullscreen mode can fail even after
windowWillEnterFullScreenorwindowWillExitFullScreenhas run (see the documentation forwindowDidFailToEnterFullScreenandwindowDidFailToExitFullScreen). If this happens, it is necessary to properly restore the window's original state, but Electron currently does not do that. The most prominent bug caused by this is that if the window fails to enter fullscreen,fullscreen_transition_state_is "stuck" atFullScreenTransitionState::kEntering, andapp.quit()does not work properly because the window refuses to close.I don't know if it's possible to trigger these failures with automation, but
windowDidFailToEnterFullScreencan be triggered manually on a Macbook without much effort:windowWillEnterFullScreenruns followed bywindowDidFailToEnterFullScreen. Without this change, the app will refuse to quit when theapp.quit()call eventually runs. With this change, it quits normally.Exiting fullscreen seems to behave oddly - when doing the same "swipe halfway into the other desktop" test with a window that is exiting fullscreen,
windowDidFailToExitFullScreendoes fire, butwindowDidExitFullScreenalso fires, and the window properly exits fullscreen once the user fully switches to a single desktop. To be safe, I tried to write this change such that it will work if either justwindowDidFailToExitFullScreenruns or if both run.Checklist
Release Notes
Notes: Fix behavior when entering/exiting fullscreen fails on macOS.