From 04adcff6240904f78bf91f9a80d3f6aeebab322d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 6 Jan 2018 15:06:12 -0500 Subject: [PATCH] combo cell renderer: Stop using ::focus-out-event The has-focus property works fine here. --- gtk/gtkcellrenderercombo.c | 18 ++++++++---------- 1 file 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;