Skip to content

Commit

Permalink
add our own Apple Event handler for the quit app event, fixes #16200
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76392 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
  • Loading branch information
csomor committed Apr 22, 2014
1 parent fe49efa commit 60578d6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/osx/cocoa/utils.mm
Expand Up @@ -60,7 +60,10 @@ - (void)applicationWillFinishLaunching:(NSNotification *)application

[appleEventManager setEventHandler:self andSelector:@selector(handleOpenAppEvent:withReplyEvent:)
forEventClass:kCoreEventClass andEventID:kAEOpenApplication];


[appleEventManager setEventHandler:self andSelector:@selector(handleQuitAppEvent:withReplyEvent:)
forEventClass:kCoreEventClass andEventID:kAEQuitApplication];

wxTheApp->OSXOnWillFinishLaunching();
}

Expand Down Expand Up @@ -134,6 +137,16 @@ - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
wxTheApp->OSXStoreOpenURL(cf.AsString());
}

- (void)handleQuitAppEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
if ( wxTheApp->OSXOnShouldTerminate() )
{
wxTheApp->OSXOnWillTerminate();
wxTheApp->ExitMainLoop();
}
}

- (void)handleOpenAppEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
Expand Down

0 comments on commit 60578d6

Please sign in to comment.