forked from AuroraMiddleware/gtk
button: Fix in_button checks
The gesture coords are relative to the button's origin, so use gtk_widget_get_own_allocation to check if the coords are inside the button.
This commit is contained in:
parent
12fdb19d63
commit
a4d2da76b3
@ -330,12 +330,11 @@ touch_release_in_button (GtkButton *button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gdk_event_get_coords (event, &x, &y);
|
gdk_event_get_coords (event, &x, &y);
|
||||||
gtk_widget_get_allocation (GTK_WIDGET (button), &allocation);
|
gtk_widget_get_own_allocation (GTK_WIDGET (button), &allocation);
|
||||||
|
|
||||||
gdk_event_free (event);
|
gdk_event_free (event);
|
||||||
|
|
||||||
if (x >= 0 && x <= allocation.width &&
|
if (gdk_rectangle_contains_point (&allocation, x, y))
|
||||||
y >= 0 && y <= allocation.height)
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -379,10 +378,10 @@ multipress_gesture_update_cb (GtkGesture *gesture,
|
|||||||
if (sequence != gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture)))
|
if (sequence != gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_get_allocation (GTK_WIDGET (button), &allocation);
|
gtk_widget_get_own_allocation (GTK_WIDGET (button), &allocation);
|
||||||
gtk_gesture_get_point (gesture, sequence, &x, &y);
|
gtk_gesture_get_point (gesture, sequence, &x, &y);
|
||||||
|
|
||||||
in_button = (x >= 0 && y >= 0 && x < allocation.width && y < allocation.height);
|
in_button = gdk_rectangle_contains_point (&allocation, x, y);
|
||||||
|
|
||||||
if (priv->in_button != in_button)
|
if (priv->in_button != in_button)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user