Handle GUI quit correctly.
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user