]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd: set field width to ellipsize
authorJohan Malm <jgm323@gmail.com>
Fri, 21 Apr 2023 15:26:44 +0000 (16:26 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 24 Apr 2023 02:25:52 +0000 (04:25 +0200)
src/osd.c

index 4459d7dcbbebfd1198db003427d1401abc8fa0d6..f5ce9199dcede2fea26ceabaa58b7a3ca9b88813 100644 (file)
--- 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) {