Mercurial > sdl-ios-xcode
comparison src/video/cocoa/SDL_cocoaevents.m @ 1937:05e88d266921
Fixed Objective-C memory leaks
Send an SDL quit event when Command-Q is pressed.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 25 Jul 2006 06:59:14 +0000 |
parents | 83946ee0ff1f |
children | 25d6537feea4 |
comparison
equal
deleted
inserted
replaced
1936:83946ee0ff1f | 1937:05e88d266921 |
---|---|
32 | 32 |
33 @implementation NSApplication(SDL) | 33 @implementation NSApplication(SDL) |
34 - (void)setRunning | 34 - (void)setRunning |
35 { | 35 { |
36 _running = 1; | 36 _running = 1; |
37 } | |
38 @end | |
39 | |
40 @interface SDLAppDelegate : NSObject | |
41 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; | |
42 @end | |
43 | |
44 @implementation SDLAppDelegate : NSObject | |
45 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender | |
46 { | |
47 SDL_SendQuit(); | |
48 return NSTerminateCancel; | |
37 } | 49 } |
38 @end | 50 @end |
39 | 51 |
40 static NSString * | 52 static NSString * |
41 GetApplicationName(void) | 53 GetApplicationName(void) |
137 if ([NSApp mainMenu] == nil) { | 149 if ([NSApp mainMenu] == nil) { |
138 CreateApplicationMenus(); | 150 CreateApplicationMenus(); |
139 } | 151 } |
140 [NSApp finishLaunching]; | 152 [NSApp finishLaunching]; |
141 } | 153 } |
154 if ([NSApp delegate] == nil) { | |
155 [NSApp setDelegate:[[SDLAppDelegate alloc] init]]; | |
156 } | |
142 [NSApp setRunning]; | 157 [NSApp setRunning]; |
143 [pool release]; | 158 [pool release]; |
144 } | 159 } |
145 | 160 |
146 void | 161 void |