comparison src/video/cocoa/SDL_cocoaevents.m @ 3624:9b1af1049f66

Merged r4866:4867 from branches/SDL-1.2: 64-bit Mac OS X 10.5 SDK fix.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 10 Jan 2010 05:39:46 +0000
parents e7eec78e4b92
children 4c5ab6841fdc
comparison
equal deleted inserted replaced
3623:9a73fecd9181 3624:9b1af1049f66
23 #include "SDL_timer.h" 23 #include "SDL_timer.h"
24 24
25 #include "SDL_cocoavideo.h" 25 #include "SDL_cocoavideo.h"
26 #include "../../events/SDL_events_c.h" 26 #include "../../events/SDL_events_c.h"
27 27
28 #if !defined(UsrActivity) && defined(__LP64__) && !defined(__POWER__)
29 /*
30 * Workaround for a bug in the 10.5 SDK: By accident, OSService.h does
31 * not include Power.h at all when compiling in 64bit mode. This has
32 * been fixed in 10.6, but for 10.5, we manually define UsrActivity
33 * to ensure compilation works.
34 */
35 #define UsrActivity 1
36 #endif
28 37
29 /* setAppleMenu disappeared from the headers in 10.4 */ 38 /* setAppleMenu disappeared from the headers in 10.4 */
30 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 39 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
31 @interface NSApplication(NSAppleMenu) 40 @interface NSApplication(NSAppleMenu)
32 - (void)setAppleMenu:(NSMenu *)menu; 41 - (void)setAppleMenu:(NSMenu *)menu;
165 Cocoa_PumpEvents(_THIS) 174 Cocoa_PumpEvents(_THIS)
166 { 175 {
167 NSAutoreleasePool *pool; 176 NSAutoreleasePool *pool;
168 177
169 /* Update activity every 30 seconds to prevent screensaver */ 178 /* Update activity every 30 seconds to prevent screensaver */
170 /* FIXME: This define isn't available with 64-bit Mac OS X? */
171 #ifdef UsrActivity
172 if (_this->suspend_screensaver) { 179 if (_this->suspend_screensaver) {
173 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; 180 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
174 Uint32 now = SDL_GetTicks(); 181 Uint32 now = SDL_GetTicks();
175 if (!data->screensaver_activity || 182 if (!data->screensaver_activity ||
176 (int)(now-data->screensaver_activity) >= 30000) { 183 (int)(now-data->screensaver_activity) >= 30000) {
177 UpdateSystemActivity(UsrActivity); 184 UpdateSystemActivity(UsrActivity);
178 data->screensaver_activity = now; 185 data->screensaver_activity = now;
179 } 186 }
180 } 187 }
181 #endif
182 188
183 pool = [[NSAutoreleasePool alloc] init]; 189 pool = [[NSAutoreleasePool alloc] init];
184 while ([NSApp isRunning]) { 190 while ([NSApp isRunning]) {
185 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 191 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
186 if ( event == nil ) { 192 if ( event == nil ) {