[gtk/button-claim-clicks] button: Claim click events




commit 6fafc8b8119369bda96afe1ede18a2af42d5c89f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Aug 9 22:58:22 2020 -0400

    button: Claim click events
    
    This fixes issues with double activation on clicks.
    
    Fixes: #3054

 gtk/gtkbutton.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index eac1499b0d..c242b28c64 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -319,12 +319,16 @@ click_pressed_cb (GtkGestureClick *gesture,
 {
   GtkButton *button = GTK_BUTTON (widget);
   GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
+  GdkEventSequence *sequence;
 
   if (gtk_widget_get_focus_on_click (widget) && !gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
   priv->in_button = TRUE;
 
+  sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
+  gtk_gesture_set_sequence_state (GTK_GESTURE (gesture), sequence, GTK_EVENT_SEQUENCE_CLAIMED);
+
   if (!priv->activate_timeout)
     priv->button_down = TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]