[PATCH libinput 17/20] touchpad: Ignore fingers in button area for 2 finger scroll

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 23 21:20:18 PDT 2014


On Tue, Apr 15, 2014 at 02:28:14PM +0200, Hans de Goede wrote:
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev-mt-touchpad.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 910bd2a..7333ec9 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -442,7 +442,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint32_t time)
>  	double tmpx, tmpy;
>  
>  	tp_for_each_touch(tp, t) {
> -		if (t->dirty) {
> +		if (tp_touch_active(tp, t) && t->dirty) {
>  			nchanged++;
>  			tp_get_delta(t, &tmpx, &tmpy);
>  
> @@ -495,12 +495,21 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint32_t time)
>  static int
>  tp_post_scroll_events(struct tp_dispatch *tp, uint32_t time)
>  {
> +	struct tp_touch *t;
> +	int nfingers_down = 0;
> +
>  	/* don't scroll if a clickpad is held down */
>  	if (tp->buttons.is_buttonpad &&
>  	    (tp->buttons.state || tp->buttons.old_state))
>  		return 0;
>  
> -	if (tp->nfingers_down != 2) {
> +	/* Only count active touches for 2 finger scrolling */
> +	tp_for_each_touch(tp, t) {
> +		if (tp_touch_active(tp, t))
> +			nfingers_down++;
> +	}
> +
> +	if (nfingers_down != 2) {
>  		/* terminate scrolling with a zero scroll event to notify
>  		 * caller that it really ended now */
>  		if (tp->scroll.state != SCROLL_STATE_NONE) {

this is mostly unrelated to this patch but there's a bug in the current
handling of the scrolling events. If a user scrolls with two fingers, then
presses the button, tp_post_button_events returns 1 and we never get here,
thus never terminate the scrolling with a 0 event.

Cheers,
   Peter

> 



More information about the wayland-devel mailing list