button: Fix ::clicked emission on touchscreens sending pointer events

When GtkGestureMultiPress::released happens, in_button should be unset
after emitting GtkButton::released, whose default implementation uses it.
Moreover, in_button should only be unset there for real touch events, not
guaranteed to trigger crossing events, as opposed to every pointer/touch
events from touchscreens.

https://bugzilla.gnome.org/show_bug.cgi?id=737297
This commit is contained in:
Carlos Garnacho 2014-09-25 15:24:46 +02:00
parent fcec9b9812
commit d17fd81d9b

View File

@ -607,18 +607,16 @@ multipress_released_cb (GtkGestureMultiPress *gesture,
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
GdkEventSequence *sequence;
const GdkEvent *event;
GdkDevice *source;
g_signal_emit (button, button_signals[RELEASED], 0);
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
if (event)
if (sequence)
{
source = gdk_event_get_source_device (event);
if (source && gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN)
priv->in_button = FALSE;
gtk_button_update_state (button);
}
g_signal_emit (button, button_signals[RELEASED], 0);
}
static void