treeview: Always call grab_focus_without_selecting on search entry
authorMat <mail@mathias.is>
Thu, 18 Aug 2022 15:03:04 +0000 (18:03 +0300)
committerMat <mail@mathias.is>
Thu, 18 Aug 2022 15:03:04 +0000 (18:03 +0300)
The search text entry is always a GtkText widget, not GtkEntry. If a
custom search entry is set, this part of the code is never reached.

Fixes #4551

gtk/gtktreeview.c

index aade224e97871ccf43638ba2e3c7dbc3cf28393e..5c627b4fb2ea6a7552ff1f1376e0fbb085e2fcc5 100644 (file)
@@ -10090,10 +10090,7 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
     gtk_editable_set_text (GTK_EDITABLE (priv->search_entry), "");
 
   /* Grab focus without selecting all the text. */
-  if (GTK_IS_ENTRY (priv->search_entry))
-    gtk_entry_grab_focus_without_selecting (GTK_ENTRY (priv->search_entry));
-  else
-    gtk_widget_grab_focus (priv->search_entry);
+  gtk_text_grab_focus_without_selecting (GTK_TEXT (priv->search_entry));
 
   gtk_popover_popup (GTK_POPOVER (priv->search_popover));
   if (priv->search_entry_changed_id == 0)