[PATCH libinput 3/3] Drop normalized_get_direction, use physical distances instead
Peter Hutterer
peter.hutterer at who-t.net
Tue Jan 24 05:46:07 UTC 2017
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev-mt-touchpad-gestures.c | 5 +----
src/evdev-mt-touchpad.c | 2 +-
src/libinput-private.h | 4 ++--
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 9ba5942..f1a4ce0 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -185,7 +185,6 @@ static uint32_t
tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch,
unsigned int nfingers)
{
- struct normalized_coords normalized;
struct phys_coords mm;
struct device_float_coords delta;
double move_threshold = 1.0; /* mm */
@@ -198,9 +197,7 @@ tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch,
if (length_in_mm(mm) < move_threshold)
return UNDEFINED_DIRECTION;
- normalized = tp_normalize_delta(tp, delta);
-
- return normalized_get_direction(normalized);
+ return phys_get_direction(mm);
}
static void
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index fe9e642..00f088d 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -623,7 +623,7 @@ tp_palm_detect_move_out_of_edge(struct tp_dispatch *tp,
if (time < t->palm.time + PALM_TIMEOUT &&
(t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge)) {
delta = device_delta(t->point, t->palm.first);
- dirs = normalized_get_direction(tp_normalize_delta(tp, delta));
+ dirs = phys_get_direction(tp_phys_delta(tp, delta));
if ((dirs & DIRECTIONS) && !(dirs & ~DIRECTIONS))
return true;
}
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 2bd523e..39c169c 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -763,9 +763,9 @@ xy_get_direction(double x, double y)
}
static inline uint32_t
-normalized_get_direction(struct normalized_coords norm)
+phys_get_direction(struct phys_coords mm)
{
- return xy_get_direction(norm.x, norm.y);
+ return xy_get_direction(mm.x, mm.y);
}
/**
--
2.9.3
More information about the wayland-devel
mailing list