don't toggle SDL fullscreen state on OSX if we're destroying the window
authorSam Lantinga <slouken@libsdl.org>
Mon, 09 Nov 2015 08:55:01 -0800
changeset 9906 49c432b1897b
parent 9905 fcf85090f816
child 9907 2048ad756970
don't toggle SDL fullscreen state on OSX if we're destroying the window
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Mon Nov 09 08:54:56 2015 -0800
+++ b/src/video/SDL_video.c	Mon Nov 09 08:55:01 2015 -0800
@@ -1138,6 +1138,12 @@
         return 0;
 
 #ifdef __MACOSX__
+    /* if the window is going away and no resolution change is necessary,
+     do nothing, or else we may trigger an ugly double-transition
+     */
+    if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
+        return 0;
+    
     /* 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)) {
         if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {