From: Peter Hutterer Date: Thu, 21 May 2015 03:30:24 +0000 (+1000) Subject: touchpad: split disable-while-typing handling into a helper function X-Git-Tag: upstream/0.15.0+92+gec468e8~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff8f44a0c634fd452e89876c178e366bfb91cba5;p=platform%2Fupstream%2Flibinput.git touchpad: split disable-while-typing handling into a helper function Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede Tested-by: Benjamin Tissoires --- diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index c908ead3..0b644d9a 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