summaryrefslogtreecommitdiffstats
path: root/osdep/macosx_application.m
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/macosx_application.m')
-rw-r--r--osdep/macosx_application.m14
1 files changed, 10 insertions, 4 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index d31269279e..bd48398965 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -101,6 +101,8 @@ static void terminate_cocoa_application(void)
NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager];
[em removeEventHandlerForEventClass:kInternetEventClass
andEventID:kAEGetURL];
+ [em removeEventHandlerForEventClass:kCoreEventClass
+ andEventID:kAEQuitApplication];
[super dealloc];
}
@@ -206,13 +208,17 @@ static void terminate_cocoa_application(void)
return [item autorelease];
}
-- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)theApp
+- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
- return NSTerminateNow;
+ NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager];
+ [em setEventHandler:self
+ andSelector:@selector(handleQuitEvent:withReplyEvent:)
+ forEventClass:kCoreEventClass
+ andEventID:kAEQuitApplication];
}
-- (void)handleQuitEvent:(NSAppleEventDescriptor*)e
- withReplyEvent:(NSAppleEventDescriptor*)r
+- (void)handleQuitEvent:(NSAppleEventDescriptor *)event
+ withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
[self stopPlayback];
}