mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
gestureclick: Use drag threshold for updates
This commit is contained in:
parent
c0fa9e80aa
commit
5f4a6210c2
@ -150,6 +150,7 @@ _gtk_gesture_click_update_timeout (GtkGestureClick *gesture)
|
||||
|
||||
static gboolean
|
||||
_gtk_gesture_click_check_within_threshold (GtkGestureClick *gesture,
|
||||
const char *setting,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
@ -165,9 +166,7 @@ _gtk_gesture_click_check_within_threshold (GtkGestureClick *gesture,
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
g_object_get (settings,
|
||||
"gtk-double-click-distance", &double_click_distance,
|
||||
NULL);
|
||||
g_object_get (settings, setting, &double_click_distance, NULL);
|
||||
|
||||
if (ABS (priv->initial_press_x - x) < double_click_distance &&
|
||||
ABS (priv->initial_press_y - y) < double_click_distance)
|
||||
@ -221,7 +220,7 @@ gtk_gesture_click_begin (GtkGesture *gesture,
|
||||
gtk_gesture_get_point (gesture, current, &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_check_within_threshold (click, "gtk-double-click-distance", x, y))
|
||||
_gtk_gesture_click_stop (click);
|
||||
|
||||
/* Increment later the real counter, just if the gesture is
|
||||
@ -244,17 +243,14 @@ 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 (gdk_device_get_source (priv->current_device) == GDK_SOURCE_MOUSE &&
|
||||
!_gtk_gesture_click_check_within_threshold (click, x, y))
|
||||
if (!_gtk_gesture_click_check_within_threshold (click, "gtk-dnd-drag-threshold", x, y))
|
||||
_gtk_gesture_click_stop (click);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user