X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcontrol%2Fgestures.c;h=df9f8079e1620183e660a5f3f1aac66d70f06b9d;hb=5d313c65e44d8963262fdbc5d5d52f5169f3f787;hp=ec46547abdd5dba71981acce60c8bef1a0da3524;hpb=27d483e9ef7a451397d7857251c8d67097661f1d;p=vlc diff --git a/modules/control/gestures.c b/modules/control/gestures.c index ec46547abd..df9f8079e1 100644 --- a/modules/control/gestures.c +++ b/modules/control/gestures.c @@ -29,7 +29,7 @@ # include "config.h" #endif -#include +#include #include #include #include @@ -66,8 +66,8 @@ struct intf_sys_t #define NONE 0 #define GESTURE( a, b, c, d ) (a | ( b << 4 ) | ( c << 8 ) | ( d << 12 )) -int E_(Open) ( vlc_object_t * ); -void E_(Close) ( vlc_object_t * ); +int Open ( vlc_object_t * ); +void Close ( vlc_object_t * ); static int InitThread ( intf_thread_t *p_intf ); static void EndThread ( intf_thread_t *p_intf ); static int MouseEvent ( vlc_object_t *, char const *, @@ -87,12 +87,12 @@ static void RunIntf ( intf_thread_t *p_intf ); #define BUTTON_LONGTEXT N_( \ "Trigger button for mouse gestures." ) -static const char *button_list[] = { "left", "middle", "right" }; -static const char *button_list_text[] = +static const char *const button_list[] = { "left", "middle", "right" }; +static const char *const button_list_text[] = { N_("Left"), N_("Middle"), N_("Right") }; vlc_module_begin(); - set_shortname( _("Gestures")); + set_shortname( N_("Gestures")); set_category( CAT_INTERFACE ); set_subcategory( SUBCAT_INTERFACE_CONTROL ); add_integer( "gestures-threshold", 30, NULL, @@ -100,16 +100,16 @@ vlc_module_begin(); add_string( "gestures-button", "right", NULL, BUTTON_TEXT, BUTTON_LONGTEXT, false ); change_string_list( button_list, button_list_text, 0 ); - set_description( _("Mouse gestures control interface") ); + set_description( N_("Mouse gestures control interface") ); set_capability( "interface", 0 ); - set_callbacks( E_(Open), E_(Close) ); + set_callbacks( Open, Close ); vlc_module_end(); /***************************************************************************** * OpenIntf: initialize interface *****************************************************************************/ -int E_(Open) ( vlc_object_t *p_this ) +int Open ( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; @@ -153,7 +153,7 @@ static input_thread_t * input_from_playlist ( playlist_t *p_playlist ) /***************************************************************************** * CloseIntf: destroy dummy interface *****************************************************************************/ -void E_(Close) ( vlc_object_t *p_this ) +void Close ( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; @@ -226,11 +226,7 @@ static void RunIntf( intf_thread_t *p_intf ) case GESTURE(RIGHT,LEFT,NONE,NONE): { input_thread_t * p_input; - p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); - - if( !p_playlist ) - break; + p_playlist = pl_Yield( p_intf ); p_input = input_from_playlist( p_playlist ); vlc_object_release( p_playlist ); @@ -257,23 +253,13 @@ static void RunIntf( intf_thread_t *p_intf ) } break; case GESTURE(LEFT,DOWN,NONE,NONE): - p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); - if( p_playlist == NULL ) - { - break; - } + p_playlist = pl_Yield( p_intf ); playlist_Prev( p_playlist ); vlc_object_release( p_playlist ); break; case GESTURE(RIGHT,DOWN,NONE,NONE): - p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); - if( p_playlist == NULL ) - { - break; - } + p_playlist = pl_Yield( p_intf ); playlist_Next( p_playlist ); vlc_object_release( p_playlist ); @@ -306,11 +292,7 @@ static void RunIntf( intf_thread_t *p_intf ) vlc_value_t val, list, list2; int i_count, i; - p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); - - if( !p_playlist ) - break; + p_playlist = pl_Yield( p_intf ); p_input = input_from_playlist( p_playlist ); @@ -365,11 +347,7 @@ static void RunIntf( intf_thread_t *p_intf ) vlc_value_t val, list, list2; int i_count, i; - p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); - - if( !p_playlist ) - break; + p_playlist = pl_Yield( p_intf ); p_input = input_from_playlist( p_playlist ); vlc_object_release( p_playlist ); @@ -442,7 +420,7 @@ static void RunIntf( intf_thread_t *p_intf ) /* * video output */ - if( p_intf->p_sys->p_vout && p_intf->p_sys->p_vout->b_die ) + if( p_intf->p_sys->p_vout && !vlc_object_alive (p_intf->p_sys->p_vout) ) { var_DelCallback( p_intf->p_sys->p_vout, "mouse-moved", MouseEvent, p_intf ); @@ -507,6 +485,7 @@ static int InitThread( intf_thread_t * p_intf ) { p_intf->p_sys->i_button_mask = 4; } + free( psz_button ); p_intf->p_sys->i_pattern = 0; p_intf->p_sys->i_num_gestures = 0;