Blame SOURCES/0001-sidebar-thumbnails-fix-clunky-scrolling.patch

a29641
From 6480c7039bdf7e8f15f7d1415460db255910c40b Mon Sep 17 00:00:00 2001
a29641
From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?=
a29641
 <nbenitezl+gnome@gmail.com>
a29641
Date: Sun, 28 May 2017 22:35:05 +0500
a29641
Subject: [PATCH] sidebar-thumbnails: fix clunky scrolling
a29641
a29641
Caused by GtkIconView doing an invalidate and relayout of *all*
a29641
items in the view anytime we update model data in any indiviual
a29641
item (which happens with all the items that are getting in and out
a29641
of the scrolling area while we scroll). This caused GtkIconView to
a29641
machine-gunned us with "size-allocate" signals, a signal we were
a29641
using to update thumbnails when the sidebar is resized.
a29641
a29641
Fixed by connecting to the GtkTreeModel "row-changed" signal before
a29641
GtkIconView does it, and stop emission from there.
a29641
a29641
As we don't depend now on "size-allocate" signals to show thumbnails
a29641
while we scroll, just queue a draw on the icon view when a
a29641
thumbnail finish rendering.
a29641
a29641
Thanks Jose Aliste for first spotting the problem.
a29641
a29641
https://bugzilla.gnome.org/show_bug.cgi?id=691448
a29641
---
a29641
 shell/ev-sidebar-thumbnails.c | 24 ++++++++++++++++++++++++
a29641
 1 file changed, 24 insertions(+)
a29641
a29641
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
a29641
index 253eabf..c22e92e 100644
a29641
--- a/shell/ev-sidebar-thumbnails.c
a29641
+++ b/shell/ev-sidebar-thumbnails.c
a29641
@@ -802,9 +802,26 @@ ev_sidebar_thumbnails_device_scale_factor_changed_cb (EvSidebarThumbnails *sideb
a29641
 }
a29641
 
a29641
 static void
a29641
+ev_sidebar_thumbnails_row_changed (GtkTreeModel *model,
a29641
+                                   GtkTreePath  *path,
a29641
+                                   GtkTreeIter  *iter,
a29641
+                                   gpointer      data)
a29641
+{
a29641
+	guint signal_id;
a29641
+
a29641
+	signal_id = GPOINTER_TO_UINT (data);
a29641
+
a29641
+	/* PREVENT GtkIconView "row-changed" handler to be reached, as it will
a29641
+	 * perform a full invalidate and relayout of all items, See bug:
a29641
+	 * https://bugzilla.gnome.org/show_bug.cgi?id=691448#c9 */
a29641
+	g_signal_stop_emission (model, signal_id, 0);
a29641
+}
a29641
+
a29641
+static void
a29641
 ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails)
a29641
 {
a29641
 	EvSidebarThumbnailsPrivate *priv;
a29641
+	guint signal_id;
a29641
 
a29641
 	priv = ev_sidebar_thumbnails->priv = EV_SIDEBAR_THUMBNAILS_GET_PRIVATE (ev_sidebar_thumbnails);
a29641
 
a29641
@@ -814,6 +831,11 @@ ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails)
a29641
 					       G_TYPE_BOOLEAN,
a29641
 					       EV_TYPE_JOB_THUMBNAIL);
a29641
 
a29641
+	signal_id = g_signal_lookup ("row-changed", GTK_TYPE_TREE_MODEL);
a29641
+	g_signal_connect (GTK_TREE_MODEL (priv->list_store), "row-changed",
a29641
+			  G_CALLBACK (ev_sidebar_thumbnails_row_changed),
a29641
+			  GUINT_TO_POINTER (signal_id));
a29641
+
a29641
 	priv->swindow = gtk_scrolled_window_new (NULL, NULL);
a29641
 
a29641
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->swindow),
a29641
@@ -962,6 +984,8 @@ thumbnail_job_completed_callback (EvJobThumbnail      *job,
a29641
 			    COLUMN_JOB, NULL,
a29641
 			    -1);
a29641
         cairo_surface_destroy (surface);
a29641
+
a29641
+        gtk_widget_queue_draw (priv->icon_view);
a29641
 }
a29641
 
a29641
 static void
a29641
-- 
a29641
2.9.4
a29641