From 846085ade99159ecf429aeb5f9223d075bf059c5 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Fri, 4 Dec 2015 13:11:24 +0000 Subject: 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 --- libnautilus-private/nautilus-canvas-container.c | 6 ++++-- 1 file 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; } -- cgit v1.2.1