summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2018-03-23 16:22:05 +0100
committerCarlos Garnacho <carlosg@gnome.org>2018-04-05 19:26:55 +0200
commit362a6ca4698cf3c08f10bdee920e85eaa77c1e7b (patch)
tree53b1a9f1f50e42b5f28aefd0d8b3a81c269e7c67
parent73fe140b10d9d639cb0beb68278092e61fdca4d8 (diff)
downloadgtk+-362a6ca4698cf3c08f10bdee920e85eaa77c1e7b.tar.gz
gtkentry: Use key controller to track focus changes
-rw-r--r--gtk/gtkentry.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index e3e1086414..098c5bd53a 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2571,6 +2571,10 @@ gtk_entry_init (GtkEntry *entry)
G_CALLBACK (gtk_entry_key_controller_key_pressed), entry);
g_signal_connect_swapped (priv->key_controller, "im-update",
G_CALLBACK (gtk_entry_schedule_im_reset), entry);
+ g_signal_connect_swapped (priv->key_controller, "focus-in",
+ G_CALLBACK (gtk_entry_focus_in), entry);
+ g_signal_connect_swapped (priv->key_controller, "focus-out",
+ G_CALLBACK (gtk_entry_focus_out), entry);
gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (priv->key_controller),
priv->im_context);
@@ -3515,20 +3519,6 @@ gtk_entry_event (GtkWidget *widget,
gdouble x, y;
gint i = 0;
- if (gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE)
- {
- gboolean focus_in;
-
- gdk_event_get_focus_in (event, &focus_in);
-
- if (focus_in)
- gtk_entry_focus_in (widget);
- else
- gtk_entry_focus_out (widget);
-
- return GDK_EVENT_PROPAGATE;
- }
-
if (!gdk_event_get_coords (event, &x, &y))
return GDK_EVENT_PROPAGATE;