summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson Benitez Leon <[email protected]>2017-05-28 22:35:05 +0500
committerraveit65 <[email protected]>2017-08-15 14:09:42 +0200
commit744a1c5e8259773b35600944c28189b98879f937 (patch)
treebab176ebe90367d9060b2cadda7f0ed56e50fca4
parent43895b016112550614db76212d921097d35b98e7 (diff)
downloadatril-744a1c5e8259773b35600944c28189b98879f937.tar.bz2
atril-744a1c5e8259773b35600944c28189b98879f937.tar.xz
sidebar-thumbnails: fix clunky scrolling
Caused by GtkIconView doing an invalidate and relayout of *all* items in the view anytime we update model data in any indiviual item (which happens with all the items that are getting in and out of the scrolling area while we scroll). This caused GtkIconView to machine-gunned us with "size-allocate" signals, a signal we were using to update thumbnails when the sidebar is resized. Fixed by connecting to the GtkTreeModel "row-changed" signal before GtkIconView does it, and stop emission from there. As we don't depend now on "size-allocate" signals to show thumbnails while we scroll, just queue a draw on the icon view when a thumbnail finish rendering. Thanks Jose Aliste for first spotting the problem. https://bugzilla.gnome.org/show_bug.cgi?id=691448 origin commit: https://git.gnome.org/browse/evince/commit/?id=6480c70 Fixes https://github.com/mate-desktop/atril/issues/255
-rw-r--r--shell/ev-sidebar-thumbnails.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 0c420f57..f7f92666 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -726,9 +726,26 @@ ev_sidebar_thumbnails_use_icon_view (EvSidebarThumbnails *sidebar_thumbnails)
}
static void
+ev_sidebar_thumbnails_row_changed (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ guint signal_id;
+
+ signal_id = GPOINTER_TO_UINT (data);
+
+ /* PREVENT GtkIconView "row-changed" handler to be reached, as it will
+ * perform a full invalidate and relayout of all items, See bug:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=691448#c9 */
+ g_signal_stop_emission (model, signal_id, 0);
+}
+
+static void
ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails)
{
EvSidebarThumbnailsPrivate *priv;
+ guint signal_id;
priv = ev_sidebar_thumbnails->priv = EV_SIDEBAR_THUMBNAILS_GET_PRIVATE (ev_sidebar_thumbnails);
@@ -738,6 +755,11 @@ ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails)
G_TYPE_BOOLEAN,
EV_TYPE_JOB_THUMBNAIL);
+ signal_id = g_signal_lookup ("row-changed", GTK_TYPE_TREE_MODEL);
+ g_signal_connect (GTK_TREE_MODEL (priv->list_store), "row-changed",
+ G_CALLBACK (ev_sidebar_thumbnails_row_changed),
+ GUINT_TO_POINTER (signal_id));
+
priv->swindow = gtk_scrolled_window_new (NULL, NULL);
/* We actually don't want GTK_POLICY_AUTOMATIC for horizontal scrollbar here
@@ -870,6 +892,8 @@ thumbnail_job_completed_callback (EvJobThumbnail *job,
COLUMN_THUMBNAIL_SET, TRUE,
COLUMN_JOB, NULL,
-1);
+
+ gtk_widget_queue_draw (priv->icon_view);
}
static void