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

David Fuhrmann git at videolan.org
Tue Oct 17 23:14:23 CEST 2017


vlc/vlc-2.2 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Mon Oct 16 19:00:49 2017 +0200| [3f792a7d419eee76e4816f3752d704e5cc721b62] | 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

(cherry picked from commit 6021599dd6b39426b353e67fd6073d6d68353ef4)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=3f792a7d419eee76e4816f3752d704e5cc721b62
---

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

diff --git a/modules/gui/macosx/AppleRemote.m b/modules/gui/macosx/AppleRemote.m
index 6bb9a07b71..971cc13259 100644
--- a/modules/gui/macosx/AppleRemote.m
+++ b/modules/gui/macosx/AppleRemote.m
@@ -106,6 +106,11 @@ static AppleRemote *_o_sharedInstance = nil;
         /* Lion cookies */
             [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];
         [mutableCookieToButtonMapping release];
 
diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h
index 56cb4e2942..70232de3a8 100644
--- a/modules/gui/macosx/CompatibilityFixes.h
+++ b/modules/gui/macosx/CompatibilityFixes.h
@@ -31,6 +31,7 @@
 #define OSX_MAVERICKS (NSAppKitVersionNumber < 1334 && NSAppKitVersionNumber >= 1244)
 #define OSX_YOSEMITE (NSAppKitVersionNumber < 1404 && NSAppKitVersionNumber >= 1334)
 #define OSX_EL_CAPITAN (NSAppKitVersionNumber >= 1404)
+#define OSX_HIGH_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1560)
 
 #pragma mark -
 #pragma Fixes for OS X Snow Leopard (10.6)



More information about the vlc-commits mailing list