From 2f9d9392359f70b236eaf9fac1e239de14de4e52 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 4 Nov 2011 17:44:17 -0400 Subject: [PATCH] Mac OS X: Try to save the GL context when toggling windowed and fullscreen. --HG-- branch : SDL-1.2 --- src/video/quartz/SDL_QuartzVideo.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/quartz/SDL_QuartzVideo.m b/src/video/quartz/SDL_QuartzVideo.m index 70b51dca5..f8885359c 100644 --- a/src/video/quartz/SDL_QuartzVideo.m +++ b/src/video/quartz/SDL_QuartzVideo.m @@ -1115,7 +1115,7 @@ static SDL_Surface* QZ_SetVideoMode (_THIS, SDL_Surface *current, int width, 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 @@ static SDL_Surface* QZ_SetVideoMode (_THIS, SDL_Surface *current, int width, } } } else { + QZ_RestoreDisplayMode(this); + QZ_ReleaseDisplayMode(this, mode); /* NULL is okay. */ + mode = NULL; current->w = width; current->h = height; [ qz_window setContentSize:contentRect.size ];