Skip to content

Commit

Permalink
Mac: Fixed SDL_SetWindowFullscreen not restoring the window's origina…
Browse files Browse the repository at this point in the history
…l size when exiting a Space.
  • Loading branch information
slime73 committed Nov 30, 2015
1 parent 25abce5 commit 9ddc6c3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -682,7 +682,10 @@ - (void)windowWillExitFullScreen:(NSNotification *)aNotification
{
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;
Expand Down Expand Up @@ -711,6 +714,8 @@ - (void)windowDidExitFullScreen:(NSNotification *)aNotification

inFullscreenTransition = NO;

SetWindowStyle(window, GetWindowStyle(window));

[nswindow setLevel:kCGNormalWindowLevel];

if (pendingWindowOperation == PENDING_OPERATION_ENTER_FULLSCREEN) {
Expand Down Expand Up @@ -1184,6 +1189,7 @@ - (void)resetCursorRects
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);
Expand Down Expand Up @@ -1543,6 +1549,7 @@ - (void)resetCursorRects
}

s_moveHack = 0;
NSLog(@"SET CONTENT SIZE: %@", NSStringFromRect(rect));
[nswindow setContentSize:rect.size];
[nswindow setFrameOrigin:rect.origin];
s_moveHack = SDL_GetTicks();
Expand Down

0 comments on commit 9ddc6c3

Please sign in to comment.