[vlc-devel] [PATCH] hotkeys: added OSD messages for loop and random toggle

Rémi Denis-Courmont remi at remlab.net
Sat Feb 16 12:13:32 CET 2013


This patch breaks atomicity of toggle.

Le vendredi 15 février 2013 20:35:27, John French a écrit :
> Resolves ticket #7933
> ---
>  modules/control/hotkeys.c | 31 ++++++++++++++++++++++++++++---
>  1 file changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
> index 42e3ba0..4bb5047 100644
> --- a/modules/control/hotkeys.c
> +++ b/modules/control/hotkeys.c
> @@ -163,22 +163,47 @@ static int PutAction( intf_thread_t *p_intf, int
> i_action )
> 
>          /* Playlist actions (including audio) */
>          case ACTIONID_LOOP:
> +        {
>              /* Toggle Normal -> Loop -> Repeat -> Normal ... */
> +            char *mode;
>              if( var_GetBool( p_playlist, "repeat" ) )
> +            {
>                  var_SetBool( p_playlist, "repeat", false );
> -            else
> -            if( var_GetBool( p_playlist, "loop" ) )
> +                mode = "Off";
> +            }
> +            else if( var_GetBool( p_playlist, "loop" ) )
>              { /* FIXME: this is not atomic, we should use a real tristate
> */ var_SetBool( p_playlist, "loop", false );
>                  var_SetBool( p_playlist, "repeat", true );
> +                mode = "One";
>              }
>              else
> +            {
>                  var_SetBool( p_playlist, "loop", true );
> +                mode = "All";
> +            }
> +            DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
> +                            _("Loop %s"), _(mode) );
>              break;
> +        }
> 
>          case ACTIONID_RANDOM:
> -            var_ToggleBool( p_playlist, "random" );
> +        {
> +            char *state;
> +            if( var_GetBool( p_playlist, "random" ) )
> +            {
> +                var_SetBool( p_playlist, "random", false );
> +                state = "On";
> +            }
> +            else
> +            {
> +                var_SetBool( p_playlist, "random", true );
> +                state = "Off";
> +            }
> +            DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
> +                            _("Random %s"), _(state) );
>              break;
> +        }
> 
>          case ACTIONID_NEXT:
>              DisplayMessage( p_vout, _("Next") );

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list