button: Claim click events

This fixes issues with double activation on clicks.

Fixes: #3054
This commit is contained in:
Matthias Clasen 2020-08-09 22:58:22 -04:00
parent bc20fe3cca
commit 6fafc8b811

View File

@ -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;
}