button: Fix an event handling gotcha

We no longer translate event coordinates in-place,
so gdk_event_get_position() returns surface-relative
coordinates, not widget-relative ones. Just use the
coordinates we are given.
This commit is contained in:
Matthias Clasen 2020-03-28 14:33:01 -04:00
parent aa2ca80817
commit e662438675

View File

@ -306,10 +306,11 @@ click_pressed_cb (GtkGestureClick *gesture,
}
static gboolean
touch_release_in_button (GtkButton *button)
touch_release_in_button (GtkButton *button,
double x,
double y)
{
GdkEvent *event;
gdouble x, y;
event = gtk_get_current_event ();
@ -322,8 +323,6 @@ touch_release_in_button (GtkButton *button)
return FALSE;
}
gdk_event_get_position (event, &x, &y);
gdk_event_unref (event);
if (gtk_widget_contains (GTK_WIDGET (button), x, y))
@ -346,7 +345,7 @@ click_released_cb (GtkGestureClick *gesture,
gtk_button_do_release (button,
gtk_widget_is_sensitive (GTK_WIDGET (button)) &&
(priv->in_button ||
touch_release_in_button (button)));
touch_release_in_button (button, x, y)));
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));