Mercurial > sdl-ios-xcode
comparison src/video/cocoa/SDL_cocoaevents.m @ 5281:15a71bec4a55
merged
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Sat, 12 Feb 2011 19:16:09 -0800 |
parents | e107518710f6 |
children |
comparison
equal
deleted
inserted
replaced
5219:adfcdd311ae0 | 5281:15a71bec4a55 |
---|---|
1 /* | 1 /* |
2 SDL - Simple DirectMedia Layer | 2 SDL - Simple DirectMedia Layer |
3 Copyright (C) 1997-2010 Sam Lantinga | 3 Copyright (C) 1997-2011 Sam Lantinga |
4 | 4 |
5 This library is free software; you can redistribute it and/or | 5 This library is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Lesser General Public | 6 modify it under the terms of the GNU Lesser General Public |
7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
8 version 2.1 of the License, or (at your option) any later version. | 8 version 2.1 of the License, or (at your option) any later version. |
38 /* setAppleMenu disappeared from the headers in 10.4 */ | 38 /* setAppleMenu disappeared from the headers in 10.4 */ |
39 @interface NSApplication(NSAppleMenu) | 39 @interface NSApplication(NSAppleMenu) |
40 - (void)setAppleMenu:(NSMenu *)menu; | 40 - (void)setAppleMenu:(NSMenu *)menu; |
41 @end | 41 @end |
42 | 42 |
43 @implementation NSApplication(SDL) | |
44 - (void)setRunning | |
45 { | |
46 _running = 1; | |
47 } | |
48 @end | |
49 | |
50 @interface SDLAppDelegate : NSObject | 43 @interface SDLAppDelegate : NSObject |
51 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; | 44 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; |
52 @end | 45 @end |
53 | 46 |
54 @implementation SDLAppDelegate : NSObject | 47 @implementation SDLAppDelegate : NSObject |
162 [NSApp finishLaunching]; | 155 [NSApp finishLaunching]; |
163 } | 156 } |
164 if ([NSApp delegate] == nil) { | 157 if ([NSApp delegate] == nil) { |
165 [NSApp setDelegate:[[SDLAppDelegate alloc] init]]; | 158 [NSApp setDelegate:[[SDLAppDelegate alloc] init]]; |
166 } | 159 } |
167 [NSApp setRunning]; | |
168 [pool release]; | 160 [pool release]; |
169 } | 161 } |
170 | 162 |
171 void | 163 void |
172 Cocoa_PumpEvents(_THIS) | 164 Cocoa_PumpEvents(_THIS) |
183 data->screensaver_activity = now; | 175 data->screensaver_activity = now; |
184 } | 176 } |
185 } | 177 } |
186 | 178 |
187 pool = [[NSAutoreleasePool alloc] init]; | 179 pool = [[NSAutoreleasePool alloc] init]; |
188 while ([NSApp isRunning]) { | 180 for ( ; ; ) { |
189 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; | 181 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; |
190 if ( event == nil ) { | 182 if ( event == nil ) { |
191 break; | 183 break; |
192 } | 184 } |
193 | 185 |