cocoa: Fix SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES=0.

This hint is documented to not just turn off fullscreen windows going into a
new Fullscreen Space, but also to make the green button on a resizeable
window's title bar do a maximize/zoom instead of make the window fullscreen.

Previously, this only did the former and not the latter (or perhaps it worked
and the defaults changed in a newer macOS, we aren't sure).

Fixes #7470.

(cherry picked from commit 50f3adec77)
This commit is contained in:
Ryan C. Gordon
2026-02-05 18:53:41 -05:00
parent 99eca2ca0d
commit 649c36c576

View File

@@ -1814,12 +1814,12 @@ int Cocoa_CreateWindow(_THIS, SDL_Window * window)
} }
#endif #endif
if (videodata.allow_spaces) { /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
if ((window->flags & SDL_WINDOW_RESIZABLE) && videodata.allow_spaces) {
/* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */ /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */
if (window->flags & SDL_WINDOW_RESIZABLE) { [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
/* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ } else {
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenNone];
}
} }
if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) {
@@ -2124,13 +2124,11 @@ void Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable)
if (![listener isInFullscreenSpace]) { if (![listener isInFullscreenSpace]) {
SetWindowStyle(window, GetWindowStyle(window)); SetWindowStyle(window, GetWindowStyle(window));
} }
if (videodata.allow_spaces) { if (resizable && videodata.allow_spaces) {
if (resizable) { /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
/* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } else {
} else { [nswindow setCollectionBehavior:NSWindowCollectionBehaviorNone];
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged];
}
} }
}} }}