diff options
| author | Federico Angelilli <code@fedang.net> | 2024-02-11 00:21:05 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-02-11 00:21:05 +0100 |
| commit | f8b372787562aecb2a4a55b336c196f47b5c1b0c (patch) | |
| tree | 08edce1bd88acdad6b9f2519fa901d359078e44d /src/draw.c | |
| parent | f459a5088528ecd0a19716ce5a4432c8a86a994a (diff) | |
Use updated text in draw
There is a caveat: The text should always have the same size and layout as the original one for which the pango layout was calculated
Diffstat (limited to 'src/draw.c')
| -rw-r--r-- | src/draw.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -104,6 +104,8 @@ void draw_paint(Drawable *draw, Window *win) cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); cairo_move_to(cr, text_x, text_y); + // NOTE: This works only if the text didn't change in size after the layouting + pango_layout_set_text(layout->pl, CAST(layout->btn, ButtonSimple)->text, -1); pango_cairo_update_layout(cr, layout->pl); pango_cairo_show_layout(cr, layout->pl); } @@ -213,7 +215,7 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns) child->btn = btn; child->x = x + btn->padding; - child->y = btn->padding;; + child->y = btn->padding; child->pl = pango_cairo_create_layout(window_get_context(win)); layout_text(child, draw->desc, scale, height, radius); |
