Skip to content

Commit

Permalink
Mac: Reset display if going from fullscreen to a fullscreen Space or …
Browse files Browse the repository at this point in the history
…vice-versa.

Otherwise, bad things happen.
  • Loading branch information
icculus committed Oct 6, 2015
1 parent 7bc72ea commit c5e68d6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/video/SDL_video.c
Expand Up @@ -1136,8 +1136,19 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
/* if we are in the process of hiding don't go back to fullscreen */
if ( window->is_hiding && fullscreen )
return 0;

#ifdef __MACOSX__
/* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE);
} else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
display = SDL_GetDisplayForWindow(window);
SDL_SetDisplayModeForDisplay(display, NULL);
if (_this->SetWindowFullscreen) {
_this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
}
}

if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
window->last_fullscreen_flags = window->flags;
return 0;
Expand Down

0 comments on commit c5e68d6

Please sign in to comment.