[PATCH libinput 10/20] touchpad: Add tp_button_touch_active function

Jonas Ådahl jadahl at gmail.com
Thu Apr 24 12:16:43 PDT 2014


On Tue, Apr 15, 2014 at 02:28:07PM +0200, Hans de Goede wrote:
> We don't want touches in the button area to cause the pointer to move, add
> a tp_button_touch_active function which the main code in evdev-mt-touchpad
> can call to see if a touch should be consider a candidate for being the
> pointer, should be taken into account for 2 finger scrolling, etc.
> 
> The idea behind the main code polling for this is that in the future with
> ie edge scrolling we will have another independent state machine, which
> may also want to block a touch from being the pointer, so it is best for
> the main code to test all independent state machines, rather then having
> the state-machines poke the is_pointer variabel directly.
> 
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev-mt-touchpad-buttons.c | 5 +++++
>  src/evdev-mt-touchpad.h         | 3 +++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
> index f953cd1..e789a87 100644
> --- a/src/evdev-mt-touchpad-buttons.c
> +++ b/src/evdev-mt-touchpad-buttons.c
> @@ -602,3 +602,8 @@ tp_post_button_events(struct tp_dispatch *tp, uint32_t time)
>  	return rc;
>  }
>  
> +int
> +tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
> +{
> +	return t->button.state == BUTTON_STATE_AREA;
> +}
> diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
> index 8d8dd84..04da6a6 100644
> --- a/src/evdev-mt-touchpad.h
> +++ b/src/evdev-mt-touchpad.h
> @@ -229,4 +229,7 @@ tp_post_button_events(struct tp_dispatch *tp, uint32_t time);
>  int
>  tp_button_handle_state(struct tp_dispatch *tp, uint32_t time);
>  
> +int
> +tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
> +

I think the naming here is a bit inconsistent, as a function in the
following patch with the same naming convention (tp_touch_active()) is a
get:er, not a set:er. IMO functions with side effects should have that
detail in their name some how, for example in this case _set_active() or
_activate().

Also this type of patch fits better as just a detail of the following
patch. That is in order to know how the intended use is without having
to jump between patches.


Thanks,

Jonas

>  #endif
> -- 
> 1.9.0
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list