diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-02-07 19:36:48 -0500 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-04-05 19:26:54 +0200 |
commit | df386f29ab255d2a1a8fc8fc31f54491f1738286 (patch) | |
tree | d43265a2b1caa6590ee69a59cac3f3ea134a72f0 /gtk/gtkcombobox.c | |
parent | ec84fb90bfe0cfd5b483da42041f87aed245e648 (diff) | |
download | gtk+-df386f29ab255d2a1a8fc8fc31f54491f1738286.tar.gz |
combo box: Stop using ::key-press-event
Switch to using ::event.
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r-- | gtk/gtkcombobox.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 0996ae4ff6..831c064539 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -278,8 +278,8 @@ static void gtk_combo_box_menu_activate (GtkWidget *menu, const gchar *path, GtkComboBox *combo_box); static void gtk_combo_box_update_sensitivity (GtkComboBox *combo_box); -static gboolean gtk_combo_box_menu_key_press (GtkWidget *widget, - GdkEventKey *event, +static gboolean gtk_combo_box_menu_event (GtkWidget *widget, + GdkEvent *event, gpointer data); static void gtk_combo_box_menu_popup (GtkComboBox *combo_box); @@ -846,7 +846,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) gtk_widget_class_bind_template_child_internal_private (widget_class, GtkComboBox, popup_widget); gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_button_toggled); gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_menu_activate); - gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_menu_key_press); + gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_menu_event); gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_menu_show); gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_menu_hide); @@ -1937,18 +1937,18 @@ gtk_combo_box_model_row_changed (GtkTreeModel *model, } static gboolean -gtk_combo_box_menu_key_press (GtkWidget *widget, - GdkEventKey *event, - gpointer data) +gtk_combo_box_menu_event (GtkWidget *widget, + GdkEvent *event, + gpointer data) { GtkComboBox *combo_box = GTK_COMBO_BOX (data); - if (!gtk_bindings_activate_event (G_OBJECT (widget), event)) + if (!gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)event)) { /* The menu hasn't managed the * event, forward it to the combobox */ - gtk_bindings_activate_event (G_OBJECT (combo_box), event); + gtk_bindings_activate_event (G_OBJECT (combo_box), (GdkEventKey *)event); } return TRUE; @@ -2738,14 +2738,17 @@ gtk_combo_box_dispose (GObject* object) } static gboolean -gtk_cell_editable_key_press (GtkWidget *widget, - GdkEventKey *event, - gpointer data) +gtk_cell_editable_event (GtkWidget *widget, + GdkEvent *event, + gpointer data) { GtkComboBox *combo_box = GTK_COMBO_BOX (data); guint keyval; - if (!gdk_event_get_keyval ((GdkEvent *) event, &keyval)) + if (gdk_event_get_event_type (event) != GDK_KEY_PRESS) + return GDK_EVENT_PROPAGATE; + + if (!gdk_event_get_keyval (event, &keyval)) return GDK_EVENT_PROPAGATE; if (keyval == GDK_KEY_Escape) @@ -2783,8 +2786,8 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, if (priv->cell_view) { - g_signal_connect_object (priv->button, "key-press-event", - G_CALLBACK (gtk_cell_editable_key_press), + g_signal_connect_object (priv->button, "event", + G_CALLBACK (gtk_cell_editable_event), cell_editable, 0); gtk_widget_grab_focus (priv->button); @@ -2793,8 +2796,8 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, { child = gtk_bin_get_child (GTK_BIN (combo_box)); - g_signal_connect_object (child, "key-press-event", - G_CALLBACK (gtk_cell_editable_key_press), + g_signal_connect_object (child, "event", + G_CALLBACK (gtk_cell_editable_event), cell_editable, 0); gtk_widget_grab_focus (child); |