forked from AuroraMiddleware/gtk
gesturemultipress: Don’t fire ::released after ::cancel
Causing a grab in the handler for ::pressed by, e.g., popping up a context menu will cause the gesture to be canceled and, subsequently, ::end and ::released to be fired, all while the button is still physically pressed. That results in no event being available to the ::released handler and garbage coordinates, given that gtk_gesture_get_point() returns FALSE. Emitting ::released can be avoided by checking the return value gtk_gesture_get_point().
This commit is contained in:
parent
e9765c0405
commit
4d2b39d98c
@ -274,13 +274,16 @@ gtk_gesture_multi_press_end (GtkGesture *gesture,
|
||||
GtkGestureMultiPressPrivate *priv;
|
||||
GdkEventSequence *current;
|
||||
gdouble x, y;
|
||||
gboolean interpreted;
|
||||
GtkEventSequenceState state;
|
||||
|
||||
multi_press = GTK_GESTURE_MULTI_PRESS (gesture);
|
||||
priv = gtk_gesture_multi_press_get_instance_private (multi_press);
|
||||
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
gtk_gesture_get_point (gesture, current, &x, &y);
|
||||
interpreted = gtk_gesture_get_point (gesture, current, &x, &y);
|
||||
state = gtk_gesture_get_sequence_state (gesture, current);
|
||||
|
||||
if (gtk_gesture_get_sequence_state (gesture, current) != GTK_EVENT_SEQUENCE_DENIED)
|
||||
if (state != GTK_EVENT_SEQUENCE_DENIED && interpreted)
|
||||
g_signal_emit (gesture, signals[RELEASED], 0, priv->n_release, x, y);
|
||||
|
||||
priv->n_release = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user