# HG changeset patch # User reimar # Date 1280077601 0 # Node ID 0577595394f8643656f53f2cb37f599af3150cda # Parent 83423e6b288ef1b5fb101bf4ea4e518ea831c8c4 Make the Quit menu entry work. diff -r 83423e6b288e -r 0577595394f8 libvo/vo_corevideo.m --- a/libvo/vo_corevideo.m Sun Jul 25 17:00:04 2010 +0000 +++ b/libvo/vo_corevideo.m Sun Jul 25 17:06:41 2010 +0000 @@ -401,6 +401,15 @@ 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 @@ // KEY_CLOSE_WIN handler is disabled return NO; } + +- (void)handleQuitEvent:(NSAppleEventDescriptor*)e withReplyEvent:(NSAppleEventDescriptor*)r +{ + mplayer_put_key(KEY_CLOSE_WIN); +} @end