Commit ebfb2ecb68540f6ce01ed17e955f7fc808c4f426

Sam Lantinga 2015-11-09T08:55:01

don't toggle SDL fullscreen state on OSX if we're destroying the window

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 1e5600d..b29a87a 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1138,6 +1138,12 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
         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)) {