From 457d51e2672a3f465d2209b72872584c746c93ed Mon Sep 17 00:00:00 2001 From: o9000 Date: Thu, 28 Dec 2017 09:14:02 +0100 Subject: [PATCH] Task, Button: add a bit of slack in the pango text layout, to avoid wrapping due to rounding errors --- src/button/button.c | 2 +- src/taskbar/task.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/button/button.c b/src/button/button.c index 4cd8224..68e6131 100644 --- a/src/button/button.c +++ b/src/button/button.c @@ -460,7 +460,7 @@ void draw_button(void *obj, cairo_t *c) PangoLayout *layout = pango_cairo_create_layout(c); pango_layout_set_font_description(layout, button->backend->font_desc); - pango_layout_set_width(layout, button->frontend->textw * PANGO_SCALE); + pango_layout_set_width(layout, (button->frontend->textw + 1) * PANGO_SCALE); pango_layout_set_alignment(layout, button->backend->centered ? PANGO_ALIGN_CENTER : PANGO_ALIGN_LEFT); pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); diff --git a/src/taskbar/task.c b/src/taskbar/task.c index f7bc4b0..c5798f0 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -463,7 +463,7 @@ void draw_task(void *obj, cairo_t *c) pango_layout_set_font_description(layout, panel->g_task.font_desc); pango_layout_set_text(layout, task->title, -1); - pango_layout_set_width(layout, ((Taskbar *)task->area.parent)->text_width * PANGO_SCALE); + pango_layout_set_width(layout, (((Taskbar *)task->area.parent)->text_width + 1) * PANGO_SCALE); pango_layout_set_height(layout, panel->g_task.text_height * PANGO_SCALE); pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);