From 8a6ee7fe947bb01a49beb38152cedb1e1b206ed2 Mon Sep 17 00:00:00 2001 From: der richter Date: Sat, 16 Nov 2019 16:54:07 +0100 Subject: mac: remove Apple Remote support the Apple Remote has long been deprecated and abandoned by Apple. current macs don't come with support for it anymore. support might be re-added with the next commit. --- osdep/macosx_events.m | 65 --------------------------------------------------- 1 file changed, 65 deletions(-) (limited to 'osdep/macosx_events.m') diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index 68956de43e..14aa7063fb 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -50,17 +50,12 @@ BOOL _is_application; NSCondition *_input_lock; CFMachPortRef _mk_tap_port; -#if HAVE_APPLE_REMOTE - HIDRemote *_remote; -#endif } - (BOOL)handleMediaKey:(NSEvent *)event; - (NSEvent *)handleKey:(NSEvent *)event; - (BOOL)setMpvHandle:(struct mpv_handle *)ctx; - (void)readEvents; -- (void)startAppleRemote; -- (void)stopAppleRemote; - (void)startMediaKeys; - (void)restartMediaKeys; - (void)stopMediaKeys; @@ -126,16 +121,6 @@ static int convert_key(unsigned key, unsigned charcode) return charcode; } -void cocoa_init_apple_remote(void) -{ - [[EventsResponder sharedInstance] startAppleRemote]; -} - -void cocoa_uninit_apple_remote(void) -{ - [[EventsResponder sharedInstance] stopAppleRemote]; -} - static int mk_code(NSEvent *event) { return (([event data1] & 0xFFFF0000) >> 16); @@ -352,29 +337,6 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx) } } -- (void)startAppleRemote -{ -#if HAVE_APPLE_REMOTE - dispatch_async(dispatch_get_main_queue(), ^{ - self->_remote = [[HIDRemote alloc] init]; - if (self->_remote) { - [self->_remote setDelegate:self]; - [self->_remote startRemoteControl:kHIDRemoteModeExclusiveAuto]; - } - }); -#endif -} - -- (void)stopAppleRemote -{ -#if HAVE_APPLE_REMOTE - dispatch_async(dispatch_get_main_queue(), ^{ - [self->_remote stopRemoteControl]; - [self->_remote release]; - }); -#endif -} - - (void)restartMediaKeys { if (self->_mk_tap_port) @@ -448,33 +410,6 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx) andMapping:keymapd]; } -- (void)hidRemote:(HIDRemote *)remote - eventWithButton:(HIDRemoteButtonCode)buttonCode - isPressed:(BOOL)isPressed - fromHardwareWithAttributes:(NSMutableDictionary *)attributes -{ - if (!isPressed) return; - - NSDictionary *keymapd = @{ - @(kHIDRemoteButtonCodePlay): @(MP_AR_PLAY), - @(kHIDRemoteButtonCodePlayHold): @(MP_AR_PLAY_HOLD), - @(kHIDRemoteButtonCodeCenter): @(MP_AR_CENTER), - @(kHIDRemoteButtonCodeCenterHold): @(MP_AR_CENTER_HOLD), - @(kHIDRemoteButtonCodeLeft): @(MP_AR_PREV), - @(kHIDRemoteButtonCodeLeftHold): @(MP_AR_PREV_HOLD), - @(kHIDRemoteButtonCodeRight): @(MP_AR_NEXT), - @(kHIDRemoteButtonCodeRightHold): @(MP_AR_NEXT_HOLD), - @(kHIDRemoteButtonCodeMenu): @(MP_AR_MENU), - @(kHIDRemoteButtonCodeMenuHold): @(MP_AR_MENU_HOLD), - @(kHIDRemoteButtonCodeUp): @(MP_AR_VUP), - @(kHIDRemoteButtonCodeUpHold): @(MP_AR_VUP_HOLD), - @(kHIDRemoteButtonCodeDown): @(MP_AR_VDOWN), - @(kHIDRemoteButtonCodeDownHold): @(MP_AR_VDOWN_HOLD), - }; - - [self handleKey:buttonCode withMask:0 andMapping:keymapd]; -} - - (int)mapKeyModifiers:(int)cocoaModifiers { int mask = 0; -- cgit v1.2.3