[vlc-commits] macosx: Try to fix volume buttons with apple remote on 10.13

David Fuhrmann git at videolan.org
Mon Oct 16 19:18:47 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Mon Oct 16 19:00:49 2017 +0200| [6021599dd6b39426b353e67fd6073d6d68353ef4] | committer: David Fuhrmann

macosx: Try to fix volume buttons with apple remote on 10.13

macOS High Sierra remapped the volume up / down buttons on the
apple remote. This patch tries to fix that by adding the new
cookies.

refs #18894

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6021599dd6b39426b353e67fd6073d6d68353ef4
---

 modules/gui/macosx/AppleRemote.m        | 5 +++++
 modules/gui/macosx/CompatibilityFixes.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/modules/gui/macosx/AppleRemote.m b/modules/gui/macosx/AppleRemote.m
index 3850dff95d..452a1e5d22 100644
--- a/modules/gui/macosx/AppleRemote.m
+++ b/modules/gui/macosx/AppleRemote.m
@@ -89,6 +89,11 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
         [mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonFullscreen] forKey:@"33_21_20_3_2_33_21_20_3_2_"];
         [mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched]     forKey:@"42_33_23_21_20_2_33_23_21_20_2_"];
 
+        if (OSX_HIGH_SIERRA_AND_HIGHER) {
+            [mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus]    forKey:@"33_21_20_15_12_2_"];
+            [mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus]   forKey:@"33_21_20_16_12_2_"];
+        }
+
         _cookieToButtonMapping = [[NSDictionary alloc] initWithDictionary: mutableCookieToButtonMapping];
 
         /* defaults */
diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h
index 1f62d71187..069aefd8d7 100644
--- a/modules/gui/macosx/CompatibilityFixes.h
+++ b/modules/gui/macosx/CompatibilityFixes.h
@@ -32,6 +32,8 @@
 #define OSX_YOSEMITE_AND_HIGHER (NSAppKitVersionNumber >= 1334)
 #define OSX_EL_CAPITAN_AND_HIGHER (NSAppKitVersionNumber >= 1404)
 #define OSX_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1485)
+#define OSX_HIGH_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1560)
+
 
 // Sierra only APIs
 #ifndef MAC_OS_X_VERSION_10_12



More information about the vlc-commits mailing list