diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-07-19 10:05:37 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-07-20 11:43:45 +1000 |
commit | bc84245ec394eeb8957e39c78c69e55dbf8c4eb4 (patch) | |
tree | 5b23012ae8d5ae873ab9b41797e4a9e9cb31a930 /src | |
parent | 3dac359df3cff1c1de66dd79dda8d2e3a4b82e88 (diff) |
touchpad: change palm detection trigger functions to bools
And rename to make it more obvious what the return value means.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/evdev-mt-touchpad.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 7ee86a9..190448b 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -573,15 +573,17 @@ tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t) return false; } -static int -tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) +static bool +tp_palm_detect_dwt_triggered(struct tp_dispatch *tp, + struct tp_touch *t, + uint64_t time) { if (tp->dwt.dwt_enabled && tp->dwt.keyboard_active && t->state == TOUCH_BEGIN) { t->palm.state = PALM_TYPING; t->palm.first = t->point; - return 1; + return true; } else if (!tp->dwt.keyboard_active && t->state == TOUCH_UPDATE && t->palm.state == PALM_TYPING) { @@ -599,22 +601,22 @@ tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) } } - return 0; + return false; } -static int -tp_palm_detect_trackpoint(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) +static bool +tp_palm_detect_trackpoint_triggered(struct tp_dispatch *tp, + struct tp_touch *t, + uint64_t time) { if (!tp->palm.monitor_trackpoint) - return 0; + return false; if (t->palm.state == PALM_NONE && t->state == TOUCH_BEGIN && tp->palm.trackpoint_active) { t->palm.state = PALM_TRACKPOINT; - return 1; + return true; } else if (t->palm.state == PALM_TRACKPOINT && t->state == TOUCH_UPDATE && !tp->palm.trackpoint_active) { @@ -627,7 +629,7 @@ tp_palm_detect_trackpoint(struct tp_dispatch *tp, } } - return 0; + return false; } static inline bool @@ -684,10 +686,10 @@ static void tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) { - if (tp_palm_detect_dwt(tp, t, time)) + if (tp_palm_detect_dwt_triggered(tp, t, time)) goto out; - if (tp_palm_detect_trackpoint(tp, t, time)) + if (tp_palm_detect_trackpoint_triggered(tp, t, time)) goto out; if (t->palm.state == PALM_EDGE) { |