From 1da88c2ee0d9898d7e8025b9fd9a97fc580c2df7 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 10 Aug 2011 01:25:00 -0400 Subject: [PATCH] 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. --HG-- branch : SDL-1.2 --- src/video/quartz/SDL_QuartzVideo.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/video/quartz/SDL_QuartzVideo.m b/src/video/quartz/SDL_QuartzVideo.m index 17d780401..651d62c1b 100644 --- a/src/video/quartz/SDL_QuartzVideo.m +++ b/src/video/quartz/SDL_QuartzVideo.m @@ -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 (); @@ -529,9 +531,6 @@ static SDL_Surface* QZ_SetVideoFullScreen (_THIS, SDL_Surface *current, int widt CGLError err; CGLContextObj ctx; - /* CGLSetFullScreen() will handle this for us. */ - [ qz_window setLevel:NSNormalWindowLevel ]; - if ( ! QZ_SetupOpenGL (this, bpp, flags) ) { goto ERR_NO_GL; } @@ -542,13 +541,22 @@ static SDL_Surface* QZ_SetVideoFullScreen (_THIS, SDL_Surface *current, int widt [ [ 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];