SDL_cocoawindow.m: update fullscreen toggle when SDL_SetWindowResizable called

This commit is contained in:
uyjulian 2022-01-04 10:43:34 -06:00 committed by Sam Lantinga
parent cc152103ba
commit a164c9d245
1 changed files with 10 additions and 0 deletions
src/video/cocoa

View File

@ -2020,9 +2020,19 @@ Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable)
*/ */
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Cocoa_WindowListener *listener = data->listener; Cocoa_WindowListener *listener = data->listener;
NSWindow *nswindow = data->nswindow;
SDL_VideoData *videodata = ((SDL_WindowData *) window->driverdata)->videodata;
if (![listener isInFullscreenSpace]) { if (![listener isInFullscreenSpace]) {
SetWindowStyle(window, GetWindowStyle(window)); SetWindowStyle(window, GetWindowStyle(window));
} }
if (videodata->allow_spaces) {
if (resizable) {
/* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
} else {
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged];
}
}
}} }}
void void