if (first_mm < 1 && second_mm < 1)
return GESTURE_STATE_UNKNOWN;
+ /* If both touches are within 7mm vertically and 40mm horizontally,
+ * assume scroll/swipe */
+ if (distance_mm.x < 40 && distance_mm.y < 7.0) {
+ if (tp->gesture.finger_count == 2) {
+ tp_gesture_set_scroll_buildup(tp);
+ return GESTURE_STATE_SCROLL;
+ } else if (tp->gesture.enabled) {
+ return GESTURE_STATE_SWIPE;
+ }
+ }
+
/* If one touch exceeds the outer threshold while the other has not
* yet passed the inner threshold, this is not a valid gesture.
* If thumb detection is enabled, and one of the touches is >20mm
LIBINPUT_DEVICE_CAP_GESTURE))
return;
+ /* If the device is too small to provide a finger spread wide enough
+ * to avoid the scroll bias, skip the test */
+ if (cardinal == E || cardinal == W) {
+ double w = 0, h = 0;
+ libinput_device_get_size(dev->libinput_device, &w, &h);
+ /* 0.6 because the code below gives us points like 20/y and
+ * 80/y. 45 because the threshold in the code is 40mm */
+ if (w * 0.6 < 45)
+ return;
+ }
+
dir_x = cardinals[cardinal][0];
dir_y = cardinals[cardinal][1];
LIBINPUT_DEVICE_CAP_GESTURE))
return;
+ /* If the device is too small to provide a finger spread wide enough
+ * to avoid the scroll bias, skip the test */
+ if (cardinal == E || cardinal == W) {
+ double w = 0, h = 0;
+ libinput_device_get_size(dev->libinput_device, &w, &h);
+ /* 0.6 because the code below gives us points like 20/y and
+ * 80/y. 45 because the threshold in the code is 40mm */
+ if (w * 0.6 < 45)
+ return;
+ }
+
dir_x = cardinals[cardinal][0];
dir_y = cardinals[cardinal][1];