From: Johan Malm Date: Fri, 21 Apr 2023 15:26:44 +0000 (+0100) Subject: osd: set field width to ellipsize X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=09c1cdd2dc3964e2e1c079b943b7aef40fc36acd;p=proto%2Flabwc.git osd: set field width to ellipsize --- diff --git a/src/osd.c b/src/osd.c index 4459d7dc..f5ce9199 100644 --- a/src/osd.c +++ b/src/osd.c @@ -367,9 +367,11 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h, default: break; } + int field_width = field->width / 100.0 * OSD_ITEM_WIDTH; + pango_layout_set_width(layout, field_width * PANGO_SCALE); pango_layout_set_text(layout, buf.buf, -1); pango_cairo_show_layout(cairo, layout); - x += field->width / 100.0 * OSD_ITEM_WIDTH; + x += field_width; } if (view == cycle_view) {