mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 00:07:33 +00:00
vo_corevideo: Make the Quit menu entry work
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31824 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
5a1689d894
commit
902417b999
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user