mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
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:
parent
aa2ca80817
commit
e662438675
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user