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

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