[vlc-devel] [vlc-commits] macosx: replace all 'key-action' calls with their proper counter-parts

David Fuhrmann david.fuhrmann at gmail.com
Sun Feb 10 00:41:43 CET 2013


Am 07.02.2013 um 19:15 schrieb Felix Paul Kühne <git at videolan.org>:

> vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Feb  7 19:15:15 2013 +0100| [9929cc94ce61b48c666dcf1aa2b65c1e7de763c9] | committer: Felix Paul Kühne
> 
> macosx: replace all 'key-action' calls with their proper counter-parts
> 
> This excludes 'ACTIONID_POSITION' for which there doesn't seem to be a replacement.
> 
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9929cc94ce61b48c666dcf1aa2b65c1e7de763c9
> ---
> 
> modules/gui/macosx/CoreInteraction.m |   57 +++++++++++++++++++++++-----------
> modules/gui/macosx/controls.m        |    2 +-
> modules/gui/macosx/intf.m            |    6 ++--
> modules/gui/macosx/misc.m            |   32 +++++++++++--------
> 4 files changed, 61 insertions(+), 36 deletions(-)
> 
> diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
> index 5145205..e310ff6 100644
> --- a/modules/gui/macosx/CoreInteraction.m
> +++ b/modules/gui/macosx/CoreInteraction.m
> @@ -1,7 +1,7 @@
> /*****************************************************************************
>  * CoreInteraction.m: MacOS X interface module
>  *****************************************************************************
> - * Copyright (C) 2011-2012 Felix Paul Kühne
> + * Copyright (C) 2011-2013 Felix Paul Kühne
>  * $Id$
>  *
>  * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
> @@ -35,6 +35,10 @@
> #import <vlc_strings.h>
> #import <vlc_url.h>
> 
> + at interface VLCMainWindow (Internal)
> +- (void)jumpWithValue:(char *)p_value forward:(BOOL)b_value;
> + at end
> +
> @implementation VLCCoreInteraction
> static VLCCoreInteraction *_o_sharedInstance = nil;
> 
> @@ -78,11 +82,12 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
> {
>     input_thread_t * p_input;
>     p_input = pl_CurrentInput(VLCIntf);
> +    playlist_t * p_playlist = pl_Get(VLCIntf);
> +
>     if (p_input) {
> -        var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE);
> +        playlist_Play(p_playlist);
>         vlc_object_release(p_input);
>     } else {
> -        playlist_t * p_playlist = pl_Get(VLCIntf);
>         bool empty;
> 
>         PL_LOCK;
> @@ -98,27 +103,27 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
> 
> - (void)pause
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_PAUSE);
> +    playlist_Pause(pl_Get(VLCIntf));
> }
> 
> - (void)stop
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_STOP);
> +    playlist_Stop(pl_Get(VLCIntf));
> }
> 
> - (void)faster
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_FASTER);
> +    var_TriggerCallback(pl_Get(VLCIntf), "rate-faster");
> }
> 
> - (void)slower
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_SLOWER);
> +    var_TriggerCallback(pl_Get(VLCIntf), "rate-slower");
> }
> 
> - (void)normalSpeed
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_RATE_NORMAL);
> +    var_SetFloat(pl_Get(VLCIntf), "rate", 1.);
> }
> 
> - (void)toggleRecord
> @@ -180,12 +185,12 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
> 
> - (void)previous
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_PREV);
> +    playlist_Prev(pl_Get(VLCIntf));
> }
> 
> - (void)next
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_NEXT);
> +    playlist_Next(pl_Get(VLCIntf));
> }
> 
> - (int)durationOfCurrentPlaylistItem
> @@ -288,44 +293,60 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
>     [self backwardShort];
> }
> 
> +- (void)jumpWithValue:(char *)p_value forward:(BOOL)b_value
> +{
> +    input_thread_t *p_input = pl_CurrentInput(VLCIntf);
> +    if (!p_input)
> +        return;
> +
> +    int i_interval = var_InheritInteger( p_input, p_value );
> +    if (i_interval > 0) {
> +        mtime_t val = CLOCK_FREQ * i_interval;
> +        if (!b_value)
> +            val = val * -1;
> +        var_SetTime( p_input, "time-offset", val );
> +    }
> +    vlc_object_release(p_input);
> +}
> +
> - (void)forwardExtraShort
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_EXTRASHORT);
> +    [self jumpWithValue:"extrashort-jump-size" forward:YES];
> }
> 
> - (void)backwardExtraShort
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_EXTRASHORT);
> +    [self jumpWithValue:"extrashort-jump-size" forward:NO];
> }
> 
> - (void)forwardShort
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_SHORT);
> +    [self jumpWithValue:"short-jump-size" forward:YES];
> }
> 
> - (void)backwardShort
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_SHORT);
> +    [self jumpWithValue:"short-jump-size" forward:NO];
> }
> 
> - (void)forwardMedium
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_MEDIUM);
> +    [self jumpWithValue:"medium-jump-size" forward:YES];
> }
> 
> - (void)backwardMedium
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_MEDIUM);
> +    [self jumpWithValue:"medium-jump-size" forward:NO];
> }
> 
> - (void)forwardLong
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_LONG);
> +    [self jumpWithValue:"long-jump-size" forward:YES];
> }
> 
> - (void)backwardLong
> {
> -    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_LONG);
> +    [self jumpWithValue:"long-jump-size" forward:NO];
> }
> 
> - (void)shuffle
> diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m
> index c39067e..cc7195b 100644
> --- a/modules/gui/macosx/controls.m
> +++ b/modules/gui/macosx/controls.m
> @@ -1,7 +1,7 @@
> /*****************************************************************************
>  * controls.m: MacOS X interface module
>  *****************************************************************************
> - * Copyright (C) 2002-2012 VLC authors and VideoLAN
> + * Copyright (C) 2002-2013 VLC authors and VideoLAN
>  * $Id$
>  *
>  * Authors: Jon Lech Johansen <jon-vl at nanocrew.net>
> diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
> index ea12ce1..4607a16 100644
> --- a/modules/gui/macosx/intf.m
> +++ b/modules/gui/macosx/intf.m
> @@ -1053,12 +1053,10 @@ static VLCMain *_o_sharedMainInstance = nil;
>                 [[VLCCoreInteraction sharedInstance] backward];
>                 break;
>             case kRemoteButtonVolume_Plus_Hold:
> -                if (p_intf)
> -                    var_SetInteger(p_intf->p_libvlc, "key-action", ACTIONID_VOL_UP);
> +                [[VLCCoreInteraction sharedInstance] volumeUp];
>                 break;
>             case kRemoteButtonVolume_Minus_Hold:
> -                if (p_intf)
> -                    var_SetInteger(p_intf->p_libvlc, "key-action", ACTIONID_VOL_DOWN);
> +                [[VLCCoreInteraction sharedInstance] volumeDown];

Hi Felix,

I put these key-actions on purpose here, because of some criticism before. Apple remote should be treated as hotkey actions, so that the OSD display is shown, with the the volume change is visible from the sofa.

Furthermore, this commit breaks play & pause button / space bar, and the scrolling direction for seeking is wrong now.
(For the play/pause button its ok to use the direct functions, but for space bar, we IMHO should stick with the key action for the same purpose to display the OSD icons).

Best regards,
David




More information about the vlc-devel mailing list