Mercurial > sdl-ios-xcode
comparison src/video/quartz/SDL_QuartzVideo.m @ 3877:81f66f258d77 SDL-1.2
Fixed bug #281
------- Comment #2 From Christian Walther 2006-07-23 07:37 [reply] -------
Wow, that was an interesting bug to chase. It was a timing issue: it seems that
for some reason, a certain time must pass between ShowMenuBar() being called in
QZ_UnsetVideoMode() and the application quitting. Before rev. 1885, this delay
was provided by the slow hand-coded fade. With the asynchronous Core Graphics
fading introduced in rev. 1885, that delay was no longer present (most of the
time) and the bug became apparent. Adding an SDL_Delay(100) somewhere between
ShowMenuBar() and the end of QZ_VideoQuit() lowered the frequency of the bug
appearing from "almost every time" to "very rarely" here.
However, there is another solution: doing the ShowMenuBar() before releasing
the captured display instead of afterwards. Apparently, no delay is necessary
in that case, and it looks nicer to me anyway because it is the reverse order
of the way things are set up in the beginning: capture display - set video mode
- hide menu bar - ... - show menu bar - reset video mode - release captured
display. So, this is what the attached patch does.
In addition, I've taken the liberty of
- removing some unused code that I forgot to remove in rev. 1885,
- fixing two warnings about undeclared functions in SDL_QuartzVideo.m by
including OpenGL.h (whose name is a bit misleading - it only declares CGL
stuff, so there's no interference with SDL_opengl.h).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 24 Sep 2006 01:27:40 +0000 |
parents | eed7a3f396ce |
children | c5c3c772f5aa |
comparison
equal
deleted
inserted
replaced
3876:cf4744dbb1cf | 3877:81f66f258d77 |
---|---|
39 - (void) setFrame:(NSRect)frame; | 39 - (void) setFrame:(NSRect)frame; |
40 { | 40 { |
41 _frame = frame; | 41 _frame = frame; |
42 } | 42 } |
43 @end | 43 @end |
44 | |
45 | |
46 /* | |
47 Structure for rez switch gamma fades | |
48 We can hide the monitor flicker by setting the gamma tables to 0 | |
49 */ | |
50 #define QZ_GAMMA_TABLE_SIZE 256 | |
51 | |
52 typedef struct { | |
53 | |
54 CGGammaValue red[QZ_GAMMA_TABLE_SIZE]; | |
55 CGGammaValue green[QZ_GAMMA_TABLE_SIZE]; | |
56 CGGammaValue blue[QZ_GAMMA_TABLE_SIZE]; | |
57 | |
58 } SDL_QuartzGammaTable; | |
59 | 44 |
60 | 45 |
61 /* Bootstrap functions */ | 46 /* Bootstrap functions */ |
62 static int QZ_Available (); | 47 static int QZ_Available (); |
63 static SDL_VideoDevice* QZ_CreateDevice (int device_index); | 48 static SDL_VideoDevice* QZ_CreateDevice (int device_index); |
383 | 368 |
384 QZ_TearDownOpenGL (this); | 369 QZ_TearDownOpenGL (this); |
385 CGLSetFullScreen (NULL); | 370 CGLSetFullScreen (NULL); |
386 } | 371 } |
387 if (to_desktop) { | 372 if (to_desktop) { |
373 ShowMenuBar (); | |
388 /* Restore original screen resolution/bpp */ | 374 /* Restore original screen resolution/bpp */ |
389 CGDisplaySwitchToMode (display_id, save_mode); | 375 CGDisplaySwitchToMode (display_id, save_mode); |
390 CGReleaseAllDisplays (); | 376 CGReleaseAllDisplays (); |
391 ShowMenuBar (); | |
392 /* | 377 /* |
393 Reset the main screen's rectangle | 378 Reset the main screen's rectangle |
394 See comment in QZ_SetVideoFullscreen for why we do this | 379 See comment in QZ_SetVideoFullscreen for why we do this |
395 */ | 380 */ |
396 screen_rect = NSMakeRect(0,0,device_width,device_height); | 381 screen_rect = NSMakeRect(0,0,device_width,device_height); |