src/video/SDL_video.c
changeset 10781 7c19d6525105
parent 10746 95c57a177719
child 10806 36f40b8cc979
     1.1 --- a/src/video/SDL_video.c	Sat Jan 07 17:09:14 2017 -0500
     1.2 +++ b/src/video/SDL_video.c	Sat Jan 07 19:55:29 2017 -0500
     1.3 @@ -202,7 +202,7 @@
     1.4      return SDL_FALSE;
     1.5  
     1.6  #elif defined(__MACOSX__)
     1.7 -    /* Mac OS X uses OpenGL as the native fast path */
     1.8 +    /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */
     1.9      return SDL_TRUE;
    1.10  
    1.11  #elif defined(__LINUX__)
    1.12 @@ -1177,30 +1177,32 @@
    1.13      /* if the window is going away and no resolution change is necessary,
    1.14         do nothing, or else we may trigger an ugly double-transition
    1.15       */
    1.16 -    if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
    1.17 -        return 0;
    1.18 +    if (SDL_strcmp(_this->name, "cocoa") == 0) {  /* don't do this for X11, etc */
    1.19 +        if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
    1.20 +            return 0;
    1.21      
    1.22 -    if (!_this->is_dummy) {
    1.23 -        /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
    1.24 -        if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
    1.25 -            if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
    1.26 -                return -1;
    1.27 +        if (!_this->is_dummy) {
    1.28 +            /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
    1.29 +            if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
    1.30 +                if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
    1.31 +                    return -1;
    1.32 +                }
    1.33 +            } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
    1.34 +                display = SDL_GetDisplayForWindow(window);
    1.35 +                SDL_SetDisplayModeForDisplay(display, NULL);
    1.36 +                if (_this->SetWindowFullscreen) {
    1.37 +                    _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
    1.38 +                }
    1.39              }
    1.40 -        } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
    1.41 -            display = SDL_GetDisplayForWindow(window);
    1.42 -            SDL_SetDisplayModeForDisplay(display, NULL);
    1.43 -            if (_this->SetWindowFullscreen) {
    1.44 -                _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
    1.45 +
    1.46 +            if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
    1.47 +                if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
    1.48 +                    return -1;
    1.49 +                }
    1.50 +                window->last_fullscreen_flags = window->flags;
    1.51 +                return 0;
    1.52              }
    1.53          }
    1.54 -
    1.55 -        if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
    1.56 -            if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
    1.57 -                return -1;
    1.58 -            }
    1.59 -            window->last_fullscreen_flags = window->flags;
    1.60 -            return 0;
    1.61 -        }
    1.62      }
    1.63  #elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
    1.64      /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
    1.65 @@ -2521,8 +2523,10 @@
    1.66      }
    1.67  
    1.68  #ifdef __MACOSX__
    1.69 -    if (Cocoa_IsWindowInFullscreenSpace(window)) {
    1.70 -        return SDL_FALSE;
    1.71 +    if (SDL_strcmp(_this->name, "cocoa") == 0) {  /* don't do this for X11, etc */
    1.72 +        if (Cocoa_IsWindowInFullscreenSpace(window)) {
    1.73 +            return SDL_FALSE;
    1.74 +        }
    1.75      }
    1.76  #endif
    1.77