[gtk+] treeview: Don't invalidate whole tree unless needed
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] treeview: Don't invalidate whole tree unless needed
- Date: Thu, 6 Dec 2012 21:31:48 +0000 (UTC)
commit 4ca293e006a00ce8529e17d9202faaf68f57ff6f
Author: Alexander Larsson <alexl redhat com>
Date: Thu Dec 6 22:28:11 2012 +0100
treeview: Don't invalidate whole tree unless needed
We currently invalidate the whole tree every time the style state
changes in the tree view. The primary reason for this is to catch
default font changes as that may affect text cell renderers. But
cell renderers could *potentially* also read other style properties
(although that seems weird and unlikely).
We handle this by invalidating only when some state that affects sizes
is changed. This includes all the font properties.
gtk/gtktreeview.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index d651bd6..c422172 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -8461,6 +8461,8 @@ gtk_tree_view_style_updated (GtkWidget *widget)
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *list;
GtkTreeViewColumn *column;
+ GtkStyleContext *style_context;
+ const GtkBitmask *changes;
GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->style_updated (widget);
@@ -8472,16 +8474,19 @@ gtk_tree_view_style_updated (GtkWidget *widget)
gtk_tree_view_set_enable_tree_lines (tree_view, tree_view->priv->tree_lines_enabled);
}
- for (list = tree_view->priv->columns; list; list = list->next)
+ style_context = gtk_widget_get_style_context (widget);
+ changes = _gtk_style_context_get_changes (style_context);
+ if (changes == NULL || _gtk_css_style_property_changes_affect_size (changes))
{
- column = list->data;
- _gtk_tree_view_column_cell_set_dirty (column, TRUE);
- }
-
- tree_view->priv->fixed_height = -1;
- _gtk_rbtree_mark_invalid (tree_view->priv->tree);
+ for (list = tree_view->priv->columns; list; list = list->next)
+ {
+ column = list->data;
+ _gtk_tree_view_column_cell_set_dirty (column, TRUE);
+ }
- gtk_widget_queue_resize (widget);
+ tree_view->priv->fixed_height = -1;
+ _gtk_rbtree_mark_invalid (tree_view->priv->tree);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]