Drop normalized_get_direction, use physical distances instead
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 23 Jan 2017 00:43:04 +0000 (10:43 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 23 Jan 2017 00:43:04 +0000 (10:43 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev-mt-touchpad-gestures.c
src/evdev-mt-touchpad.c
src/libinput-private.h

index 9ba594269c7e0c936c0edf9349c4122e02f11246..f1a4ce0b079f3030b758b139aff39a5cd5c6657a 100644 (file)
@@ -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
index fe9e642c1b693af4b1990107d2db9cbe14e839b3..00f088d7b9fb41890862dacaaf36c977b94485e0 100644 (file)
@@ -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;
        }
index 2bd523e1cfcd9e5a5b00bbf4a823bc8788bc7194..39c169cdaba29ab369e1932efd4f159676eb5050 100644 (file)
@@ -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);
 }
 
 /**