Handle GUI quit correctly.

This commit is contained in:
Steve Checkoway
2006-01-18 08:17:39 +00:00
parent fb0cb6b183
commit 635564b3fa
+8 -6
View File
@@ -21,6 +21,7 @@
}
- (id) initWithArgc:(int)argc argv:(char **)argv;
- (void) startGame:(id)sender;
- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender;
@end
@@ -29,11 +30,6 @@
{
ArchHooks::SetToggleWindowed();
}
// Invoked from the Quit menu item.
- (void)terminate:(id)sender
{
ArchHooks::SetUserQuit();
}
- (void)sendEvent:(NSEvent *)event
{
@@ -66,6 +62,12 @@
{
[NSThread detachNewThreadSelector:@selector(startGame:) toTarget:self withObject:nil];
}
- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
{
ArchHooks::SetUserQuit();
return NSTerminateCancel;
}
@end
static void HandleNSException( NSException *exception )
@@ -132,7 +134,7 @@ int main( int argc, char **argv )
[SMApplication poseAsClass:[NSApplication class]];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SMMain *sm;
SMMain *sm;
// Ensure the application object is initialised, this sets NSApp.
[SMApplication sharedApplication];