Commit 4ca1660a authored by Christian Neumair's avatar Christian Neumair Committed by Christian Neumair
Browse files

Use better icon points for comparing the position of two items in "Text

2007-02-28  Christian Neumair  <chris@gnome-de.org>

	* libnautilus-private/nautilus-icon-container.c:
	(get_cmp_point_x), (get_cmp_point_y),
	(compare_icons_horizontal_first), (compare_icons_vertical_first),
	(closest_in_90_degrees), (record_arrow_key_start):
	Use better icon points for comparing the position of two items in
	"Text Beside Icon" mode. Fixes keynav issues with items that have
	different icon sizes.
parent 0a9e3528
2007-02-28 Christian Neumair <chris@gnome-de.org>
* libnautilus-private/nautilus-icon-container.c:
(get_cmp_point_x), (get_cmp_point_y),
(compare_icons_horizontal_first), (compare_icons_vertical_first),
(closest_in_90_degrees), (record_arrow_key_start):
Use better icon points for comparing the position of two items in
"Text Beside Icon" mode. Fixes keynav issues with items that have
different icon sizes.
2006-02-27 Martin Wehner <martin.wehner@gmail.com>
* libnautilus-private/nautilus-tree-view-drag-dest.c:
......
......@@ -2233,6 +2233,32 @@ compare_icons_by_uri (NautilusIconContainer *container,
return result;
}
static int
get_cmp_point_x (NautilusIconContainer *container,
ArtDRect icon_rect)
{
if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL) {
return icon_rect.x0;
} else {
return icon_rect.x1;
}
} else {
return (icon_rect.x0 + icon_rect.x1) / 2;
}
}
static int
get_cmp_point_y (NautilusIconContainer *container,
ArtDRect icon_rect)
{
if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
return (icon_rect.y0 + icon_rect.y1)/2;
} else {
return icon_rect.y1;
}
}
static int
compare_icons_horizontal_first (NautilusIconContainer *container,
NautilusIcon *icon_a,
......@@ -2244,15 +2270,15 @@ compare_icons_horizontal_first (NautilusIconContainer *container,
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_a->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
get_cmp_point_x (container, world_rect),
get_cmp_point_y (container, world_rect),
&ax,
&ay);
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_b->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
get_cmp_point_x (container, world_rect),
get_cmp_point_y (container, world_rect),
&bx,
&by);
......@@ -2282,15 +2308,15 @@ compare_icons_vertical_first (NautilusIconContainer *container,
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_a->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
get_cmp_point_x (container, world_rect),
get_cmp_point_y (container, world_rect),
&ax,
&ay);
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_b->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
get_cmp_point_x (container, world_rect),
get_cmp_point_y (container, world_rect),
&bx,
&by);
......@@ -2510,8 +2536,8 @@ closest_in_90_degrees (NautilusIconContainer *container,
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (candidate->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
get_cmp_point_x (container, world_rect),
get_cmp_point_y (container, world_rect),
&x,
&y);
......@@ -2678,8 +2704,8 @@ record_arrow_key_start (NautilusIconContainer *container,
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
get_cmp_point_x (container, world_rect),
get_cmp_point_y (container, world_rect),
&container->details->arrow_key_start_x,
&container->details->arrow_key_start_y);
......
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