summaryrefslogtreecommitdiff
path: root/gtk/gtkswitch.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-06-26 17:35:05 +0200
committerCarlos Garnacho <carlosg@gnome.org>2020-06-26 17:48:10 +0200
commitb81bbde7c85cb74177e16dac510cb11931fb152c (patch)
tree0b9a1b50edb674abe57f68435386779e8c20f4cd /gtk/gtkswitch.c
parent3f55bfe2cb2e7c4486cec0d349f42b9ede7aad3d (diff)
downloadgtk+-b81bbde7c85cb74177e16dac510cb11931fb152c.tar.gz
gtkswitch: Don't be eager in accepting the gesture
The gesture should be accepted whenever it triggers uncancellable actions in the widget. This means it should be accepted if the click does result in toggling the switch. This leaves the pan gesture room to handle dragging the handle. Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2895
Diffstat (limited to 'gtk/gtkswitch.c')
-rw-r--r--gtk/gtkswitch.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 99ac45f941..e720ac3030 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -205,8 +205,6 @@ gtk_switch_click_gesture_pressed (GtkGestureClick *gesture,
if (!gtk_widget_compute_bounds (GTK_WIDGET (self), GTK_WIDGET (self), &switch_bounds))
return;
- gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
-
/* If the press didn't happen in the draggable handle,
* cancel the pan gesture right away
*/
@@ -228,7 +226,10 @@ gtk_switch_click_gesture_released (GtkGestureClick *gesture,
if (gtk_widget_contains (GTK_WIDGET (self), x, y) &&
gtk_gesture_handles_sequence (GTK_GESTURE (gesture), sequence))
- gtk_switch_begin_toggle_animation (self);
+ {
+ gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
+ gtk_switch_begin_toggle_animation (self);
+ }
}
static void