summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Lane <iain.lane@canonical.com>2015-12-04 13:11:24 +0000
committerIain Lane <iain.lane@canonical.com>2015-12-04 14:48:53 +0000
commit846085ade99159ecf429aeb5f9223d075bf059c5 (patch)
treea34be3308822db4f3edfd29f370c9b13c8873cfd
parent976dace61258816c71e98035184ca32c21f8607d (diff)
downloadnautilus-846085ade99159ecf429aeb5f9223d075bf059c5.tar.gz
canvas-container: consider margins when calculating icon bounding box
Shells can fix docks, panels and other similar things which reduce the available space to draw on. This is called the canvas margin. When positioning things relative to icons within containers we need to adjust by this margin, otherwise they will be shifted away from the target. Do this when we calculate the bounding box. https://bugzilla.gnome.org/show_bug.cgi?id=759002
-rw-r--r--libnautilus-private/nautilus-canvas-container.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index 87ce3dd0a..84e652361 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -6411,9 +6411,11 @@ nautilus_canvas_container_get_icons_bounding_box (NautilusCanvasContainer *conta
icon_get_bounding_box ((NautilusCanvasIcon *)node->data,
&x1, &y1, &x2, &y2,
BOUNDS_USAGE_FOR_DISPLAY);
- g_array_index (result, GdkRectangle, index).x = x1 * EEL_CANVAS (container)->pixels_per_unit;
+ g_array_index (result, GdkRectangle, index).x = x1 * EEL_CANVAS (container)->pixels_per_unit +
+ container->details->left_margin;
g_array_index (result, GdkRectangle, index).width = (x2 - x1) * EEL_CANVAS (container)->pixels_per_unit;
- g_array_index (result, GdkRectangle, index).y = y1 * EEL_CANVAS (container)->pixels_per_unit;
+ g_array_index (result, GdkRectangle, index).y = y1 * EEL_CANVAS (container)->pixels_per_unit +
+ container->details->top_margin;
g_array_index (result, GdkRectangle, index).height = (y2 - y1) * EEL_CANVAS (container)->pixels_per_unit;
}