233 } |
233 } |
234 |
234 |
235 void |
235 void |
236 Cocoa_InitModes(_THIS) |
236 Cocoa_InitModes(_THIS) |
237 { |
237 { |
|
238 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
238 CGDisplayErr result; |
239 CGDisplayErr result; |
239 CGDirectDisplayID *displays; |
240 CGDirectDisplayID *displays; |
240 CGDisplayCount numDisplays; |
241 CGDisplayCount numDisplays; |
241 int pass, i; |
242 int pass, i; |
242 |
243 |
243 result = CGGetOnlineDisplayList(0, NULL, &numDisplays); |
244 result = CGGetOnlineDisplayList(0, NULL, &numDisplays); |
244 if (result != kCGErrorSuccess) { |
245 if (result != kCGErrorSuccess) { |
245 CG_SetError("CGGetOnlineDisplayList()", result); |
246 CG_SetError("CGGetOnlineDisplayList()", result); |
|
247 [pool release]; |
246 return; |
248 return; |
247 } |
249 } |
248 displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays); |
250 displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays); |
249 result = CGGetOnlineDisplayList(numDisplays, displays, &numDisplays); |
251 result = CGGetOnlineDisplayList(numDisplays, displays, &numDisplays); |
250 if (result != kCGErrorSuccess) { |
252 if (result != kCGErrorSuccess) { |
251 CG_SetError("CGGetOnlineDisplayList()", result); |
253 CG_SetError("CGGetOnlineDisplayList()", result); |
252 SDL_stack_free(displays); |
254 SDL_stack_free(displays); |
|
255 [pool release]; |
253 return; |
256 return; |
254 } |
257 } |
255 |
258 |
256 /* Pick up the primary display in the first pass, then get the rest */ |
259 /* Pick up the primary display in the first pass, then get the rest */ |
257 for (pass = 0; pass < 2; ++pass) { |
260 for (pass = 0; pass < 2; ++pass) { |
311 display.driverdata = displaydata; |
314 display.driverdata = displaydata; |
312 SDL_AddVideoDisplay(&display); |
315 SDL_AddVideoDisplay(&display); |
313 } |
316 } |
314 } |
317 } |
315 SDL_stack_free(displays); |
318 SDL_stack_free(displays); |
|
319 [pool release]; |
316 } |
320 } |
317 |
321 |
318 int |
322 int |
319 Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) |
323 Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) |
320 { |
324 { |