[PATCH] Fixing desktop icon overlap



---
 libnautilus-private/nautilus-icon-container.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index ae58a49..934a468 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -2429,7 +2429,22 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
 
 	if (!details->auto_layout) {
 		if (details->keep_aligned && snap) {
-			snap_position (container, icon, &x, &y);
+			PlacementGrid *grid;
+			GList *p;
+			NautilusIcon *current_icon;			
+			
+			grid = placement_grid_new (container, TRUE);
+			
+			for (p = container->details->icons; p != NULL; p = p->next) {
+				current_icon = p->data;
+
+				if (icon_is_positioned (current_icon) && !current_icon->has_lazy_position && current_icon != icon) {
+					placement_grid_mark_icon (grid, current_icon);
+				}
+			}
+			
+			find_empty_location (container, grid, icon, x, y, &x, &y);
+			placement_grid_free (grid);
 		}
 
 		if (x != icon->x || y != icon->y) {
@@ -7180,8 +7195,8 @@ finish_adding_new_icons (NautilusIconContainer *container)
 		semi_position_icons = g_list_reverse (semi_position_icons);
 
 		/* This is currently only used on the desktop.
-		 * Thus, we pass FALSE for tight, like lay_down_icons_tblr */
-		grid = placement_grid_new (container, FALSE);
+		 * We pass true because a tight layout looks nicer */
+		grid = placement_grid_new (container, TRUE);
 
 		for (p = container->details->icons; p != NULL; p = p->next) {
 			icon = p->data;
@@ -7299,7 +7314,7 @@ nautilus_icon_container_add (NautilusIconContainer *container,
 	 * if the previous icon position is free. If the position
 	 * is occupied, another position near the last one will
 	 */
-	icon->has_lazy_position = is_old_or_unknown_icon_data (container, data);
+	icon->has_lazy_position = is_old_or_unknown_icon_data (container, data) || container->details->keep_aligned;
 	icon->scale = 1.0;
  	icon->item = NAUTILUS_ICON_CANVAS_ITEM
 		(eel_canvas_item_new (EEL_CANVAS_GROUP (EEL_CANVAS (container)->root),
-- 
1.6.3.3


--=-+dpunvlpe29B9qDeLYc3--



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]