Commit 846085ad authored by Iain Lane's avatar Iain Lane
Browse files

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
parent 976dace6
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment