summaryrefslogtreecommitdiff
path: root/gtk/gtkgesturesingle.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-06-13 01:08:16 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-06-13 01:27:31 +0200
commit6d8842ca9611862a9730ce3370ccba36946bbe04 (patch)
tree0d93bf0434c2bc77a5afbc755ae52e0b66511294 /gtk/gtkgesturesingle.c
parent05810f80a4d482ccb3078b5f52eadd0f427fd088 (diff)
downloadgtk+-6d8842ca9611862a9730ce3370ccba36946bbe04.tar.gz
gesturesingle: Implement GtkGesture::cancel better than GtkEventController:reset
The former can be called individually on each sequence, and the latter will always call the former on all currently active sequences, so only implementing resetting on cancel() works for both cases. Also, chain up on subclasses implementing cancel. This fixes clicking on nautilus' file list after popping up a menu, as broken grabs are one of those situations where sequences get cancelled individually, the "current button" wasn't properly reset, and further clicks with button != 3 were ignored.
Diffstat (limited to 'gtk/gtkgesturesingle.c')
-rw-r--r--gtk/gtkgesturesingle.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gtk/gtkgesturesingle.c b/gtk/gtkgesturesingle.c
index ac91851808..d33f190292 100644
--- a/gtk/gtkgesturesingle.c
+++ b/gtk/gtkgesturesingle.c
@@ -112,14 +112,15 @@ gtk_gesture_single_set_property (GObject *object,
}
static void
-gtk_gesture_single_reset (GtkEventController *controller)
+gtk_gesture_single_cancel (GtkGesture *gesture,
+ GdkEventSequence *sequence)
{
GtkGestureSinglePrivate *priv;
- priv = gtk_gesture_single_get_instance_private (GTK_GESTURE_SINGLE (controller));
- priv->current_button = 0;
+ priv = gtk_gesture_single_get_instance_private (GTK_GESTURE_SINGLE (gesture));
- GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_single_parent_class)->reset (controller);
+ if (sequence == priv->current_sequence)
+ priv->current_button = 0;
}
static gboolean
@@ -219,14 +220,16 @@ static void
gtk_gesture_single_class_init (GtkGestureSingleClass *klass)
{
GtkEventControllerClass *controller_class = GTK_EVENT_CONTROLLER_CLASS (klass);
+ GtkGestureClass *gesture_class = GTK_GESTURE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = gtk_gesture_single_get_property;
object_class->set_property = gtk_gesture_single_set_property;
- controller_class->reset = gtk_gesture_single_reset;
controller_class->handle_event = gtk_gesture_single_handle_event;
+ gesture_class->cancel = gtk_gesture_single_cancel;
+
/**
* GtkGestureSingle:touch-only:
*