comparison src/video/cocoa/SDL_cocoamodes.m @ 3246:c843261f74a4

From: Jjgod Jiang <gzjjgod@gmail.com> Date: Sat, 5 Sep 2009 17:27:07 +0800 Disable NSScreen setFrame: hack in 10.6 since it no longer work
author Sam Lantinga <slouken@libsdl.org>
date Sat, 05 Sep 2009 09:54:45 +0000
parents 99210400e8b9
children cde30895105d
comparison
equal deleted inserted replaced
3245:d984d5bb17e9 3246:c843261f74a4
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 #include "SDL_cocoavideo.h" 24 #include "SDL_cocoavideo.h"
25 25
26 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
26 /* 27 /*
27 Add methods to get at private members of NSScreen. 28 Add methods to get at private members of NSScreen.
28 Since there is a bug in Apple's screen switching code 29 Since there is a bug in Apple's screen switching code
29 that does not update this variable when switching 30 that does not update this variable when switching
30 to fullscreen, we'll set it manually (but only for the 31 to fullscreen, we'll set it manually (but only for the
38 - (void) setFrame:(NSRect)frame; 39 - (void) setFrame:(NSRect)frame;
39 { 40 {
40 _frame = frame; 41 _frame = frame;
41 } 42 }
42 @end 43 @end
44 #endif
43 45
44 static void 46 static void
45 CG_SetError(const char *prefix, CGDisplayErr result) 47 CG_SetError(const char *prefix, CGDisplayErr result)
46 { 48 {
47 const char *error; 49 const char *error;
246 if (fade_token != kCGDisplayFadeReservationInvalidToken) { 248 if (fade_token != kCGDisplayFadeReservationInvalidToken) {
247 CGDisplayFade(fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE); 249 CGDisplayFade(fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE);
248 CGReleaseDisplayFadeReservation(fade_token); 250 CGReleaseDisplayFadeReservation(fade_token);
249 } 251 }
250 252
253 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
251 /* 254 /*
252 There is a bug in Cocoa where NSScreen doesn't synchronize 255 There is a bug in Cocoa where NSScreen doesn't synchronize
253 with CGDirectDisplay, so the main screen's frame is wrong. 256 with CGDirectDisplay, so the main screen's frame is wrong.
254 As a result, coordinate translation produces incorrect results. 257 As a result, coordinate translation produces incorrect results.
255 We can hack around this bug by setting the screen rect 258 We can hack around this bug by setting the screen rect
256 ourselves. This hack should be removed if/when the bug is fixed. 259 ourselves. This hack should be removed if/when the bug is fixed.
257 */ 260 */
258 [[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)]; 261 [[NSScreen mainScreen] setFrame:NSMakeRect(0,0,mode->w,mode->h)];
262 #endif
259 263
260 return 0; 264 return 0;
261 265
262 /* Since the blanking window covers *all* windows (even force quit) correct recovery is crucial */ 266 /* Since the blanking window covers *all* windows (even force quit) correct recovery is crucial */
263 ERR_NO_SWITCH: 267 ERR_NO_SWITCH: