summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-04-03 13:31:50 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-04-21 10:03:16 +1000
commit76fce6cdddaee901ba47b1a47ecdc4e1e5e46f32 (patch)
tree4f11034787ba1477647809319329765a8d22046c /src
parent160d60eb859a3e78ba0bb10be70e534ca499dee4 (diff)
touchpad: move edge palm init to separate helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 9322393..21fdc46 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -2224,23 +2224,14 @@ tp_init_dwt(struct tp_dispatch *tp,
return;
}
-static void
-tp_init_palmdetect(struct tp_dispatch *tp,
- struct evdev_device *device)
+static inline void
+tp_init_palmdetect_edge(struct tp_dispatch *tp,
+ struct evdev_device *device)
{
double width, height;
struct phys_coords mm = { 0.0, 0.0 };
struct device_coords edges;
- tp->palm.right_edge = INT_MAX;
- tp->palm.left_edge = INT_MIN;
-
- if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD &&
- !tp_is_tpkb_combo_below(device))
- return;
-
- tp->palm.monitor_trackpoint = true;
-
evdev_device_get_size(device, &width, &height);
/* Enable palm detection on touchpads >= 70 mm. Anything smaller
@@ -2256,8 +2247,23 @@ tp_init_palmdetect(struct tp_dispatch *tp,
mm.x = width * 0.95;
edges = evdev_device_mm_to_units(device, &mm);
tp->palm.right_edge = edges.x;
+}
+
+static void
+tp_init_palmdetect(struct tp_dispatch *tp,
+ struct evdev_device *device)
+{
+
+ tp->palm.right_edge = INT_MAX;
+ tp->palm.left_edge = INT_MIN;
+
+ if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD &&
+ !tp_is_tpkb_combo_below(device))
+ return;
tp->palm.monitor_trackpoint = true;
+
+ tp_init_palmdetect_edge(tp, device);
}
static void