Skip to content

Commit

Permalink
Fixed SDL 1.2 fullscreen OpenGL on Mac OS X 10.7.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
icculus committed Aug 10, 2011
1 parent 397599f commit ad8e59d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/video/quartz/SDL_QuartzVideo.m
Expand Up @@ -411,7 +411,9 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop)
if ( mode_flags & SDL_OPENGL ) {

QZ_TearDownOpenGL (this);
#ifdef __powerpc__ /* we only use this for pre-10.3 compatibility. */
CGLSetFullScreen (NULL);
#endif
}
if (to_desktop) {
ShowMenuBar ();
Expand Down Expand Up @@ -529,9 +531,6 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop)
CGLError err;
CGLContextObj ctx;

/* CGLSetFullScreen() will handle this for us. */
[ qz_window setLevel:NSNormalWindowLevel ];

if ( ! QZ_SetupOpenGL (this, bpp, flags) ) {
goto ERR_NO_GL;
}
Expand All @@ -542,13 +541,22 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop)
[ [ qz_window contentView ] addSubview:window_view ];
[ window_view release ];

#ifdef __powerpc__ /* there's a Cocoa API for this in 10.3 */
/* CGLSetFullScreen() will handle this for us. */
[ qz_window setLevel:NSNormalWindowLevel ];

ctx = QZ_GetCGLContextObj (gl_context);
err = CGLSetFullScreen (ctx);

if (err) {
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

[ gl_context makeCurrentContext];

Expand Down

0 comments on commit ad8e59d

Please sign in to comment.