summaryrefslogtreecommitdiffstats
path: root/libvo/vo_corevideo.m
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-07-25 17:06:41 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:14:46 +0200
commit902417b9999cda96ee47e07c6e4e299d78356469 (patch)
treed622bdff8e79722a0be88b24b4d1696fb294d160 /libvo/vo_corevideo.m
parent5a1689d89423343b1fd6ce9537940956361c20fe (diff)
downloadmpv-902417b9999cda96ee47e07c6e4e299d78356469.tar.bz2
mpv-902417b9999cda96ee47e07c6e4e299d78356469.tar.xz
vo_corevideo: Make the Quit menu entry work
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31824 b3059339-0415-0410-9bf9-f77b7e298cf2
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