summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Watson <mattdangerw@gmail.com>2014-12-03 00:24:43 -0800
committerMatthias Clasen <mclasen@redhat.com>2015-01-10 21:19:42 -0500
commiteddb6eb0865b064067ff5c3228e742f657bb168e (patch)
treeefdbeb6ac3cefb8a451a2efadfab7f7a1139a0ce
parent393e4205ec55fbda539365284f17040b53c4ed96 (diff)
downloadgtk+-eddb6eb0865b064067ff5c3228e742f657bb168e.tar.gz
GtkEntryCompletion: fix sizing bug with multiple cells
When using a completion with some custom cells in the cell layout, if would often size wrong when first presented on screen. The entry completion is the only place in the entire gtk code base that calls gtk_tree_view_column_cell_get_size outside of gtktreeview itself. It calls into the function before the tree view has done some important validation on its cell state, the net result of which is only the first element in the gtkcellareabox the entry completion uses well actually have its size respected. We now call gtk_widget_get_preferred_size on the tree view before calling into the individual cell size routines, to guarantee that the tree view has run its validate_rows routine and cell state is valid. https://bugzilla.gnome.org/show_bug.cgi?id=741130
-rw-r--r--gtk/gtkentrycompletion.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 5ab09d99f3..b0f0882475 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -1499,6 +1499,7 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
GdkWindow *window;
GtkRequisition popup_req;
GtkRequisition entry_req;
+ GtkRequisition tree_req;
GtkTreePath *path;
gboolean above;
gint width;
@@ -1525,6 +1526,11 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL);
action_column = gtk_tree_view_get_column (GTK_TREE_VIEW (completion->priv->action_view), 0);
+ /* Call get preferred size on the on the tree view to force it to validate its
+ * cells before calling into the cell size functions.
+ */
+ gtk_widget_get_preferred_size (completion->priv->tree_view,
+ &tree_req, NULL);
gtk_tree_view_column_cell_get_size (completion->priv->column, NULL,
NULL, NULL, NULL, &height);
gtk_tree_view_column_cell_get_size (action_column, NULL,