From 9ddc6c34411255025a77205e5157e4e8c5839302 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 30 Nov 2015 03:30:07 -0400 Subject: [PATCH] Mac: Fixed SDL_SetWindowFullscreen not restoring the window's original size when exiting a Space. --- src/video/cocoa/SDL_cocoawindow.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index fad9971ef..88893248b 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -682,7 +682,10 @@ SetWindowStyle(SDL_Window * window, unsigned int style) { SDL_Window *window = _data->window; - SetWindowStyle(window, GetWindowStyle(window)); + /* As of OS X 10.11, the window seems to need to be resizable when exiting + a Space, in order for it to resize back to its windowed-mode size. + */ + SetWindowStyle(window, GetWindowStyle(window) | NSResizableWindowMask); isFullscreenSpace = NO; inFullscreenTransition = YES; @@ -711,6 +714,8 @@ SetWindowStyle(SDL_Window * window, unsigned int style) inFullscreenTransition = NO; + SetWindowStyle(window, GetWindowStyle(window)); + [nswindow setLevel:kCGNormalWindowLevel]; if (pendingWindowOperation == PENDING_OPERATION_ENTER_FULLSCREEN) { @@ -1184,6 +1189,7 @@ int Cocoa_CreateWindow(_THIS, SDL_Window * window) { @autoreleasepool { + NSLog(@"CREATE WINDOW"); SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; NSWindow *nswindow; SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); @@ -1543,6 +1549,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display } s_moveHack = 0; + NSLog(@"SET CONTENT SIZE: %@", NSStringFromRect(rect)); [nswindow setContentSize:rect.size]; [nswindow setFrameOrigin:rect.origin]; s_moveHack = SDL_GetTicks();