Commit 2bb5e235 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* backport some Apple Remote fixes

parent e6d0343f
/***************************************************************************** /*****************************************************************************
* AppleRemote.h * AppleRemote.h
* AppleRemote * AppleRemote
* $Id:$ * $Id$
* *
* Created by Martin Kahr on 11.03.06 under a MIT-style license. * Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved. * Copyright (c) 2006 martinkahr.com. All rights reserved.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
* Note that changes made by any members or contributors of the VideoLAN team * Note that changes made by any members or contributors of the VideoLAN team
* (i.e. changes that were checked in into one of VideoLAN's source code * (i.e. changes that were checked in into one of VideoLAN's source code
* repositories are licensed under the GNU General Public License version 2, * repositories) are licensed under the GNU General Public License version 2,
* or (at your option) any later version. * or (at your option) any later version.
* Thus, the following statements apply to our changes: * Thus, the following statements apply to our changes:
* *
......
/***************************************************************************** /*****************************************************************************
* AppleRemote.m * AppleRemote.m
* AppleRemote * AppleRemote
* $Id:$ * $Id$
* *
* Created by Martin Kahr on 11.03.06 under a MIT-style license. * Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved. * Copyright (c) 2006 martinkahr.com. All rights reserved.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
* Note that changes made by any members or contributors of the VideoLAN team * Note that changes made by any members or contributors of the VideoLAN team
* (i.e. changes that were checked in to one of VideoLAN's source code * (i.e. changes that were checked in to one of VideoLAN's source code
* repositories are licensed under the GNU General Public License version 2, * repositories) are licensed under the GNU General Public License version 2,
* or (at your option) any later version. * or (at your option) any later version.
* Thus, the following statements apply to our changes: * Thus, the following statements apply to our changes:
* *
......
...@@ -714,6 +714,28 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -714,6 +714,28 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_remote stopListening: self]; [o_remote stopListening: self];
} }
/* Helper method for the remote control interface in order to trigger forward/backward
as long as the user holds the left/right button */
- (void) triggerMovieStepForRemoteButton: (NSNumber*) buttonIdentifierNumber
{
if (b_left_right_remote_button_hold) {
switch([buttonIdentifierNumber intValue]) {
case kRemoteButtonRight_Hold:
[o_controls forward: self];
break;
case kRemoteButtonLeft_Hold:
[o_controls backward: self];
break;
}
if (b_left_right_remote_button_hold) {
/* trigger event */
[self performSelector:@selector(triggerMovieStepForRemoteButton:)
withObject:buttonIdentifierNumber
afterDelay:0.25];
}
}
}
/* Apple Remote callback */ /* Apple Remote callback */
- (void)appleRemoteButton:(AppleRemoteEventIdentifier)buttonIdentifier - (void)appleRemoteButton:(AppleRemoteEventIdentifier)buttonIdentifier
pressedDown:(BOOL)pressedDown pressedDown:(BOOL)pressedDown
...@@ -724,10 +746,20 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -724,10 +746,20 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_controls play: self]; [o_controls play: self];
break; break;
case kRemoteButtonVolume_Plus: case kRemoteButtonVolume_Plus:
[o_controls volumeUp: self]; /* there are two events when the plus or minus button is pressed
one when the button is pressed down and one when the button is released */
if( pressedDown )
{
[o_controls volumeUp: self];
}
break; break;
case kRemoteButtonVolume_Minus: case kRemoteButtonVolume_Minus:
[o_controls volumeDown: self]; /* there are two events when the plus or minus button is pressed
one when the button is pressed down and one when the button is released */
if( pressedDown )
{
[o_controls volumeDown: self];
}
break; break;
case kRemoteButtonRight: case kRemoteButtonRight:
[o_controls next: self]; [o_controls next: self];
...@@ -736,15 +768,19 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -736,15 +768,19 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_controls prev: self]; [o_controls prev: self];
break; break;
case kRemoteButtonRight_Hold: case kRemoteButtonRight_Hold:
[o_controls forward: self];
break;
case kRemoteButtonLeft_Hold: case kRemoteButtonLeft_Hold:
[o_controls backward: self]; /* simulate an event as long as the user holds the button */
b_left_right_remote_button_hold = pressedDown;
if( pressedDown )
{
NSNumber* buttonIdentifierNumber = [NSNumber numberWithInt: buttonIdentifier];
[self performSelector:@selector(triggerMovieStepForRemoteButton:)
withObject:buttonIdentifierNumber];
}
break; break;
case kRemoteButtonMenu: case kRemoteButtonMenu:
[o_controls windowAction: self]; [o_controls windowAction: self];
break; break;
default: default:
/* Add here whatever you want other buttons to do */ /* Add here whatever you want other buttons to do */
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment