[PATCH libinput 07/11] touchpad: split disable-while-typing handling into a helper function

Peter Hutterer peter.hutterer at who-t.net
Mon May 25 15:52:54 PDT 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index c908ead..0b644d9 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -481,6 +481,22 @@ tp_palm_tap_is_palm(struct tp_dispatch *tp, struct tp_touch *t)
 	return false;
 }
 
+static int
+tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
+{
+	if (!tp->dwt.keyboard_active)
+		return 0;
+
+	if (t->state == TOUCH_BEGIN) {
+		t->palm.state = PALM_TYPING;
+		t->palm.time = time;
+		t->palm.first = t->point;
+		return 1;
+	}
+
+	return 0;
+}
+
 static void
 tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
 {
@@ -489,13 +505,8 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
 	struct device_float_coords delta;
 	int dirs;
 
-	if (tp->dwt.keyboard_active &&
-	    t->state == TOUCH_BEGIN) {
-		t->palm.state = PALM_TYPING;
-		t->palm.time = time;
-		t->palm.first = t->point;
-		return;
-	}
+	if (tp_palm_detect_dwt(tp, t, time))
+	    return;
 
 	/* If labelled a touch as palm, we unlabel as palm when
 	   we move out of the palm edge zone within the timeout, provided
-- 
2.4.1



More information about the wayland-devel mailing list