From ad233604ea88e4afccc421672299d87070bc0ade Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 7 Jan 2012 13:52:10 -0500 Subject: [PATCH] Fixed bug 1364 - Fullscreen OpenGL fails in OS 10.7 if deployment target is less than 10.7 amaranth72@gmail.com 2012-01-07 01:28:40 PST Using the latest Hg tip of SDL 1.2, SDL_SetVideoMode will fail with the SDL_OPENGL and SDL_FULLSCREEN flags set if the computer is running Lion and the build deployment target version is lower than 10.7. The issue seems to be at line 840 of SDL_QuartzVideo.m, where it checks if the minimum required version is less than 10.7. If that condition is true, then it uses the pre-Lion fullscreen method, even though the condition doesn't seem to say anything about whether the computer is currently running Lion or not. I tried doing this inside the #if conditional check (pseudocode): if (isLion) { do new Lion stuff } else { do old stuff } , and that seemed to work fine. An "invalid fullscreen drawable" warning was still around even though fullscreen worked with the new addition, but I think that's because Lion wants SDL to add a new Spaces thing when it goes fullscreen. --- src/video/quartz/SDL_QuartzVideo.m | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/video/quartz/SDL_QuartzVideo.m b/src/video/quartz/SDL_QuartzVideo.m index d86974c66..df2d12762 100644 --- a/src/video/quartz/SDL_QuartzVideo.m +++ b/src/video/quartz/SDL_QuartzVideo.m @@ -837,8 +837,12 @@ other blitting while waiting on the VBL (and hence results in higher framerates) /* Apparently Lion checks some version flag set by the linker and changes API behavior. Annoying. */ -#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) - { + if ( isLion ) { + [ qz_window setLevel:CGShieldingWindowLevel() ]; + [ gl_context setView: window_view ]; + [ gl_context setFullScreen ]; + [ gl_context update ]; + } else { CGLError err; CGLContextObj ctx; @@ -850,13 +854,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates) SDL_SetError ("Error setting OpenGL fullscreen: %s", CGLErrorString(err)); goto ERR_NO_GL; } - } -#else - [ qz_window setLevel:CGShieldingWindowLevel() ]; - [ gl_context setView: window_view ]; - [ gl_context setFullScreen ]; - [ gl_context update ]; -#endif + } [ window_view release ]; [ gl_context makeCurrentContext];