From 902417b9999cda96ee47e07c6e4e299d78356469 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Jul 2010 17:06:41 +0000 Subject: vo_corevideo: Make the Quit menu entry work git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31824 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_corevideo.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libvo/vo_corevideo.m') 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 -- cgit v1.2.3