mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
gestures: Make claiming button release work
When claiming a sequence in a gesture signal handler, the expected result is that GtkGesture::handle-event returns TRUE, causing the event to not be propagated further. This doesn't work for button release events, since gtk_gesture_handle_event does the following: add point emit ::update remove point check claimed status The ::update signal is where the application code claims the sequence. But removing the point purges the sequence from the gestures memory, so checking the claimed status returns FALSE. This patch fixes things to behave as expected, by checking the claimed status before removing the point.
This commit is contained in:
parent
6a676d527c
commit
53dddf163d
@ -660,7 +660,7 @@ gtk_gesture_handle_event (GtkEventController *controller,
|
||||
(event_type == GDK_TOUCHPAD_SWIPE && phase == GDK_TOUCHPAD_GESTURE_PHASE_END) ||
|
||||
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
|
||||
{
|
||||
gboolean was_claimed;
|
||||
gboolean was_claimed = FALSE;
|
||||
|
||||
if (_gtk_gesture_update_point (gesture, event, target, x, y, FALSE))
|
||||
{
|
||||
@ -668,12 +668,12 @@ gtk_gesture_handle_event (GtkEventController *controller,
|
||||
_gtk_gesture_check_recognized (gesture, sequence))
|
||||
g_signal_emit (gesture, signals[UPDATE], 0, sequence);
|
||||
|
||||
was_claimed =
|
||||
gtk_gesture_get_sequence_state (gesture, sequence) == GTK_EVENT_SEQUENCE_CLAIMED;
|
||||
|
||||
_gtk_gesture_remove_point (gesture, event);
|
||||
}
|
||||
|
||||
was_claimed =
|
||||
gtk_gesture_get_sequence_state (gesture, sequence) == GTK_EVENT_SEQUENCE_CLAIMED;
|
||||
|
||||
return was_claimed && was_recognized;
|
||||
}
|
||||
else if (event_type == GDK_MOTION_NOTIFY ||
|
||||
|
Loading…
Reference in New Issue
Block a user