[vlc-devel] [PATCH] Use the additional middle button on the new Apple Remote introduced in 2009 to toggle fullscreen
David K
coding at rotinaj.org
Tue Feb 2 14:08:15 CET 2010
---
modules/gui/macosx/AppleRemote.h | 2 +-
modules/gui/macosx/AppleRemote.m | 12 ++----------
modules/gui/macosx/intf.m | 6 ++++++
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/modules/gui/macosx/AppleRemote.h b/modules/gui/macosx/AppleRemote.h
index 7e9c84c..12e8ca3 100644
--- a/modules/gui/macosx/AppleRemote.h
+++ b/modules/gui/macosx/AppleRemote.h
@@ -75,7 +75,7 @@ enum AppleRemoteEventIdentifier
kRemoteButtonVolume_Plus_Hold =1<<12,
kRemoteButtonVolume_Minus_Hold =1<<13,
k2009RemoteButtonPlay =1<<14,
- k2009RemoteButtonMiddlePlay =1<<15
+ k2009RemoteButtonFullscreen =1<<15
};
typedef enum AppleRemoteEventIdentifier AppleRemoteEventIdentifier;
diff --git a/modules/gui/macosx/AppleRemote.m b/modules/gui/macosx/AppleRemote.m
index 623b16e..6f41bae 100644
--- a/modules/gui/macosx/AppleRemote.m
+++ b/modules/gui/macosx/AppleRemote.m
@@ -104,7 +104,7 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonPlay] forKey:@"33_21_20_8_2_33_21_20_8_2_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonMiddlePlay] forKey:@"33_21_20_3_2_33_21_20_3_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonFullscreen] forKey:@"33_21_20_3_2_33_21_20_3_2_"];
}
}
@@ -173,7 +173,7 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
}
- (void) setClickCountingEnabled: (BOOL) value {
if (value) {
- [self setClickCountEnabledButtons: kRemoteButtonVolume_Plus | kRemoteButtonVolume_Minus | kRemoteButtonPlay | kRemoteButtonLeft | kRemoteButtonRight | kRemoteButtonMenu | k2009RemoteButtonPlay | k2009RemoteButtonMiddlePlay];
+ [self setClickCountEnabledButtons: kRemoteButtonVolume_Plus | kRemoteButtonVolume_Minus | kRemoteButtonPlay | kRemoteButtonLeft | kRemoteButtonRight | kRemoteButtonMenu | k2009RemoteButtonPlay | k2009RemoteButtonFullscreen];
} else {
[self setClickCountEnabledButtons: 0];
}
@@ -454,14 +454,6 @@ static AppleRemote* sharedInstance=nil;
if (cookieString == nil || [cookieString length] == 0) return;
NSNumber* buttonId = [[self cookieToButtonMapping] objectForKey: cookieString];
if (buttonId != nil) {
- switch ([buttonId intValue]) {
- case k2009RemoteButtonPlay:
- case k2009RemoteButtonMiddlePlay:
- buttonId = [NSNumber numberWithInt:kRemoteButtonPlay];
- break;
- default:
- break;
- }
[self sendRemoteButtonEvent: [buttonId intValue] pressedDown: (sumOfValues>0)];
} else {
// let's see if a number of events are stored in the cookie string. this does
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index ed1dc37..6af6b1b 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1114,6 +1114,12 @@ static NSString * VLCToolbarMediaControl = @"VLCToolbarMediaControl";
{
switch( buttonIdentifier )
{
+ case k2009RemoteButtonFullscreen:
+ [o_controls toogleFullscreen:self];
+ break;
+ case k2009RemoteButtonPlay:
+ [o_controls play:self];
+ break;
case kRemoteButtonPlay:
if(count >= 2) {
[o_controls toogleFullscreen:self];
--
1.6.5.5
More information about the vlc-devel
mailing list