Mac: Reset display if going from fullscreen to a fullscreen Space or vice-versa.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 06 Oct 2015 00:10:54 -0400
changeset 988777f017f7f16d
parent 9886 adb374e144d6
child 9888 bf49de980798
Mac: Reset display if going from fullscreen to a fullscreen Space or vice-versa.

Otherwise, bad things happen.
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Thu Oct 01 11:21:06 2015 -0700
     1.2 +++ b/src/video/SDL_video.c	Tue Oct 06 00:10:54 2015 -0400
     1.3 @@ -1136,8 +1136,19 @@
     1.4      /* if we are in the process of hiding don't go back to fullscreen */
     1.5      if ( window->is_hiding && fullscreen )
     1.6          return 0;
     1.7 -    
     1.8 +
     1.9  #ifdef __MACOSX__
    1.10 +    /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
    1.11 +    if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
    1.12 +        Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE);
    1.13 +    } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
    1.14 +        display = SDL_GetDisplayForWindow(window);
    1.15 +        SDL_SetDisplayModeForDisplay(display, NULL);
    1.16 +        if (_this->SetWindowFullscreen) {
    1.17 +            _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
    1.18 +        }
    1.19 +    }
    1.20 +
    1.21      if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
    1.22          window->last_fullscreen_flags = window->flags;
    1.23          return 0;