gtktreeview: reduce validation stalls for fixed-height file lists
Use a shorter validation idle budget on general targets while retaining a longer ARMv6 budget for weak single-core hardware. Add an internal fixed-height-mode helper for FileChooser rows whose height is width-independent, and avoid unnecessary scrolling work when the first root row is already visible.
This commit is contained in:
parent
7af69af9c8
commit
608c99d92d
3 changed files with 45 additions and 3 deletions
|
|
@ -11770,6 +11770,11 @@ load_set_model (GtkFileChooserDefault *impl)
|
|||
g_assert (impl->browse_files_model != NULL);
|
||||
|
||||
profile_msg (" gtk_tree_view_set_model start", NULL);
|
||||
/* FileChooser list rows have width-independent height. */
|
||||
if (impl->view_mode == VIEW_MODE_LIST)
|
||||
_gtk_tree_view_set_fixed_height_mode_unchecked
|
||||
(GTK_TREE_VIEW (impl->browse_files_tree_view));
|
||||
|
||||
current_view_set_file_model (impl, GTK_TREE_MODEL (impl->browse_files_model));
|
||||
|
||||
if (impl->view_mode == VIEW_MODE_LIST)
|
||||
|
|
@ -16400,13 +16405,13 @@ current_view_set_file_model (GtkFileChooserDefault *impl, GtkTreeModel *model)
|
|||
|
||||
g_object_set (view, "model", impl->current_model, NULL);
|
||||
|
||||
icon_view_visible_range_schedule (impl);
|
||||
|
||||
/*
|
||||
* If an icon-view scale change has queued a delayed full cache clear, a model
|
||||
* can become visible before that timeout fires. Clear the newly visible model
|
||||
* immediately so it cannot show pixbufs cached for an older icon size.
|
||||
*/
|
||||
icon_view_visible_range_schedule (impl);
|
||||
|
||||
if (impl->view_mode == VIEW_MODE_ICON &&
|
||||
impl->icon_view_scale_timeout_id &&
|
||||
GTK_IS_FILE_SYSTEM_MODEL (impl->current_model))
|
||||
|
|
|
|||
|
|
@ -465,6 +465,10 @@ void _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *c
|
|||
gint *right);
|
||||
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void _gtk_tree_view_set_fixed_height_mode_unchecked
|
||||
(GtkTreeView *tree_view);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,11 @@
|
|||
|
||||
#define GTK_TREE_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
|
||||
#define GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC (GTK_TREE_VIEW_PRIORITY_VALIDATE + 2)
|
||||
#define GTK_TREE_VIEW_TIME_MS_PER_IDLE 30
|
||||
#if defined(__arm__) && defined(__ARM_ARCH) && (__ARM_ARCH == 6)
|
||||
#define GTK_TREE_VIEW_TIME_MS_PER_IDLE 10
|
||||
#else
|
||||
#define GTK_TREE_VIEW_TIME_MS_PER_IDLE 2
|
||||
#endif
|
||||
#define SCROLL_EDGE_SIZE 15
|
||||
#define EXPANDER_EXTRA_PADDING 4
|
||||
#define GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT 5000
|
||||
|
|
@ -7732,6 +7736,25 @@ column_sizing_notify (GObject *object,
|
|||
g_object_set (data, "fixed-height-mode", FALSE, NULL);
|
||||
}
|
||||
|
||||
/* Internal fixed-height mode for width-independent rows. */
|
||||
G_GNUC_INTERNAL
|
||||
void
|
||||
_gtk_tree_view_set_fixed_height_mode_unchecked (GtkTreeView *tree_view)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
||||
|
||||
if (tree_view->priv->fixed_height_mode)
|
||||
return;
|
||||
|
||||
tree_view->priv->fixed_height_mode = TRUE;
|
||||
tree_view->priv->fixed_height = -1;
|
||||
|
||||
if (tree_view->priv->tree)
|
||||
initialize_fixed_height_mode (tree_view);
|
||||
|
||||
g_object_notify (G_OBJECT (tree_view), "fixed-height-mode");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_view_set_fixed_height_mode:
|
||||
* @tree_view: a #GtkTreeView
|
||||
|
|
@ -8927,6 +8950,16 @@ gtk_tree_view_clamp_node_visible (GtkTreeView *tree_view,
|
|||
path = _gtk_tree_view_find_path (tree_view, tree, node);
|
||||
if (path)
|
||||
{
|
||||
/* The first root row at the top cannot require scrolling. */
|
||||
if (tree_view->priv->vadjustment->value <=
|
||||
tree_view->priv->vadjustment->lower &&
|
||||
gtk_tree_path_get_depth (path) == 1 &&
|
||||
gtk_tree_path_get_indices (path)[0] == 0)
|
||||
{
|
||||
gtk_tree_path_free (path);
|
||||
return;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
gdk_window_process_updates (tree_view->priv->bin_window, TRUE);
|
||||
|
|
|
|||
Loading…
Reference in a new issue