Mac: Fixed SDL_SetWindowFullscreen not restoring the window's original size when exiting a Space.
authorAlex Szpakowski
Mon, 30 Nov 2015 03:30:07 -0400
changeset 9932a6a953b6d0ce
parent 9931 0bb3dd1c95f2
child 9933 16e85b80177f
Mac: Fixed SDL_SetWindowFullscreen not restoring the window's original size when exiting a Space.
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sun Nov 29 19:33:11 2015 -0500
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Nov 30 03:30:07 2015 -0400
     1.3 @@ -682,7 +682,10 @@
     1.4  {
     1.5      SDL_Window *window = _data->window;
     1.6  
     1.7 -    SetWindowStyle(window, GetWindowStyle(window));
     1.8 +    /* As of OS X 10.11, the window seems to need to be resizable when exiting
     1.9 +       a Space, in order for it to resize back to its windowed-mode size.
    1.10 +     */
    1.11 +    SetWindowStyle(window, GetWindowStyle(window) | NSResizableWindowMask);
    1.12  
    1.13      isFullscreenSpace = NO;
    1.14      inFullscreenTransition = YES;
    1.15 @@ -711,6 +714,8 @@
    1.16  
    1.17      inFullscreenTransition = NO;
    1.18  
    1.19 +    SetWindowStyle(window, GetWindowStyle(window));
    1.20 +
    1.21      [nswindow setLevel:kCGNormalWindowLevel];
    1.22  
    1.23      if (pendingWindowOperation == PENDING_OPERATION_ENTER_FULLSCREEN) {
    1.24 @@ -1184,6 +1189,7 @@
    1.25  Cocoa_CreateWindow(_THIS, SDL_Window * window)
    1.26  { @autoreleasepool
    1.27  {
    1.28 +    NSLog(@"CREATE WINDOW");
    1.29      SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
    1.30      NSWindow *nswindow;
    1.31      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    1.32 @@ -1543,6 +1549,7 @@
    1.33      }
    1.34  
    1.35      s_moveHack = 0;
    1.36 +    NSLog(@"SET CONTENT SIZE: %@", NSStringFromRect(rect));
    1.37      [nswindow setContentSize:rect.size];
    1.38      [nswindow setFrameOrigin:rect.origin];
    1.39      s_moveHack = SDL_GetTicks();