gtkgesturesingle: Unset button/sequence if parent handle_event failed

There are legit reasons for GtkGesture::handle_event to return FALSE,
GtkGestureSingle objects should be unsetting the current button/sequence
if that happens, in order to avoid inconsistent states.

https://bugzilla.gnome.org/show_bug.cgi?id=738591
This commit is contained in:
Carlos Garnacho 2014-10-17 21:12:44 +02:00
parent e46d23d819
commit cfaec2d2f5

View File

@ -220,6 +220,13 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
if (sequence == priv->current_sequence &&
(event->type == GDK_BUTTON_RELEASE || event->type == GDK_TOUCH_END))
priv->current_button = 0;
else if (!retval)
{
if (button == priv->current_button && event->type == GDK_BUTTON_PRESS)
priv->current_button = 0;
else if (sequence == priv->current_sequence && event->type == GDK_TOUCH_BEGIN)
priv->current_sequence = NULL;
}
return retval;
}