treeview: if we are below rows that changed height: redraw

We have to redraw if we are below a couple of rows that changed height
in do_validate_rows().  This will still require a redraw for a large
amount of cases, can we do better?  You would expect that a redraw of
the tree view is not required when the dy changes with the same delta
as the delta of the height accrued when validating the nodes.  This
further optimization will likely require changes to the top_row/dy
synchronization code.
This commit is contained in:
Kristian Rietveld 2011-04-05 21:09:10 +02:00 committed by Benjamin Otte
parent 4594370b46
commit 4d5d915afe

View File

@ -6631,6 +6631,7 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
GTimer *timer;
gint i = 0;
gint y = -1;
gint prev_height = -1;
gboolean fixed_height = TRUE;
@ -6652,6 +6653,8 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
do
{
gboolean changed = FALSE;
if (! GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID))
{
retval = FALSE;
@ -6711,8 +6714,16 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
}
validated_area = validate_row (tree_view, tree, node, &iter, path) ||
validated_area;
changed = validate_row (tree_view, tree, node, &iter, path);
validated_area = changed || validated_area;
if (changed)
{
gint offset = gtk_tree_view_get_row_y_offset (tree_view, tree, node);
if (y == -1 || y > offset)
y = offset;
}
if (!tree_view->priv->fixed_height_check)
{
@ -6758,6 +6769,12 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
*/
gtk_tree_view_size_request (GTK_WIDGET (tree_view), &requisition, FALSE);
/* If rows above the current position have changed height, this has
* affected the current view and thus needs a redraw.
*/
if (y != -1 && y < gtk_adjustment_get_value (tree_view->priv->vadjustment))
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
gtk_adjustment_set_upper (tree_view->priv->hadjustment,
MAX (gtk_adjustment_get_upper (tree_view->priv->hadjustment), requisition.width));
gtk_adjustment_set_upper (tree_view->priv->vadjustment,