comparison src/video/cocoa/SDL_cocoaopengl.m @ 5254:7a963be087ef

Mostly fixed fullscreen mode on Mac OS X, and you can toggle it on and off. There are still some problems with the ConvertNSRect() calculations when switching video modes, which causes wierd window positioning issues, and the fullscreen window is still minimized on exit.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 11 Feb 2011 00:25:44 -0800
parents 58265e606e4e
children b530ef003506
comparison
equal deleted inserted replaced
5253:ff2564c24045 5254:7a963be087ef
79 NSOpenGLContext *context; 79 NSOpenGLContext *context;
80 int i = 0; 80 int i = 0;
81 81
82 pool = [[NSAutoreleasePool alloc] init]; 82 pool = [[NSAutoreleasePool alloc] init];
83 83
84 #ifndef FULLSCREEN_TOGGLEABLE
84 if (window->flags & SDL_WINDOW_FULLSCREEN) { 85 if (window->flags & SDL_WINDOW_FULLSCREEN) {
85 attr[i++] = NSOpenGLPFAFullScreen; 86 attr[i++] = NSOpenGLPFAFullScreen;
86 } 87 }
88 #endif
87 89
88 attr[i++] = NSOpenGLPFAColorSize; 90 attr[i++] = NSOpenGLPFAColorSize;
89 attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8; 91 attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8;
90 92
91 attr[i++] = NSOpenGLPFADepthSize; 93 attr[i++] = NSOpenGLPFADepthSize;
197 199
198 if (context) { 200 if (context) {
199 SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata; 201 SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata;
200 NSOpenGLContext *nscontext = (NSOpenGLContext *)context; 202 NSOpenGLContext *nscontext = (NSOpenGLContext *)context;
201 203
204 #ifndef FULLSCREEN_TOGGLEABLE
202 if (window->flags & SDL_WINDOW_FULLSCREEN) { 205 if (window->flags & SDL_WINDOW_FULLSCREEN) {
203 [nscontext setFullScreen]; 206 [nscontext setFullScreen];
204 } else { 207 } else
208 #endif
209 {
205 [nscontext setView:[windowdata->nswindow contentView]]; 210 [nscontext setView:[windowdata->nswindow contentView]];
206 [nscontext update]; 211 [nscontext update];
207 } 212 }
208 [nscontext makeCurrentContext]; 213 [nscontext makeCurrentContext];
209 } else { 214 } else {