Fixed SDL 1.2 fullscreen OpenGL on Mac OS X 10.7. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Wed, 10 Aug 2011 01:25:00 -0400
branchSDL-1.2
changeset 5606cf638ceb1f2c
parent 5599 5d7e82c63e84
child 5607 01a3ec16d8d5
Fixed SDL 1.2 fullscreen OpenGL on Mac OS X 10.7.

I'm not sure if there was a way to make CGLSetFullScreen() work, but the
Cocoa path works fine on all Intel Macs.

Please note that the "official" way to do fullscreen in 10.7 is just to make
a window the size of the display mode, and OS X is now smart enough to
recognize this as "fullscreen", but this helps earlier versions of the OS in
any case.
src/video/quartz/SDL_QuartzVideo.m
     1.1 --- a/src/video/quartz/SDL_QuartzVideo.m	Thu Aug 04 01:44:32 2011 -0400
     1.2 +++ b/src/video/quartz/SDL_QuartzVideo.m	Wed Aug 10 01:25:00 2011 -0400
     1.3 @@ -411,7 +411,9 @@
     1.4          if ( mode_flags & SDL_OPENGL ) {
     1.5          
     1.6              QZ_TearDownOpenGL (this);
     1.7 +            #ifdef __powerpc__  /* we only use this for pre-10.3 compatibility. */
     1.8              CGLSetFullScreen (NULL);
     1.9 +            #endif
    1.10          }
    1.11          if (to_desktop) {
    1.12              ShowMenuBar ();
    1.13 @@ -529,9 +531,6 @@
    1.14          CGLError err;
    1.15          CGLContextObj ctx;
    1.16  
    1.17 -        /* CGLSetFullScreen() will handle this for us. */
    1.18 -        [ qz_window setLevel:NSNormalWindowLevel ];
    1.19 -
    1.20          if ( ! QZ_SetupOpenGL (this, bpp, flags) ) {
    1.21              goto ERR_NO_GL;
    1.22          }
    1.23 @@ -542,13 +541,22 @@
    1.24          [ [ qz_window contentView ] addSubview:window_view ];	
    1.25          [ window_view release ];
    1.26  
    1.27 +#ifdef __powerpc__  /* there's a Cocoa API for this in 10.3 */
    1.28 +        /* CGLSetFullScreen() will handle this for us. */
    1.29 +        [ qz_window setLevel:NSNormalWindowLevel ];
    1.30 +
    1.31          ctx = QZ_GetCGLContextObj (gl_context);
    1.32          err = CGLSetFullScreen (ctx);
    1.33 -
    1.34          if (err) {
    1.35              SDL_SetError ("Error setting OpenGL fullscreen: %s", CGLErrorString(err));
    1.36              goto ERR_NO_GL;
    1.37          }
    1.38 +#else
    1.39 +        [ qz_window setLevel:CGShieldingWindowLevel() ];
    1.40 +        [ gl_context setView:window_view ];
    1.41 +        [ gl_context setFullScreen ];
    1.42 +        [ gl_context update ];
    1.43 +#endif
    1.44  
    1.45          [ gl_context makeCurrentContext];
    1.46