diff --git a/gtk/gtkeventcontroller.c b/gtk/gtkeventcontroller.c index aed43c3d5e..d085cd5899 100644 --- a/gtk/gtkeventcontroller.c +++ b/gtk/gtkeventcontroller.c @@ -73,6 +73,18 @@ gtk_event_controller_unset_widget (GtkEventController *self) priv->widget = NULL; } +static gboolean +gtk_event_controller_filter_event_default (GtkEventController *self, + const GdkEvent *event) +{ + GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (self); + + if (priv->widget) + return !gtk_widget_is_sensitive (priv->widget); + + return FALSE; +} + static gboolean gtk_event_controller_handle_event_default (GtkEventController *self, const GdkEvent *event) @@ -128,7 +140,7 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass) klass->set_widget = gtk_event_controller_set_widget; klass->unset_widget = gtk_event_controller_unset_widget; - klass->filter_event = gtk_event_controller_handle_event_default; + klass->filter_event = gtk_event_controller_filter_event_default; klass->handle_event = gtk_event_controller_handle_event_default; object_class->set_property = gtk_event_controller_set_property; diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c index 7276a3043d..e4e0791d59 100644 --- a/gtk/gtkgesture.c +++ b/gtk/gtkgesture.c @@ -628,7 +628,10 @@ gtk_gesture_filter_event (GtkEventController *controller, * subclasses which punch the holes in for the events * they can possibly handle. */ - return EVENT_IS_TOUCHPAD_GESTURE (event); + if (EVENT_IS_TOUCHPAD_GESTURE (event)) + return FALSE; + + return GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_parent_class)->filter_event (controller, event); } static gboolean diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index b273b2e30d..b038feb444 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -809,6 +809,14 @@ button_released_cb (GtkGestureMultiPress *gesture, } } +static void +button_cancel_cb (GtkGesture *gesture, + GdkEventSequence *sequence, + GtkSpinButton *spin_button) +{ + gtk_spin_button_stop_spinning (spin_button); +} + static void key_controller_key_released (GtkEventControllerKey *key, guint keyval, @@ -886,6 +894,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button) GTK_PHASE_CAPTURE); g_signal_connect (gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button); g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button); + g_signal_connect (gesture, "cancel", G_CALLBACK (button_cancel_cb), spin_button); gtk_widget_add_controller (GTK_WIDGET (priv->down_button), GTK_EVENT_CONTROLLER (gesture)); priv->up_button = gtk_button_new (); @@ -902,6 +911,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button) GTK_PHASE_CAPTURE); g_signal_connect (gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button); g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button); + g_signal_connect (gesture, "cancel", G_CALLBACK (button_cancel_cb), spin_button); gtk_widget_add_controller (GTK_WIDGET (priv->up_button), GTK_EVENT_CONTROLLER (gesture)); gtk_spin_button_set_adjustment (spin_button, NULL); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 3ae53fdb09..af0b48c8c6 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -6363,6 +6363,7 @@ gtk_widget_set_sensitive (GtkWidget *widget, gboolean sensitive) { GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); + GList *l; g_return_if_fail (GTK_IS_WIDGET (widget)); @@ -6373,6 +6374,13 @@ gtk_widget_set_sensitive (GtkWidget *widget, priv->sensitive = sensitive; + for (l = priv->event_controllers; l; l = l->next) + { + GtkEventController *controller = l->data; + + gtk_event_controller_reset (controller); + } + if (priv->parent == NULL || gtk_widget_is_sensitive (priv->parent)) {