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

Hans de Goede hdegoede at redhat.com
Tue Apr 15 05:28:07 PDT 2014


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);
+
 #endif
-- 
1.9.0



More information about the wayland-devel mailing list