GtkTreeView: Avoid interference with animation

The animated scrolling interferes with incremental validation.
As short-term solution, disable scrolling animation during
incremental validation. This is not a proper solution, but
it avoids broken behavior like scrollbars that are not reacting
to clicks. The problem was visible, e.g. in the list view
example in gtk3-demo.
This commit is contained in:
Matthias Clasen 2014-07-13 22:00:59 -04:00
parent aa5afb38e8
commit daf05ad987

View File

@ -6919,11 +6919,31 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
return retval;
}
static void
disable_adjustment_animation (GtkTreeView *tree_view)
{
gtk_adjustment_enable_animation (tree_view->priv->vadjustment,
NULL,
gtk_adjustment_get_animation_duration (tree_view->priv->vadjustment));
}
static void
maybe_reenable_adjustment_animation (GtkTreeView *tree_view)
{
if (tree_view->priv->presize_handler_tick_cb != 0 ||
tree_view->priv->validate_rows_timer != 0)
return;
gtk_adjustment_enable_animation (tree_view->priv->vadjustment,
gtk_widget_get_frame_clock (GTK_WIDGET (tree_view)),
gtk_adjustment_get_animation_duration (tree_view->priv->vadjustment));
}
static gboolean
do_presize_handler (GtkTreeView *tree_view)
{
if (tree_view->priv->mark_rows_col_dirty)
{
{
if (tree_view->priv->tree)
_gtk_rbtree_column_invalid (tree_view->priv->tree);
tree_view->priv->mark_rows_col_dirty = FALSE;
@ -6948,7 +6968,9 @@ do_presize_handler (GtkTreeView *tree_view)
MAX (gtk_adjustment_get_upper (tree_view->priv->vadjustment), requisition.height));
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
maybe_reenable_adjustment_animation (tree_view);
return FALSE;
}
@ -6979,6 +7001,7 @@ validate_rows (GtkTreeView *tree_view)
{
g_source_remove (tree_view->priv->validate_rows_timer);
tree_view->priv->validate_rows_timer = 0;
maybe_reenable_adjustment_animation (tree_view);
}
return retval;
@ -6990,6 +7013,8 @@ install_presize_handler (GtkTreeView *tree_view)
if (! gtk_widget_get_realized (GTK_WIDGET (tree_view)))
return;
disable_adjustment_animation (tree_view);
if (! tree_view->priv->presize_handler_tick_cb)
{
tree_view->priv->presize_handler_tick_cb =