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

* backport some Apple Remote fixes

parent e6d0343f
/*****************************************************************************
* AppleRemote.h
* AppleRemote
* $Id:$
* $Id$
*
* Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved.
......@@ -28,7 +28,7 @@
*
* 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
* 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.
* Thus, the following statements apply to our changes:
*
......
/*****************************************************************************
* AppleRemote.m
* AppleRemote
* $Id:$
* $Id$
*
* Created by Martin Kahr on 11.03.06 under a MIT-style license.
* Copyright (c) 2006 martinkahr.com. All rights reserved.
......@@ -28,7 +28,7 @@
*
* 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
* 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.
* Thus, the following statements apply to our changes:
*
......
......@@ -714,6 +714,28 @@ static VLCMain *_o_sharedMainInstance = nil;
[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 */
- (void)appleRemoteButton:(AppleRemoteEventIdentifier)buttonIdentifier
pressedDown:(BOOL)pressedDown
......@@ -724,10 +746,20 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_controls play: self];
break;
case kRemoteButtonVolume_Plus:
/* 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;
case kRemoteButtonVolume_Minus:
/* 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;
case kRemoteButtonRight:
[o_controls next: self];
......@@ -736,15 +768,19 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_controls prev: self];
break;
case kRemoteButtonRight_Hold:
[o_controls forward: self];
break;
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;
case kRemoteButtonMenu:
[o_controls windowAction: self];
break;
default:
/* Add here whatever you want other buttons to do */
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