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

Bring back borderless mode for macOS and Linux #6264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Susko3
Copy link
Member

@Susko3 Susko3 commented Apr 22, 2024

Noticed when looking into #6262.

The SDL3 migration readme is cryptic about borderless being available:

SDL_WINDOW_FULLSCREEN_DESKTOP has been removed, and you can call SDL_GetWindowFullscreenMode() to see whether an exclusive fullscreen mode will be used or the borderless fullscreen desktop mode will be used when the window is fullscreen.

Not only can you check if the used fullscreen mode will be borderless, you can also set it by passing NULL to SDL_SetWindowFullscreenMode!

@Susko3
Copy link
Member Author

Susko3 commented Apr 22, 2024

Fullscreen on macOS somewhat doesn't take full control on SDL3 anymore, but cmd-tab has a horrible delay as opposed to borderless.

@Joehuu please check if the borderless mode works as expected in this pull.

@Joehuu
Copy link
Member

Joehuu commented Apr 22, 2024

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

@peppy
Copy link
Sponsor Member

peppy commented Apr 22, 2024

I'm also somewhat hesitant to add back borderless mode on macOS when it goes against how basically any other app works.

@bdach
Copy link
Collaborator

bdach commented May 19, 2024

If borderless isn't coming back then we should remove this game-side disclaimer.

Comment on lines +862 to +872
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;
Copy link
Member

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:

CleanShot 2024-05-20 at 15 19 01

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants