Merge branch 'wip/carlosg/cancelled-gestures' into 'master'

gtkwidget: Do not check event sequence state before cancelling gesture

Closes #4387

See merge request GNOME/gtk!4160
This commit is contained in:
Matthias Clasen 2021-11-16 17:19:55 +00:00
commit 012baeb909
2 changed files with 1 additions and 19 deletions

View File

@ -1020,7 +1020,6 @@ gtk_gesture_set_sequence_state (GtkGesture *gesture,
{
GtkGesturePrivate *priv;
PointData *data;
GtkEventSequenceState current_state;
g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
g_return_val_if_fail (state >= GTK_EVENT_SEQUENCE_NONE &&
@ -1044,13 +1043,8 @@ gtk_gesture_set_sequence_state (GtkGesture *gesture,
data->state != GTK_EVENT_SEQUENCE_NONE)
return FALSE;
current_state = data->state;
data->state = state;
if (state == GTK_EVENT_SEQUENCE_DENIED &&
current_state == GTK_EVENT_SEQUENCE_CLAIMED)
_gtk_gesture_cancel_sequence (gesture, sequence);
gtk_widget_cancel_event_sequence (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
gesture, sequence, state);
g_signal_emit (gesture, signals[SEQUENCE_STATE_CHANGED], 0,

View File

@ -2289,19 +2289,14 @@ _gtk_widget_cancel_sequence (GtkWidget *widget,
GdkEventSequence *sequence)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
gboolean emulates_pointer;
gboolean handled = FALSE;
GdkEventSequence *seq;
GList *l;
emulates_pointer = _gtk_widget_get_emulating_sequence (widget, sequence, &seq);
for (l = priv->event_controllers; l; l = l->next)
{
GtkEventController *controller;
GtkGesture *gesture;
seq = sequence;
controller = l->data;
if (!GTK_IS_GESTURE (controller))
@ -2309,14 +2304,7 @@ _gtk_widget_cancel_sequence (GtkWidget *widget,
gesture = GTK_GESTURE (controller);
if (seq && emulates_pointer &&
!gtk_gesture_handles_sequence (gesture, seq))
seq = NULL;
if (!gtk_gesture_handles_sequence (gesture, seq))
continue;
handled |= _gtk_gesture_cancel_sequence (gesture, seq);
handled |= _gtk_gesture_cancel_sequence (gesture, sequence);
}
return handled;