Mac OS X: Try to save the GL context when toggling windowed and fullscreen. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Fri, 04 Nov 2011 17:44:17 -0400
branchSDL-1.2
changeset 6056 c6041c61f9a6
parent 6055 90167a588fd4
child 6057 d0b7c45e982e
Mac OS X: Try to save the GL context when toggling windowed and fullscreen.
src/video/quartz/SDL_QuartzVideo.m
--- a/src/video/quartz/SDL_QuartzVideo.m	Fri Nov 04 17:42:54 2011 -0400
+++ b/src/video/quartz/SDL_QuartzVideo.m	Fri Nov 04 17:44:17 2011 -0400
@@ -1115,7 +1115,7 @@
     const BOOL isLion = IS_LION_OR_LATER(this);
 
     /* Don't throw away the GL context if we can just resize the current one. */
-    if ( (video_set == SDL_TRUE) && ((flags & (SDL_OPENGL | SDL_FULLSCREEN)) == (current->flags & (SDL_OPENGL | SDL_FULLSCREEN))) && (bpp == current->format->BitsPerPixel) ) {
+    if ( (video_set == SDL_TRUE) && ((flags & SDL_OPENGL) == (current->flags & SDL_OPENGL)) && (bpp == current->format->BitsPerPixel) ) {
         const NSRect contentRect = NSMakeRect (0, 0, width, height);
         if (flags & SDL_FULLSCREEN) {
             /* if these fail, we'll try the old way, of tearing everything down. */
@@ -1135,6 +1135,9 @@
                 }
             }
         } else {
+            QZ_RestoreDisplayMode(this);
+            QZ_ReleaseDisplayMode(this, mode);  /* NULL is okay. */
+            mode = NULL;
             current->w = width;
             current->h = height;
             [ qz_window setContentSize:contentRect.size ];