Re: [patch] scrolling fix for GtkTreeView



On 2/27/02 11:50 AM, "Jonathan Blandford" <jrb redhat com> wrote:

>> @@ -3865,7 +3865,8 @@ validate_visible_area (GtkTreeView *tree
>>        gtk_tree_row_reference_free (tree_view->priv->top_row);
>>        tree_view->priv->top_row =
>>      gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view),
>> tree_view->priv->model, above_path);
>> -      tree_view->priv->top_row_dy = - area_above;
>> +      tree_view->priv->top_row_dy = MAX (GTK_RBNODE_GET_HEIGHT (node),
>> tree_view->priv->expander_size) + area_above;
> 
> top_row_dy is how far from the top of top_row the visible area starts.
> area_above is the amount left over while walking up the tree.  I think
> we want to change it to, as I don't think I properly handle the case
> where I run out of nodes.
> 
> if (area_above < 0)
> tree_view->priv->top_row_dy = - area_above;
> else
> tree_view->priv->top_row_dy = 0;

Maybe you should write some test code. You'll see that for the "didn't run
out of space" case, my code is correct. It's off by one row from what you
think it is, for one thing. When it's done walking up the tree, if it didn't
run out of space, the top row is going to be the row that should be
partially showing, and - area_above is the number of pixels of that row need
to show. That's why the row's height + area_above is the right value for
top_row_dy.

Anyway, I made a different fix for Nautilus, so this change no longer
matters to me, and I am not going to pursue it further. But I recommend you
look into it. I still think my patch is correct for the area_above < 0 case,
and I agree that you need code to handle the area_above == 0 case and the
case where you walk off the tree (node == NULL).

    -- Darin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]