Skip to content

Commit

Permalink
SDL - fix re-entrancy into SDL_UpdateFullscreenMode under OSX. During…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
alfred-valve committed Jul 31, 2014
1 parent 5b78006 commit 7552947
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/video/SDL_sysvideo.h
Expand Up @@ -93,6 +93,7 @@ struct SDL_Window
SDL_Surface *surface;
SDL_bool surface_valid;

SDL_bool is_hiding;
SDL_bool is_destroying;

SDL_WindowShaper *shaper;
Expand Down
6 changes: 6 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -1105,6 +1105,10 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)

CHECK_WINDOW_MAGIC(window,);

/* if we are in the process of hiding don't go back to fullscreen */
if ( window->is_hiding && fullscreen )
return;

#ifdef __MACOSX__
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
window->last_fullscreen_flags = window->flags;
Expand Down Expand Up @@ -1833,11 +1837,13 @@ SDL_HideWindow(SDL_Window * window)
return;
}

window->is_hiding = SDL_TRUE;
SDL_UpdateFullscreenMode(window, SDL_FALSE);

if (_this->HideWindow) {
_this->HideWindow(_this, window);
}
window->is_hiding = SDL_FALSE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0);
}

Expand Down

0 comments on commit 7552947

Please sign in to comment.