From 2ff7b5726032712943040247d6cb9b7a60aa38b1daca8e0002b86efa84badd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Tue, 11 Oct 2016 11:52:17 +0000 Subject: [PATCH] Accepting request 433985 from home:qzhao:branches:GNOME:Factory Porting upstream's solution to work out the general aspect (bsc#979072, bgo#765601). OBS-URL: https://build.opensuse.org/request/show/433985 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/nautilus?expand=0&rev=264 --- nautilus-fix-desktop-icon-smash.patch | 106 ++++++++++++++++++++------ nautilus.changes | 7 ++ 2 files changed, 91 insertions(+), 22 deletions(-) diff --git a/nautilus-fix-desktop-icon-smash.patch b/nautilus-fix-desktop-icon-smash.patch index c40704c..41e0678 100644 --- a/nautilus-fix-desktop-icon-smash.patch +++ b/nautilus-fix-desktop-icon-smash.patch @@ -1,23 +1,85 @@ -Index: nautilus-3.21.91/src/nautilus-canvas-container.c -=================================================================== ---- nautilus-3.21.91.orig/src/nautilus-canvas-container.c -+++ nautilus-3.21.91/src/nautilus-canvas-container.c -@@ -2039,7 +2039,8 @@ lay_down_icons_vertical_desktop (Nautilu - } +From: d82b5bb6e06b6761bd5d5f3dc9a0762ce55517b4 Mon Sep 17 00:00:00 2001 +From: Iain Lane +Date: Fri, 7 Oct 2016 12:24:18 +0100 +Subject: [PATCH] nautilus-canvas: Don't lay down desktop icons if we haven't + +Sometimes we were trying to lay down icons before size_allocate had been +run. When this has happened, gtk_widget_get_allocation returns 1×1 as +our size. This messes up the algorithm and causes icons to be +overlapping on the canvas. + +This case happens when using Nautilus as the desktop in early-startup +(e.g. from its XDG autostart file). It can happen that we have read the +desktop files before the allocation has happened. + +We fix this by noticing if we're called before size_allocate and then +deferring icon layout until later on, after size_allocate has happened. + +This behaviour was introduced in commit +e0081be7cd65de6422529d831f7882009ce00a9d, which sorts and freezes the +desktop in early-startup. + +https://bugzilla.suse.com/show_bug.cgi?id=979072 + +https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1611955 + +https://bugzilla.gnome.org/show_bug.cgi?id=765601 + + +diff -Nura nautilus-3.22.0/src/nautilus-canvas-container.c nautilus-3.22.0_new/src/nautilus-canvas-container.c +--- nautilus-3.22.0/src/nautilus-canvas-container.c 2016-09-13 21:06:51.000000000 +0000 ++++ nautilus-3.22.0_new/src/nautilus-canvas-container.c 2016-10-09 10:01:33.953215876 +0000 +@@ -1432,6 +1432,9 @@ + + g_assert (NAUTILUS_IS_CANVAS_CONTAINER (container)); + ++ /* We can't get the right allocation if the size hasn't been allocated yet */ ++ g_return_if_fail (container->details->has_been_allocated); ++ + if (icons == NULL) + { + return; +@@ -1938,6 +1941,9 @@ + EelDRect icon_rect; + GtkAllocation allocation; + ++ /* We can't get the right allocation if the size hasn't been allocated yet */ ++ g_return_if_fail (container->details->has_been_allocated); ++ + /* Get container dimensions */ + gtk_widget_get_allocation (GTK_WIDGET (container), &allocation); + height = CANVAS_HEIGHT (container, allocation); +@@ -2218,7 +2224,13 @@ + redo_layout (NautilusCanvasContainer *container) + { + unschedule_redo_layout (container); +- redo_layout_internal (container); ++ /* We can't lay out if the size hasn't been allocated yet; wait for it to ++ * be and then we will be called again from size_allocate () ++ */ ++ if (container->details->has_been_allocated) ++ { ++ redo_layout_internal (container); ++ } + } + + static void +@@ -7836,6 +7848,18 @@ + NautilusCanvasIcon *icon; + NautilusCanvasPosition position; + ++ /* This early-exit avoids freezing the icons before they have been properly ++ * positioned, since we won't re-layout if auto_layout is FALSE. ++ * ++ * The container will freeze the icons after it lays them out once we've ++ * been allocated (e.g. in lay_out_icons_vertical_desktop). ++ */ ++ if (!container->details->has_been_allocated) ++ { ++ g_debug ("Not freezing icon positions yet; we haven't been allocated"); ++ return; ++ } ++ + changed = container->details->auto_layout; + container->details->auto_layout = FALSE; - /* Check and see if we need to move to a new column */ -- if (y != DESKTOP_PAD_VERTICAL && y + icon_height_for_bound_check > height) -+ if (y != DESKTOP_PAD_VERTICAL && y + icon_height_for_bound_check > height && -+ height > 0 && total > 3) - { - break; - } -@@ -2087,7 +2088,7 @@ lay_down_icons_vertical_desktop (Nautilu - /* Check and see if we need to move to a new column */ - if (y != DESKTOP_PAD_VERTICAL && y > height - icon_height_for_bound_check && - /* Make sure we lay out at least one icon per column, to make progress */ -- p != icons) -+ p != icons && height > 0 && total > 3) - { - x += column_width + DESKTOP_PAD_HORIZONTAL; - break; diff --git a/nautilus.changes b/nautilus.changes index f9c8446..0d1eb83 100644 --- a/nautilus.changes +++ b/nautilus.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sun Oct 9 07:46:04 UTC 2016 - qzhao@suse.com + +- Update nautilus-fix-desktop-icon-smash.patch: + porting upstream's solution to work out the general aspect + (bsc#979072, bgo#765601). + ------------------------------------------------------------------- Mon Sep 19 20:11:47 UTC 2016 - zaitor@opensuse.org