[MPlayer-cvslog] r31824 - trunk/libvo/vo_corevideo.m
reimar
subversion at mplayerhq.hu
Sun Jul 25 19:06:41 CEST 2010
Author: reimar
Date: Sun Jul 25 19:06:41 2010
New Revision: 31824
Log:
Make the Quit menu entry work.
Modified:
trunk/libvo/vo_corevideo.m
Modified: trunk/libvo/vo_corevideo.m
==============================================================================
--- trunk/libvo/vo_corevideo.m Sun Jul 25 19:00:04 2010 (r31823)
+++ trunk/libvo/vo_corevideo.m Sun Jul 25 19:06:41 2010 (r31824)
@@ -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, voi
// KEY_CLOSE_WIN handler is disabled
return NO;
}
+
+- (void)handleQuitEvent:(NSAppleEventDescriptor*)e withReplyEvent:(NSAppleEventDescriptor*)r
+{
+ mplayer_put_key(KEY_CLOSE_WIN);
+}
@end
More information about the MPlayer-cvslog
mailing list