button: Stop using ::key-release-event

Use the generic ::event signal instead.
This commit is contained in:
Matthias Clasen 2018-05-20 11:48:09 -04:00
parent c78166e190
commit 6084a7ea89

View File

@ -136,7 +136,7 @@ static void gtk_button_get_property (GObject *object,
static void gtk_button_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
static void gtk_button_unrealize (GtkWidget * widget);
static gint gtk_button_key_release (GtkWidget * widget, GdkEventKey * event);
static gint gtk_button_event (GtkWidget * widget, GdkEvent * event);
static void gtk_real_button_clicked (GtkButton * button);
static void gtk_real_button_activate (GtkButton *button);
static void gtk_button_update_state (GtkButton *button);
@ -220,7 +220,7 @@ gtk_button_class_init (GtkButtonClass *klass)
widget_class->measure = gtk_button_measure_;
widget_class->display_changed = gtk_button_display_changed;
widget_class->unrealize = gtk_button_unrealize;
widget_class->key_release_event = gtk_button_key_release;
widget_class->event = gtk_button_event;
widget_class->state_flags_changed = gtk_button_state_flags_changed;
widget_class->grab_notify = gtk_button_grab_notify;
widget_class->unmap = gtk_button_unmap;
@ -762,21 +762,24 @@ gtk_button_do_release (GtkButton *button,
}
static gboolean
gtk_button_key_release (GtkWidget *widget,
GdkEventKey *event)
gtk_button_event (GtkWidget *widget,
GdkEvent *event)
{
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
if (gdk_event_get_event_type (event) != GDK_KEY_RELEASE)
return GDK_EVENT_PROPAGATE;
if (priv->activate_timeout)
{
gtk_button_finish_activate (button, TRUE);
return TRUE;
return GDK_EVENT_STOP;
}
else if (GTK_WIDGET_CLASS (gtk_button_parent_class)->key_release_event)
return GTK_WIDGET_CLASS (gtk_button_parent_class)->key_release_event (widget, event);
else if (GTK_WIDGET_CLASS (gtk_button_parent_class)->event)
return GTK_WIDGET_CLASS (gtk_button_parent_class)->event (widget, event);
else
return FALSE;
return GDK_EVENT_PROPAGATE;
}
static void