From ac398471872d8c2df61428df85a657427de581a5 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Thu, 17 Oct 2019 14:32:24 +0200 Subject: [PATCH] GtkEntry: Make GtkEntry: gtk_entry_grab_focus_without_selecting () behave like gtk_widget_grab_focus () Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2204 --- gtk/gtkentry.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index eec28a5ba9..297dd0fe63 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -5039,7 +5039,14 @@ void _gtk_entry_grab_focus (GtkEntry *entry, gboolean select_all) { + if (!gtk_widget_get_can_focus (GTK_WIDGET (entry))) + return; + + if (!gtk_widget_is_sensitive (GTK_WIDGET (entry))) + return; + GTK_WIDGET_CLASS (gtk_entry_parent_class)->grab_focus (GTK_WIDGET (entry)); + if (select_all) gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); }