gestureclick: Don't use threshold for touch

When determining double-clicks, don't use the distance
threshold for touch events. It is very hard to double
touch reliably within a few pixels of the same position.

Fixes: #5580
This commit is contained in:
Matthias Clasen 2023-04-06 15:31:03 -04:00
parent 99251c0c8f
commit c0fa9e80aa

View File

@ -220,7 +220,8 @@ gtk_gesture_click_begin (GtkGesture *gesture,
_gtk_gesture_click_update_timeout (click);
gtk_gesture_get_point (gesture, current, &x, &y);
if (!_gtk_gesture_click_check_within_threshold (click, x, y))
if (gdk_device_get_source (priv->current_device) == GDK_SOURCE_MOUSE &&
!_gtk_gesture_click_check_within_threshold (click, x, y))
_gtk_gesture_click_stop (click);
/* Increment later the real counter, just if the gesture is
@ -243,14 +244,17 @@ gtk_gesture_click_update (GtkGesture *gesture,
GdkEventSequence *sequence)
{
GtkGestureClick *click;
GtkGestureClickPrivate *priv;
GdkEventSequence *current;
double x, y;
click = GTK_GESTURE_CLICK (gesture);
priv = gtk_gesture_click_get_instance_private (click);
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
gtk_gesture_get_point (gesture, current, &x, &y);
if (!_gtk_gesture_click_check_within_threshold (click, x, y))
if (gdk_device_get_source (priv->current_device) == GDK_SOURCE_MOUSE &&
!_gtk_gesture_click_check_within_threshold (click, x, y))
_gtk_gesture_click_stop (click);
}