From 24967b7cc85f2f8cfc7eed1691c888366ca2702f Mon Sep 17 00:00:00 2001 From: Adam Purkrt Date: Sat, 2 Nov 2019 16:44:00 +0100 Subject: [PATCH] Fix for the bugs 16075 and 16107 Bug: 16075 Bug: 16107 The following patch fixes bugs 16075 and 16107, i.e. "Icon view: excess clickable area of multiline filenames" and "Multi-line filenames misaligned when text beside icons is on" respectively. By relying on gtk_cell_renderer_get_aligned_area and gtk_cell_renderer_get_padding it brings the box[..].width and box[..].height values into correspondence with the real size of drawn text. --- exo/exo-icon-view.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/exo/exo-icon-view.c b/exo/exo-icon-view.c index b392575..ca2570f 100644 --- a/exo/exo-icon-view.c +++ b/exo/exo-icon-view.c @@ -3905,8 +3905,25 @@ exo_icon_view_calculate_item_size (ExoIconView *icon_view, gtk_cell_renderer_get_preferred_size (info->cell, GTK_WIDGET (icon_view), &req, NULL); - item->box[info->position].width = req.width; - item->box[info->position].height = req.height; + if (info->is_text) + { + GdkRectangle cell_area, aligned_area; + gint cell_xpad, cell_ypad; + + cell_area.width = req.width; + cell_area.height = req.height; + gtk_cell_renderer_get_aligned_area (info->cell, GTK_WIDGET (icon_view), + 0, &cell_area, &aligned_area); + gtk_cell_renderer_get_padding (info->cell, &cell_xpad, &cell_ypad); + + item->box[info->position].width = aligned_area.width + 2*cell_xpad; + item->box[info->position].height = aligned_area.height + 2*cell_ypad; + } + else + { + item->box[info->position].width = req.width; + item->box[info->position].height = req.height; + } } #else gtk_cell_renderer_get_size (info->cell, GTK_WIDGET (icon_view), -- 2.23.0