Commit 59ea4fd9 authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Cosimo Cecchi

make sure we don't snap icons to a grid marker which is too near the right

2009-01-22  Cosimo Cecchi  <cosimoc@gnome.org>

        * libnautilus-private/nautilus-icon-container.c:
        (snap_position): make sure we don't snap icons to a grid marker
        which is too near the right margin of the canvas (#527374).

svn path=/trunk/; revision=14881
parent 4cba7b87
2009-01-22 Cosimo Cecchi <cosimoc@gnome.org>
* libnautilus-private/nautilus-icon-container.c:
(snap_position): make sure we don't snap icons to a grid marker which
is too near the right margin of the canvas (#527374).
2009-01-22 Cosimo Cecchi <cosimoc@gnome.org>
* MAINTAINERS: fix a typo.
......
......@@ -1612,12 +1612,17 @@ snap_position (NautilusIconContainer *container,
int baseline_y;
int icon_width;
int icon_height;
int total_width;
int total_height;
EelDRect icon_position;
icon_position = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
icon_width = icon_position.x1 - icon_position.x0;
icon_height = icon_position.y1 - icon_position.y0;
total_width = CANVAS_WIDTH (container);
total_height = CANVAS_HEIGHT (container);
if (nautilus_icon_container_is_layout_rtl (container))
*x = get_mirror_x_position (container, icon, *x);
......@@ -1625,10 +1630,18 @@ snap_position (NautilusIconContainer *container,
*x = DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X - icon_width / 2;
}
if (*x + icon_width / 2 > total_width - (DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X)) {
*x = total_width - (DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X + (icon_width / 2));
}
if (*y + icon_height < DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y) {
*y = DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y - icon_height;
}
if (*y + icon_height > total_height - (DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y)) {
*y = total_height - (DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y + (icon_height / 2));
}
center_x = *x + icon_width / 2;
*x = SNAP_NEAREST_HORIZONTAL (center_x) - (icon_width / 2);
if (nautilus_icon_container_is_layout_rtl (container)) {
......
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