From 0771297449b29a3e33236ca88c79b3eb4d715e99 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Fri, 17 Jun 2005 17:34:40 +0000 Subject: [PATCH] make sure the row above 'above_path' is always in a validated state, so it 2005-06-17 Kristian Rietveld * gtk/gtktreeview.c (validate_visible_area): make sure the row above 'above_path' is always in a validated state, so it does not mess up scrolling. (#303319, testcase from Billy Biggs). --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtktreeview.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/ChangeLog b/ChangeLog index f605227dbd..1c2a311e24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-17 Kristian Rietveld + + * gtk/gtktreeview.c (validate_visible_area): make sure the row + above 'above_path' is always in a validated state, so it does + not mess up scrolling. (#303319, testcase from Billy Biggs). + 2005-06-17 Matthias Clasen * gdk/x11/gdkprivate-x11.h: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f605227dbd..1c2a311e24 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2005-06-17 Kristian Rietveld + + * gtk/gtktreeview.c (validate_visible_area): make sure the row + above 'above_path' is always in a validated state, so it does + not mess up scrolling. (#303319, testcase from Billy Biggs). + 2005-06-17 Matthias Clasen * gdk/x11/gdkprivate-x11.h: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f605227dbd..1c2a311e24 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2005-06-17 Kristian Rietveld + + * gtk/gtktreeview.c (validate_visible_area): make sure the row + above 'above_path' is always in a validated state, so it does + not mess up scrolling. (#303319, testcase from Billy Biggs). + 2005-06-17 Matthias Clasen * gdk/x11/gdkprivate-x11.h: diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index a9bb685db4..b070dab997 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -4784,6 +4784,42 @@ validate_visible_area (GtkTreeView *tree_view) above_path = gtk_tree_path_copy (path); + /* if we do not validate any row above the new top_row, we will make sure + * that the row immediately above top_row has been validated. (if we do not + * do this, _gtk_rbtree_find_offset will find the row above top_row, because + * when invalidated that row's height will be zero. and this will mess up + * scrolling). + */ + if (area_above == 0) + { + GtkRBTree *tree; + GtkRBNode *node; + GtkTreePath *tmppath; + GtkTreeIter iter; + + _gtk_tree_view_find_node (tree_view, above_path, &tree, &node); + + tmppath = gtk_tree_path_copy (above_path); + + _gtk_rbtree_prev_full (tree, node, &tree, &node); + if (! gtk_tree_path_prev (tmppath) && node != NULL) + { + gtk_tree_path_free (tmppath); + tmppath = _gtk_tree_view_find_path (tree_view, tree, node); + } + gtk_tree_model_get_iter (tree_view->priv->model, &iter, tmppath); + + if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) || + GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID)) + { + need_redraw = TRUE; + if (validate_row (tree_view, tree, node, &iter, path)) + size_changed = TRUE; + } + + gtk_tree_path_free (tmppath); + } + /* Now, we walk forwards and backwards, measuring rows. Unfortunately, * backwards is much slower then forward, as there is no iter_prev function. * We go forwards first in case we run out of tree. Then we go backwards to