From c5e68d68e7c7fb66cc784242ede3b67666af27ca Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 6 Oct 2015 00:10:54 -0400 Subject: [PATCH] Mac: Reset display if going from fullscreen to a fullscreen Space or vice-versa. Otherwise, bad things happen. --- src/video/SDL_video.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index a89399d9d..7aa0aaaab 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -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;