summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-01-06 15:06:12 -0500
committerMatthias Clasen <mclasen@redhat.com>2018-01-16 14:14:10 -0500
commit04adcff6240904f78bf91f9a80d3f6aeebab322d (patch)
treeb70fe131866b4c347f80c5385b8d1e44906f426f
parent6d1dbec9dd457a33b0fadfb425d4c368fab4caba (diff)
downloadgtk+-04adcff6240904f78bf91f9a80d3f6aeebab322d.tar.gz
combo cell renderer: Stop using ::focus-out-event
The has-focus property works fine here.
-rw-r--r--gtk/gtkcellrenderercombo.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gtk/gtkcellrenderercombo.c b/gtk/gtkcellrenderercombo.c
index 14bc99fb21..da49c771cb 100644
--- a/gtk/gtkcellrenderercombo.c
+++ b/gtk/gtkcellrenderercombo.c
@@ -393,15 +393,13 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
g_free (new_text);
}
-static gboolean
-gtk_cell_renderer_combo_focus_out_event (GtkWidget *widget,
- GdkEvent *event,
- gpointer data)
+static void
+gtk_cell_renderer_combo_focus_change (GtkWidget *widget,
+ GParamSpec *pspec,
+ gpointer data)
{
-
- gtk_cell_renderer_combo_editing_done (GTK_CELL_EDITABLE (widget), data);
-
- return FALSE;
+ if (!gtk_widget_has_focus (widget))
+ gtk_cell_renderer_combo_editing_done (GTK_CELL_EDITABLE (widget), data);
}
typedef struct
@@ -520,8 +518,8 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
g_signal_connect (GTK_CELL_EDITABLE (combo), "changed",
G_CALLBACK (gtk_cell_renderer_combo_changed),
cell_combo);
- priv->focus_out_id = g_signal_connect (combo, "focus-out-event",
- G_CALLBACK (gtk_cell_renderer_combo_focus_out_event),
+ priv->focus_out_id = g_signal_connect (combo, "notify::has-focus",
+ G_CALLBACK (gtk_cell_renderer_combo_focus_change),
cell_combo);
priv->combo = combo;