diff options
author | der richter <der.richter@gmx.de> | 2020-02-15 16:13:37 +0100 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2020-02-22 13:56:31 +0100 |
commit | b8f2811f8d180d4c2a39aabc046440c900652bb4 (patch) | |
tree | 6be8c67b9a0a1c5a172f561ceab389e55eb19791 /osdep/macosx_application.m | |
parent | c1d744328e737fe80ecfdc0cbb6260d7699f4328 (diff) | |
download | mpv-b8f2811f8d180d4c2a39aabc046440c900652bb4.tar.bz2 mpv-b8f2811f8d180d4c2a39aabc046440c900652bb4.tar.xz |
mac: fix media key support for libmpv users
this basically moves the remote command center to our mac events instead
of keeping it our Application, which is only available when started from
mpv itself. also make it independent of the NSApplication.
this also prevents a runtime crash
Diffstat (limited to 'osdep/macosx_application.m')
-rw-r--r-- | osdep/macosx_application.m | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 7d42ca2a41..958b67b948 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -107,7 +107,6 @@ static void terminate_cocoa_application(void) @synthesize menuBar = _menu_bar; @synthesize openCount = _open_count; @synthesize cocoaCB = _cocoa_cb; -@synthesize remoteCommandCenter = _remoteCommandCenter; - (void)sendEvent:(NSEvent *)event { @@ -175,12 +174,6 @@ static const char macosx_icon[] = if ([self respondsToSelector:@selector(touchBar)]) [(TouchBar *)self.touchBar processEvent:event]; #endif -#if HAVE_MACOS_MEDIA_PLAYER - // 10.12.2 runtime availability check - if ([self respondsToSelector:@selector(touchBar)]) { - [_remoteCommandCenter processEvent:event]; - } -#endif if (_cocoa_cb) { [_cocoa_cb processEvent:event]; } @@ -208,11 +201,6 @@ static const char macosx_icon[] = [_eventsResponder queueCommand:cmd]; } -- (void)handleMPKey:(int)key withMask:(int)mask -{ - [_eventsResponder handleMPKey:key withMask:mask]; -} - - (void)stopMPV:(char *)cmd { if (![_eventsResponder queueCommand:cmd]) @@ -228,11 +216,6 @@ static const char macosx_icon[] = andEventID:kAEQuitApplication]; } -- (void)applicationWillBecomeActive:(NSNotification *)notification -{ - [_remoteCommandCenter makeCurrent]; -} - - (void)handleQuitEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { @@ -307,13 +290,6 @@ static void init_cocoa_application(bool regular) [NSApp setDelegate:NSApp]; [NSApp setMenuBar:[[MenuBar alloc] init]]; -#if HAVE_MACOS_MEDIA_PLAYER - // 10.12.2 runtime availability check - if ([NSApp respondsToSelector:@selector(touchBar)]) { - [NSApp setRemoteCommandCenter:[[RemoteCommandCenter alloc] initWithApp:NSApp]]; - } -#endif - // Will be set to Regular from cocoa_common during UI creation so that we // don't create an icon when playing audio only files. [NSApp setActivationPolicy: regular ? |