SDL - fix re-entrancy into SDL_UpdateFullscreenMode under OSX. During HideWindow we get a RESTORED event which then turns fullscreen back on causing a hang in Cocoa_SetWindowFullscreenSpace waiting for the fullscreen transition to finish.
authorAlfred Reynolds <alfred@valvesoftware.com>
Wed, 30 Jul 2014 17:45:52 -0700
changeset 9037e9d67ac0c6f8
parent 9035 d6464107048c
child 9041 89e97caa2387
child 9507 b1e690e9c5b3
SDL - fix re-entrancy into SDL_UpdateFullscreenMode under OSX. During HideWindow we get a RESTORED event which then turns fullscreen back on causing a hang in Cocoa_SetWindowFullscreenSpace waiting for the fullscreen transition to finish.
src/video/SDL_sysvideo.h
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_sysvideo.h	Wed Jul 30 14:14:19 2014 -0400
     1.2 +++ b/src/video/SDL_sysvideo.h	Wed Jul 30 17:45:52 2014 -0700
     1.3 @@ -93,6 +93,7 @@
     1.4      SDL_Surface *surface;
     1.5      SDL_bool surface_valid;
     1.6  
     1.7 +    SDL_bool is_hiding;
     1.8      SDL_bool is_destroying;
     1.9  
    1.10      SDL_WindowShaper *shaper;
     2.1 --- a/src/video/SDL_video.c	Wed Jul 30 14:14:19 2014 -0400
     2.2 +++ b/src/video/SDL_video.c	Wed Jul 30 17:45:52 2014 -0700
     2.3 @@ -1105,6 +1105,10 @@
     2.4  
     2.5      CHECK_WINDOW_MAGIC(window,);
     2.6  
     2.7 +    /* if we are in the process of hiding don't go back to fullscreen */
     2.8 +    if ( window->is_hiding && fullscreen )
     2.9 +        return;
    2.10 +    
    2.11  #ifdef __MACOSX__
    2.12      if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
    2.13          window->last_fullscreen_flags = window->flags;
    2.14 @@ -1833,11 +1837,13 @@
    2.15          return;
    2.16      }
    2.17  
    2.18 +	window->is_hiding = SDL_TRUE;
    2.19      SDL_UpdateFullscreenMode(window, SDL_FALSE);
    2.20  
    2.21      if (_this->HideWindow) {
    2.22          _this->HideWindow(_this, window);
    2.23      }
    2.24 +	window->is_hiding = SDL_FALSE;
    2.25      SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
    2.26  }
    2.27