From ca633e17f4577c43a076f67c64b14222ece070cf Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Sun, 27 Oct 2002 14:53:54 +0000 Subject: [PATCH] This fixes a scrolling bug. Shouldn't cause problems, but you never know Sun Oct 27 15:58:30 2002 Kristian Rietveld This fixes a scrolling bug. Shouldn't cause problems, but you never know ... (#81627, testcase by Timo Sirainen). * gtk/gtktreeview.c (validate_visible_area): add a temporary implemention for non use_align, always update dy and ->top_row if we scroll here, (gtk_tree_view_clamp_node_visible): reimplement using _scroll_to_cell (#73895). --- ChangeLog | 11 +++++++++++ ChangeLog.pre-2-10 | 11 +++++++++++ ChangeLog.pre-2-2 | 11 +++++++++++ ChangeLog.pre-2-4 | 11 +++++++++++ ChangeLog.pre-2-6 | 11 +++++++++++ ChangeLog.pre-2-8 | 11 +++++++++++ gtk/gtktreeview.c | 49 ++++++++++++++++++++++++---------------------- 7 files changed, 92 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb33818503..b2f14f52e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Sun Oct 27 15:58:30 2002 Kristian Rietveld + + This fixes a scrolling bug. Shouldn't cause problems, but you + never know ... (#81627, testcase by Timo Sirainen). + + * gtk/gtktreeview.c (validate_visible_area): add a temporary + implemention for non use_align, always update dy and ->top_row + if we scroll here, + (gtk_tree_view_clamp_node_visible): reimplement using + _scroll_to_cell (#73895). + Sun Oct 27 11:41:37 GMT 2002 Tony Gale * docs/tutorial/gtk-tut.sgml: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cb33818503..b2f14f52e4 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Sun Oct 27 15:58:30 2002 Kristian Rietveld + + This fixes a scrolling bug. Shouldn't cause problems, but you + never know ... (#81627, testcase by Timo Sirainen). + + * gtk/gtktreeview.c (validate_visible_area): add a temporary + implemention for non use_align, always update dy and ->top_row + if we scroll here, + (gtk_tree_view_clamp_node_visible): reimplement using + _scroll_to_cell (#73895). + Sun Oct 27 11:41:37 GMT 2002 Tony Gale * docs/tutorial/gtk-tut.sgml: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index cb33818503..b2f14f52e4 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +Sun Oct 27 15:58:30 2002 Kristian Rietveld + + This fixes a scrolling bug. Shouldn't cause problems, but you + never know ... (#81627, testcase by Timo Sirainen). + + * gtk/gtktreeview.c (validate_visible_area): add a temporary + implemention for non use_align, always update dy and ->top_row + if we scroll here, + (gtk_tree_view_clamp_node_visible): reimplement using + _scroll_to_cell (#73895). + Sun Oct 27 11:41:37 GMT 2002 Tony Gale * docs/tutorial/gtk-tut.sgml: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cb33818503..b2f14f52e4 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Sun Oct 27 15:58:30 2002 Kristian Rietveld + + This fixes a scrolling bug. Shouldn't cause problems, but you + never know ... (#81627, testcase by Timo Sirainen). + + * gtk/gtktreeview.c (validate_visible_area): add a temporary + implemention for non use_align, always update dy and ->top_row + if we scroll here, + (gtk_tree_view_clamp_node_visible): reimplement using + _scroll_to_cell (#73895). + Sun Oct 27 11:41:37 GMT 2002 Tony Gale * docs/tutorial/gtk-tut.sgml: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cb33818503..b2f14f52e4 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Sun Oct 27 15:58:30 2002 Kristian Rietveld + + This fixes a scrolling bug. Shouldn't cause problems, but you + never know ... (#81627, testcase by Timo Sirainen). + + * gtk/gtktreeview.c (validate_visible_area): add a temporary + implemention for non use_align, always update dy and ->top_row + if we scroll here, + (gtk_tree_view_clamp_node_visible): reimplement using + _scroll_to_cell (#73895). + Sun Oct 27 11:41:37 GMT 2002 Tony Gale * docs/tutorial/gtk-tut.sgml: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cb33818503..b2f14f52e4 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Sun Oct 27 15:58:30 2002 Kristian Rietveld + + This fixes a scrolling bug. Shouldn't cause problems, but you + never know ... (#81627, testcase by Timo Sirainen). + + * gtk/gtktreeview.c (validate_visible_area): add a temporary + implemention for non use_align, always update dy and ->top_row + if we scroll here, + (gtk_tree_view_clamp_node_visible): reimplement using + _scroll_to_cell (#73895). + Sun Oct 27 11:41:37 GMT 2002 Tony Gale * docs/tutorial/gtk-tut.sgml: diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 6aaf2b84cc..831bf705cb 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -3824,7 +3824,7 @@ validate_visible_area (GtkTreeView *tree_view) GtkRBNode *node = NULL; gboolean need_redraw = FALSE; gboolean size_changed = FALSE; - gboolean modify_dy = FALSE; + gboolean update_dy = FALSE; gint total_height; gint area_above = 0; gint area_below = 0; @@ -3867,10 +3867,11 @@ validate_visible_area (GtkTreeView *tree_view) } else { - /* FIXME: */ - g_warning ("non use_align not implemented yet"); - gtk_tree_path_free (path); - path = NULL; + /* FIXME: temporary solution, just validate a complete height + * and all will be fine... + */ + area_above = total_height; + area_below = total_height; } } else @@ -4025,7 +4026,7 @@ validate_visible_area (GtkTreeView *tree_view) size_changed = TRUE; } area_above -= MAX (GTK_RBNODE_GET_HEIGHT (node), tree_view->priv->expander_size); - modify_dy = TRUE; + update_dy = TRUE; } if (size_changed) @@ -4041,8 +4042,19 @@ validate_visible_area (GtkTreeView *tree_view) gtk_widget_queue_resize (GTK_WIDGET (tree_view)); } + /* if we scroll at all, always update dy and kill the top_row */ + if (tree_view->priv->scroll_to_path) + { + update_dy = TRUE; + if (tree_view->priv->top_row) + { + gtk_tree_row_reference_free (tree_view->priv->top_row); + tree_view->priv->top_row = NULL; + } + } + /* if we walk backwards at all, then we need to reset our dy. */ - if (modify_dy) + if (update_dy) { gint dy; if (node != NULL) @@ -6484,28 +6496,20 @@ gtk_tree_view_clamp_node_visible (GtkTreeView *tree_view, GtkRBTree *tree, GtkRBNode *node) { - GdkRectangle cell_rect; - GdkRectangle vis_rect; - gint dest_y; + GtkTreePath *path = NULL; /* We process updates because we want to clear old selected items when we scroll. * if this is removed, we get a "selection streak" at the bottom. */ if (!GTK_WIDGET_REALIZED (tree_view)) return; - gdk_window_process_updates (tree_view->priv->bin_window, TRUE); - cell_rect.y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, BACKGROUND_FIRST_PIXEL (tree_view, tree, node)); - cell_rect.height = BACKGROUND_HEIGHT (node); - gtk_tree_view_get_visible_rect (tree_view, &vis_rect); + path = _gtk_tree_view_find_path (tree_view, tree, node); - dest_y = vis_rect.y; - - if (cell_rect.y + cell_rect.height > vis_rect.y + vis_rect.height) - dest_y = cell_rect.y + cell_rect.height - vis_rect.height; - if (cell_rect.y < vis_rect.y) - dest_y = cell_rect.y; - - gtk_tree_view_scroll_to_point (tree_view, -1, dest_y); + if (path) + { + gtk_tree_view_scroll_to_cell (tree_view, path, NULL, FALSE, 0.0, 0.0); + gtk_tree_path_free (path); + } } static void @@ -7701,7 +7705,6 @@ gtk_tree_view_adjustment_changed (GtkAdjustment *adjustment, gtk_tree_view_dy_to_top_row (tree_view); gdk_window_process_updates (tree_view->priv->bin_window, TRUE); gdk_window_process_updates (tree_view->priv->header_window, TRUE); - } }