GNOME Bugzilla – Bug 741130
Entry completion with multiple cells can size wrong on first appearance
Last modified: 2014-12-10 21:35:14 UTC
Created attachment 292150 [details] gjs minimal example Noticed this in yelp. Sometimes the search completion will show up too small, and I think its because yelp adds some custom cells into its treeview. You can easily reproduce in yelp by typing "pri" in the search to match printing help pages. The entry completion will show up very small with a scrollbar. Typing another character will cause it to pop to the correct size. Attaching a minimal example gjs script. Open it up and type "a" and the completion will show up too small. Delete "a" and type "b" and the completion will show up properly.
Entry completion is the one place in all of gtk that gtk_tree_view_column_cell_get_size is called outside of the tree view itself. https://git.gnome.org/browse/gtk+/tree/gtk/gtkentrycompletion.c#n1528 It calls into the column size function before the tree view has validated its cell state. In particulate validate_rows in gtktreeview.c will trigger gtk_cell_area_apply_attributes on the cell areas. Attaching a patch that calls gtk_widget_get_preferred_size on the tree view before calling gtk_tree_view_column_cell_get_size, ensuring the tree view runs validate_rows first. Seemed like the simplest fix without a larger rewrite of entry completion's sizing code. But there's also quite a lot of code to track here between all tree view, columns and cells, so I might be missing a better fix.
Created attachment 292152 [details] [review] patch fix
Created attachment 292164 [details] [review] patch fix
Review of attachment 292164 [details] [review]: looks ok as a hacky workaround. Just please strip the internal bug ref from the commit message. Or replace it with a publicly accessible url
Pushed to master.