summaryrefslogtreecommitdiff
path: root/src/evdev-mt-touchpad-gestures.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/evdev-mt-touchpad-gestures.c')
-rw-r--r--src/evdev-mt-touchpad-gestures.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 93581f4d..6c489c36 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -182,18 +182,7 @@ tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch)
{
struct normalized_coords normalized;
struct device_float_coords delta;
- double move_threshold;
-
- /*
- * Semi-mt touchpads have somewhat inaccurate coordinates when
- * 2 fingers are down, so use a slightly larger threshold.
- * Elantech semi-mt touchpads are accurate enough though.
- */
- if (tp->semi_mt &&
- (tp->device->model_flags & EVDEV_MODEL_ELANTECH_TOUCHPAD) == 0)
- move_threshold = TP_MM_TO_DPI_NORMALIZED(4);
- else
- move_threshold = TP_MM_TO_DPI_NORMALIZED(1);
+ double move_threshold = TP_MM_TO_DPI_NORMALIZED(1);
delta = device_delta(touch->point, touch->gesture.initial);
@@ -219,11 +208,7 @@ tp_gesture_get_pinch_info(struct tp_dispatch *tp,
delta = device_delta(first->point, second->point);
normalized = tp_normalize_delta(tp, delta);
*distance = normalized_length(normalized);
-
- if (!tp->semi_mt)
- *angle = atan2(normalized.y, normalized.x) * 180.0 / M_PI;
- else
- *angle = 0.0;
+ *angle = atan2(normalized.y, normalized.x) * 180.0 / M_PI;
*center = device_average(first->point, second->point);
}
@@ -285,7 +270,9 @@ tp_gesture_handle_state_none(struct tp_dispatch *tp, uint64_t time)
if (first == second)
return GESTURE_STATE_NONE;
- }
+
+ } else if (!tp->gesture.enabled)
+ return GESTURE_STATE_SCROLL;
tp->gesture.initial_time = time;
first->gesture.initial = first->point;
@@ -362,7 +349,7 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
} else if (tp->gesture.enabled) {
return GESTURE_STATE_SWIPE;
}
- } else if (tp->gesture.enabled) {
+ } else {
tp_gesture_init_pinch(tp);
return GESTURE_STATE_PINCH;
}
@@ -378,16 +365,7 @@ tp_gesture_handle_state_scroll(struct tp_dispatch *tp, uint64_t time)
if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
return GESTURE_STATE_SCROLL;
- /* On some semi-mt models slot 0 is more accurate, so for semi-mt
- * we only use slot 0. */
- if (tp->semi_mt) {
- if (!tp->touches[0].dirty)
- return GESTURE_STATE_SCROLL;
-
- delta = tp_get_delta(&tp->touches[0]);
- } else {
- delta = tp_get_average_touches_delta(tp);
- }
+ delta = tp_get_average_touches_delta(tp);
/* scroll is not accelerated */
delta = tp_filter_motion_unaccelerated(tp, &delta, time);
@@ -633,10 +611,10 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time)
int
tp_init_gesture(struct tp_dispatch *tp)
{
- if (tp->device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT)
- tp->gesture.enabled = false;
- else
- tp->gesture.enabled = true;
+ /* two-finger scrolling is always enabled, this flag just
+ * decides whether we detect pinch. semi-mt devices are too
+ * unreliable to do pinch gestures. */
+ tp->gesture.enabled = !tp->semi_mt && tp->num_slots > 1;
tp->gesture.state = GESTURE_STATE_NONE;