Modernise macos fullscreen implementation and ensure consistency with system#3662
Open
JonnyPtn wants to merge 1 commit intoSFML:masterfrom
Open
Modernise macos fullscreen implementation and ensure consistency with system#3662JonnyPtn wants to merge 1 commit intoSFML:masterfrom
JonnyPtn wants to merge 1 commit intoSFML:masterfrom
Conversation
8 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.
I say modernise, but this has been the preferred way of using fullscreen since macOS lion 10.7, 16 years ago when they introduced spaces (effectively separate desktops for fullscreen apps)
The current implementation is really just borderless fullscreen, creating a window the size of the display. This can easily cause inconsistencies as it's possible for users to use toggle the modern spaces fullscreen via a keyboard shortcut, the apps menu bar, or the fullscreen button on the window titlebar. When they do this, the SFML app goes to a fullscreen space, but SFML's implementation is not aware of it and still thinks it's' windowed.
This implementation detail wasn't really exposed as there's no way currently to check if an SFML window is fullscreen, it relies on the developer to track it themselves, however with the upcoming PR to expose the fullscreen state in #3501 this issue is even more apparent -
getStatewould returnWindowedwhen for all intents and purposes the window is fullscreen.So there's three options to solve this:
I have gone for the last option, as it fixes the bugs, tidies the implementation and requires no API changes. It guarantees that fullscreen specific behaviour such as resizing the window programmatically behaves correctly in all cases and users won't be confused by SFML windows having multiple different fullscreen states
For comparison, SDL offers a hint to choose which mode: https://wiki.libsdl.org/SDL2/SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES
As a bonus bug fix, we no longer have to guess about the fullscreen state of windows that are created by passing an existing native window handle