GNOME Bugzilla – Bug 735274
"Space" isn't working in search
Last modified: 2014-09-01 18:45:21 UTC
Reproduce: Always 1. launch Software and start typing 2. focus on search input entry is "lost", although you can still type 3. "Space" for adding multiple terms isn't working Clicking on search input give focus back and you can add "space"
I mentioned it in bug #710640, the correct fix would be focusing the search field when you start typing, it's a very trivial fix, I can make a patch if Kalev approves.
Created attachment 285048 [details] [review] Focus the search entry on keypress Patch attached. The trick with the "editable" property is needed because without doing it the text in the entry will be selected when we grab the focus, which will cause your next keystroke to replace what you already wrote, and this is something we really don't want. When setting "editable" to false gtk won't select the text in the entry when we grab the focus. I'll file a GTK bug later asking for this functionality to be added so that hack won't be needed, but for now I feel it's good enough to fix this bug. fwiw polari uses exactly the same trick, so we are not the only app that would benefit from GTK implementing a method for that.
Review of attachment 285048 [details] [review]: Looks good to me, thanks. Just add a source code comment about the editable property trick, please. ::: src/gs-shell.c @@ +399,3 @@ + g_object_set (entry, "editable", FALSE, NULL); + gtk_widget_grab_focus (entry); + g_object_set (entry, "editable", TRUE, NULL); Would be good if you could add a comment here explaining why this is needed.
Created attachment 285050 [details] [review] Focus the search entry on keypress Now with a short comment explaining why I'm doing the "editable" thing
Review of attachment 285050 [details] [review]: Looks good, thanks.
Review of attachment 285050 [details] [review]: Pushed as https://git.gnome.org/browse/gnome-software/commit/?id=6a9b217852588482a6a16caf423a97c9795b2604