-
Notifications
You must be signed in to change notification settings - Fork 416
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
Bring back borderless mode for macOS and Linux #6264
base: master
Are you sure you want to change the base?
Conversation
This partially reverts 0e78180
@Joehuu please check if the borderless mode works as expected in this pull. |
Borderless itself seems to behave/work as expected (before SDL3) but windowed size gets maximised after toggling between the modes. Didn't happen in latest master. Screen.Recording.2024-04-22.at.12.50.50.PM.mov |
I'm also somewhat hesitant to add back borderless mode on macOS when it goes against how basically any other app works. |
If borderless isn't coming back then we should remove this game-side disclaimer. |
public static WindowState ToWindowState(this SDL_WindowFlags windowFlags, bool isFullscreenBorderless) | ||
{ | ||
// for windows | ||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_BORDERLESS)) | ||
return WindowState.FullscreenBorderless; | ||
|
||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_MINIMIZED)) | ||
return WindowState.Minimised; | ||
|
||
if (windowFlags.HasFlagFast(SDL_WindowFlags.SDL_WINDOW_FULLSCREEN)) | ||
return WindowState.Fullscreen; | ||
return isFullscreenBorderless ? WindowState.FullscreenBorderless : WindowState.Fullscreen; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding #6264 (comment), it appears that once the window is in borderless mode, it does not have the SDL_WINDOW_FULLSCREEN
flag set:
Therefore, the WindowState
is kept at normal even after the window has switched to borderless, and sizeWindowed
becomes corrupted as a result, causing the window to become maximised when returning from borderless.
Noticed when looking into #6262.
The SDL3 migration readme is cryptic about borderless being available:
Not only can you check if the used fullscreen mode will be borderless, you can also set it by passing
NULL
toSDL_SetWindowFullscreenMode
!