vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Mon Sep 1 18:50:38 2014 +0300| [3d663c8e3b039b4368b2d61b08b3943aafefb056] | committer: Rémi Denis-Courmont
gestures: avoid undefined negative shift > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d663c8e3b039b4368b2d61b08b3943aafefb056 --- modules/control/gestures.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/control/gestures.c b/modules/control/gestures.c index e04dd2f..3c72e8a 100644 --- a/modules/control/gestures.c +++ b/modules/control/gestures.c @@ -48,7 +48,7 @@ struct intf_sys_t bool b_button_pressed; int i_last_x, i_last_y; unsigned int i_pattern; - int i_num_gestures; + unsigned int i_num_gestures; int i_threshold; int i_button_mask; }; @@ -147,7 +147,7 @@ static int Open ( vlc_object_t *p_this ) /***************************************************************************** * gesture: return a subpattern within a pattern *****************************************************************************/ -static int gesture( int i_pattern, int i_num ) +static inline unsigned gesture( unsigned i_pattern, unsigned i_num ) { return ( i_pattern >> ( i_num * 4 ) ) & 0xF; } @@ -380,7 +380,7 @@ static int MovedEvent( vlc_object_t *p_this, char const *psz_var, { int i_horizontal = newval.coords.x - p_sys->i_last_x; int i_vertical = newval.coords.y - p_sys->i_last_y; - int pattern = 0; + unsigned int pattern = 0; i_horizontal = i_horizontal / p_sys->i_threshold; i_vertical = i_vertical / p_sys->i_threshold; @@ -410,7 +410,8 @@ static int MovedEvent( vlc_object_t *p_this, char const *psz_var, { p_sys->i_last_x = newval.coords.x; p_sys->i_last_y = newval.coords.y; - if( gesture( p_sys->i_pattern, p_sys->i_num_gestures - 1 ) + if( p_sys->i_num_gestures > 0 + && gesture( p_sys->i_pattern, p_sys->i_num_gestures - 1 ) != pattern ) { p_sys->i_pattern |= pattern << ( p_sys->i_num_gestures * 4 ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
