[vlc-devel] [PATCH 3/3] hotkeys: handle 360° zoom with mouse wheel

Thomas Guillem thomas at gllm.fr
Thu Nov 17 17:28:18 CET 2016



On Thu, Nov 17, 2016, at 16:50, Thomas Guillem wrote:
> ---
>  include/vlc_keys.h        |  3 +++
>  modules/control/hotkeys.c | 14 ++++++++++++++
>  src/config/keys.c         |  4 ++--
>  3 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/include/vlc_keys.h b/include/vlc_keys.h
> index abebaa8..10d1d76 100644
> --- a/include/vlc_keys.h
> +++ b/include/vlc_keys.h
> @@ -234,6 +234,9 @@ typedef enum vlc_action {
>      ACTIONID_VIEWPOINT_ZOOM_OUT,
>      ACTIONID_VIEWPOINT_ROLL_CLOCK,
>      ACTIONID_VIEWPOINT_ROLL_ANTICLOCK,
> +    /* Combo Actions */
> +    ACTIONID_COMBO_VOL_ZOOM_UP,
> +    ACTIONID_COMBO_VOL_ZOOM_DOWN,

COMBO is misleading, we can think that it executes 2 actions, while we
want to execute only the best one.

>  
>  } vlc_action_t;
>  
> diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
> index 9a3fdf0..46f1fd9 100644
> --- a/modules/control/hotkeys.c
> +++ b/modules/control/hotkeys.c
> @@ -327,6 +327,7 @@ static int PutAction( intf_thread_t *p_intf,
> input_thread_t *p_input,
>                        vout_thread_t *p_vout, int slider_chan, bool
>                        b_vrnav,
>                        int i_action )
>  {
> +#define CHANGE_ACTION(x) PutAction( p_intf, p_input, p_vout,
> slider_chan, b_vrnav, x)
>      intf_sys_t *p_sys = p_intf->p_sys;
>      playlist_t *p_playlist = pl_Get( p_intf );
>  
> @@ -1366,6 +1367,19 @@ static int PutAction( intf_thread_t *p_intf,
> input_thread_t *p_input,
>              if( p_vout && vout_OSDEpg( p_vout, input_GetItem( p_input )
>              ) )
>                  DisplayPosition( p_vout, slider_chan, p_input );
>              break;
> +
> +        case ACTIONID_COMBO_VOL_ZOOM_UP:
> +            if( b_vrnav )
> +                CHANGE_ACTION( ACTIONID_VIEWPOINT_ZOOM_IN );
> +            else
> +                CHANGE_ACTION( ACTIONID_VOL_UP );
> +            break;
> +        case ACTIONID_COMBO_VOL_ZOOM_DOWN:
> +            if( b_vrnav )
> +                CHANGE_ACTION( ACTIONID_VIEWPOINT_ZOOM_OUT );
> +            else
> +                CHANGE_ACTION( ACTIONID_VOL_DOWN );
> +            break;
>      }
>  
>      return VLC_SUCCESS;
> diff --git a/src/config/keys.c b/src/config/keys.c
> index 859c0d0..6bfb76f 100644
> --- a/src/config/keys.c
> +++ b/src/config/keys.c
> @@ -452,8 +452,8 @@ static void vlc_AddWheelMapping (void **map, uint32_t
> kmore, uint32_t kless,
>      switch (mode)
>      {
>          case 0: /* volume up/down */
> -            amore = ACTIONID_VOL_UP;
> -            aless = ACTIONID_VOL_DOWN;
> +            amore = ACTIONID_COMBO_VOL_ZOOM_UP;
> +            aless = ACTIONID_COMBO_VOL_ZOOM_DOWN;
>              break;
>          case 2: /* position latter/earlier */
>              amore = ACTIONID_JUMP_FORWARD_EXTRASHORT;
> -- 
> 2.9.3
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list