diff --git a/ChangeLog b/ChangeLog index 75fc70a910..8abc8099f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Sat Jul 12 15:28:26 2003 Kristian Rietveld + + This patch really really fixes scrolling. Related bugs: #81627, + testcase provided by Timo Sirainen, #111500, testcase provided by + manu, #113241, reported by Pedro Gimeno/Michael Natterer. + + * gtk/gtktreeview.c (validate_visible_area): scrolling to a dy + which is equal to the lower border of the window means scrolling + to an invisible row, always update the dy when scrolling to an + invisible row, corrected area_above/below calculations for + invisible rows, when walking the tree correct the size + subtracted for invalidated rows, fix wrong logic in comment. + Tue Jul 8 20:11:04 2003 Owen Taylor * gdk/x11/gdkevents-x11.c (get_real_window) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 75fc70a910..8abc8099f5 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +Sat Jul 12 15:28:26 2003 Kristian Rietveld + + This patch really really fixes scrolling. Related bugs: #81627, + testcase provided by Timo Sirainen, #111500, testcase provided by + manu, #113241, reported by Pedro Gimeno/Michael Natterer. + + * gtk/gtktreeview.c (validate_visible_area): scrolling to a dy + which is equal to the lower border of the window means scrolling + to an invisible row, always update the dy when scrolling to an + invisible row, corrected area_above/below calculations for + invisible rows, when walking the tree correct the size + subtracted for invalidated rows, fix wrong logic in comment. + Tue Jul 8 20:11:04 2003 Owen Taylor * gdk/x11/gdkevents-x11.c (get_real_window) diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 75fc70a910..8abc8099f5 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +Sat Jul 12 15:28:26 2003 Kristian Rietveld + + This patch really really fixes scrolling. Related bugs: #81627, + testcase provided by Timo Sirainen, #111500, testcase provided by + manu, #113241, reported by Pedro Gimeno/Michael Natterer. + + * gtk/gtktreeview.c (validate_visible_area): scrolling to a dy + which is equal to the lower border of the window means scrolling + to an invisible row, always update the dy when scrolling to an + invisible row, corrected area_above/below calculations for + invisible rows, when walking the tree correct the size + subtracted for invalidated rows, fix wrong logic in comment. + Tue Jul 8 20:11:04 2003 Owen Taylor * gdk/x11/gdkevents-x11.c (get_real_window) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 75fc70a910..8abc8099f5 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +Sat Jul 12 15:28:26 2003 Kristian Rietveld + + This patch really really fixes scrolling. Related bugs: #81627, + testcase provided by Timo Sirainen, #111500, testcase provided by + manu, #113241, reported by Pedro Gimeno/Michael Natterer. + + * gtk/gtktreeview.c (validate_visible_area): scrolling to a dy + which is equal to the lower border of the window means scrolling + to an invisible row, always update the dy when scrolling to an + invisible row, corrected area_above/below calculations for + invisible rows, when walking the tree correct the size + subtracted for invalidated rows, fix wrong logic in comment. + Tue Jul 8 20:11:04 2003 Owen Taylor * gdk/x11/gdkevents-x11.c (get_real_window) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 75fc70a910..8abc8099f5 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +Sat Jul 12 15:28:26 2003 Kristian Rietveld + + This patch really really fixes scrolling. Related bugs: #81627, + testcase provided by Timo Sirainen, #111500, testcase provided by + manu, #113241, reported by Pedro Gimeno/Michael Natterer. + + * gtk/gtktreeview.c (validate_visible_area): scrolling to a dy + which is equal to the lower border of the window means scrolling + to an invisible row, always update the dy when scrolling to an + invisible row, corrected area_above/below calculations for + invisible rows, when walking the tree correct the size + subtracted for invalidated rows, fix wrong logic in comment. + Tue Jul 8 20:11:04 2003 Owen Taylor * gdk/x11/gdkevents-x11.c (get_real_window) diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 714ffc78a9..15c058cf0e 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -3930,8 +3930,8 @@ validate_visible_area (GtkTreeView *tree_view) dy = _gtk_rbtree_node_find_offset (tree, node); if (dy >= tree_view->priv->vadjustment->value && - dy <= (tree_view->priv->vadjustment->value - + tree_view->priv->vadjustment->page_size)) + dy < (tree_view->priv->vadjustment->value + + tree_view->priv->vadjustment->page_size)) { /* row visible: keep the row at the same position */ area_above = dy - tree_view->priv->vadjustment->value; @@ -3942,13 +3942,14 @@ validate_visible_area (GtkTreeView *tree_view) else { /* row not visible */ + update_dy = TRUE; if (dy >= 0 && dy <= tree_view->priv->vadjustment->page_size) { /* row at the beginning -- fixed */ area_above = dy; area_below = tree_view->priv->vadjustment->page_size - - dy - height; + - area_above - height; } else if (dy >= (tree_view->priv->vadjustment->upper - tree_view->priv->vadjustment->page_size) @@ -3957,8 +3958,14 @@ validate_visible_area (GtkTreeView *tree_view) /* row at the end -- fixed */ area_above = dy - (tree_view->priv->vadjustment->upper - tree_view->priv->vadjustment->page_size); - area_below = tree_view->priv->vadjustment->upper - - dy - height; + area_below = tree_view->priv->vadjustment->page_size - + area_above - height; + + if (area_below < 0) + { + area_above += area_below; + area_below = 0; + } } else { @@ -4029,6 +4036,8 @@ validate_visible_area (GtkTreeView *tree_view) */ while (node && area_below > 0) { + gint new_height; + if (node->children) { GtkTreeIter parent = iter; @@ -4082,20 +4091,33 @@ validate_visible_area (GtkTreeView *tree_view) } while (!done); } + + if (!node) + break; + + new_height = GTK_RBNODE_GET_HEIGHT (node); + if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) || GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID)) { + gint old_height = new_height; + need_redraw = TRUE; if (validate_row (tree_view, tree, node, &iter, path)) - size_changed = TRUE; + { + new_height = GTK_RBNODE_GET_HEIGHT (node); + size_changed = TRUE; + + area_below -= new_height - old_height; + } } - if (node) - area_below -= MAX (GTK_RBNODE_GET_HEIGHT (node), tree_view->priv->expander_size); + + area_below -= MAX (new_height, tree_view->priv->expander_size); } gtk_tree_path_free (path); - /* If we ran out of tree, and have extra area_below left, we need to remove it - * from the area_above */ + /* If we ran out of tree, and have extra area_below left, we need to add it + * to area_above */ if (area_below > 0) area_above += area_below; @@ -4104,6 +4126,8 @@ validate_visible_area (GtkTreeView *tree_view) /* We walk backwards */ while (area_above > 0) { + gint new_height; + _gtk_rbtree_prev_full (tree, node, &tree, &node); if (! gtk_tree_path_prev (above_path) && node != NULL) { @@ -4115,14 +4139,23 @@ validate_visible_area (GtkTreeView *tree_view) if (node == NULL) break; + new_height = GTK_RBNODE_GET_HEIGHT (node); + if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) || GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID)) { + gint old_height = new_height; + need_redraw = TRUE; if (validate_row (tree_view, tree, node, &iter, above_path)) - size_changed = TRUE; + { + new_height = GTK_RBNODE_GET_HEIGHT (node); + size_changed = TRUE; + + area_above -= new_height - old_height; + } } - area_above -= MAX (GTK_RBNODE_GET_HEIGHT (node), tree_view->priv->expander_size); + area_above -= MAX (new_height, tree_view->priv->expander_size); update_dy = TRUE; }