summaryrefslogtreecommitdiffstats
path: root/libvo/vo_corevideo.m
diff options
context:
space:
mode:
Diffstat (limited to 'libvo/vo_corevideo.m')
-rw-r--r--libvo/vo_corevideo.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index dd82355f86..3d489299c1 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -401,6 +401,15 @@ static int preinit(const char *arg)
mpGLView = [[MPlayerOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) pixelFormat:[MPlayerOpenGLView defaultPixelFormat]];
[mpGLView autorelease];
}
+ // Install an event handler so the Quit menu entry works
+ // The proper way using NSApp setDelegate: and
+ // applicationShouldTerminate: does not work,
+ // probably NSApplication never installs its handler.
+ [[NSAppleEventManager sharedAppleEventManager]
+ setEventHandler:mpGLView
+ andSelector:@selector(handleQuitEvent:withReplyEvent:)
+ forEventClass:kCoreEventClass
+ andEventID:kAEQuitApplication];
[mpGLView display];
[mpGLView preinit];
@@ -1040,4 +1049,9 @@ static int control(uint32_t request, void *data)
// KEY_CLOSE_WIN handler is disabled
return NO;
}
+
+- (void)handleQuitEvent:(NSAppleEventDescriptor*)e withReplyEvent:(NSAppleEventDescriptor*)r
+{
+ mplayer_put_key(KEY_CLOSE_WIN);
+}
@end