[SF#972] Fix incorrect file names rendering position on the desktop.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Mon, 13 Jul 2015 17:53:52 +0000 (20:53 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Mon, 13 Jul 2015 17:53:52 +0000 (20:53 +0300)
If image aspect ratio was not 1:1 then text was rendered right below image
instead of being put at the designated place.

NEWS
src/desktop.c

diff --git a/NEWS b/NEWS
index 0ee7af3..5f23c02 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,8 @@
 * Improved option to open folder in terminal, it should work with gvfs
     paths that have resolvable local path as well.
 
+* Fixed incorrect file names rendering position on the desktop.
+
 
 Changes on 1.2.3 since 1.2.2:
 
index bc456c7..a56d89e 100644 (file)
@@ -203,7 +203,7 @@ static void calc_item_size(FmDesktop* desktop, FmDesktopItem* item, GdkPixbuf* i
     }
     item->icon_rect.x = item->area.x + (desktop->cell_w - item->icon_rect.width) / 2;
     item->icon_rect.y = item->area.y + desktop->ypad + (fm_config->big_icon_size - item->icon_rect.height) / 2;
-    item->icon_rect.height += desktop->spacing;
+    item->icon_rect.height += desktop->spacing; // FIXME: this is probably wrong
 
     /* text label rect */
     pango_layout_set_text(desktop->pl, NULL, 0);
@@ -216,9 +216,9 @@ static void calc_item_size(FmDesktop* desktop, FmDesktopItem* item, GdkPixbuf* i
 
     /* FIXME: RTL */
     item->text_rect.x = item->area.x + (desktop->cell_w - rc2.width - 4) / 2;
-    item->text_rect.y = item->area.y + desktop->ypad + fm_config->big_icon_size + desktop->spacing + rc2.y;
+    item->text_rect.y = item->area.y + desktop->ypad + fm_config->big_icon_size + desktop->spacing;
     item->text_rect.width = rc2.width + 4;
-    item->text_rect.height = rc2.height + 4;
+    item->text_rect.height = rc2.y + rc2.height + 4;
     item->area.width = (desktop->cell_w + MAX(item->icon_rect.width, item->text_rect.width)) / 2;
     item->area.height = item->text_rect.y + item->text_rect.height - item->area.y;
 }
@@ -1829,7 +1829,7 @@ static void paint_item(FmDesktop* self, FmDesktopItem* item, cairo_t* cr, GdkRec
 
     /* FIXME: do we need to cache this? */
     text_x = item->area.x + (self->cell_w - self->text_w)/2 + 2;
-    text_y = item->icon_rect.y + item->icon_rect.height + 2;
+    text_y = item->text_rect.y + 2;
 
     if(item->is_selected || item == self->drop_hilight) /* draw background for text label */
     {