Fixed bug 1364 - Fullscreen OpenGL fails in OS 10.7 if deployment target is less than 10.7 SDL-1.2
authorSam Lantinga
Sat, 07 Jan 2012 13:52:10 -0500
branchSDL-1.2
changeset 61735619adf4736d
parent 6170 044ca54328b4
child 6192 1cda6d996fd0
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
     1.1 --- a/src/video/quartz/SDL_QuartzVideo.m	Sat Jan 07 02:07:38 2012 -0500
     1.2 +++ b/src/video/quartz/SDL_QuartzVideo.m	Sat Jan 07 13:52:10 2012 -0500
     1.3 @@ -837,8 +837,12 @@
     1.4  
     1.5          /* Apparently Lion checks some version flag set by the linker
     1.6             and changes API behavior. Annoying. */
     1.7 -#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
     1.8 -        {
     1.9 +        if ( isLion ) {
    1.10 +		[ qz_window setLevel:CGShieldingWindowLevel() ];
    1.11 +		[ gl_context setView: window_view ];
    1.12 +		[ gl_context setFullScreen ];
    1.13 +		[ gl_context update ];
    1.14 +	} else {
    1.15              CGLError err;
    1.16              CGLContextObj ctx;
    1.17  
    1.18 @@ -850,13 +854,7 @@
    1.19                  SDL_SetError ("Error setting OpenGL fullscreen: %s", CGLErrorString(err));
    1.20                  goto ERR_NO_GL;
    1.21              }
    1.22 -        }
    1.23 -#else
    1.24 -        [ qz_window setLevel:CGShieldingWindowLevel() ];
    1.25 -        [ gl_context setView: window_view ];
    1.26 -        [ gl_context setFullScreen ];
    1.27 -        [ gl_context update ];
    1.28 -#endif
    1.29 +	}
    1.30  
    1.31          [ window_view release ];
    1.32          [ gl_context makeCurrentContext];