[PATCH] Improve text besides icon keynav
- From: Christian Neumair <chris gnome-de org>
- To: nautilus-list gnome org
- Subject: [PATCH] Improve text besides icon keynav
- Date: Tue, 28 Feb 2006 09:05:39 +0100
The current icon view navigation code is very "text below icon"-centric.
It compares icons by its vertical upper icon rect bound (y1) and the
horizontal median (x0 + x1)/2. This often leads to situations in "text
besides icon" mode where the cursor is stuck, and moving it is
impossible, because an item's icon is different in size from others.
The attached patch should fix the issue by using other comparison points
for "text besides icon" mode.
--
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.410
diff -u -p -r1.410 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c 27 Feb 2006 14:03:58 -0000 1.410
+++ libnautilus-private/nautilus-icon-container.c 28 Feb 2006 07:53:38 -0000
@@ -2234,6 +2239,32 @@ compare_icons_by_uri (NautilusIconContai
}
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,
NautilusIcon *icon_b)
@@ -2244,15 +2275,15 @@ compare_icons_horizontal_first (Nautilus
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 +2313,15 @@ compare_icons_vertical_first (NautilusIc
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 +2541,8 @@ closest_in_90_degrees (NautilusIconConta
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 +2709,8 @@ record_arrow_key_start (NautilusIconCont
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]