diff options
| author | Federico Angelilli <code@fedang.net> | 2023-11-18 15:07:24 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2023-11-18 15:07:24 +0100 |
| commit | bab8d5a6c2c6d56a97802bd23b2f5e03f0bec417 (patch) | |
| tree | c9fe89c6fa669eac4c9800ff59251ddef730b915 /src/draw.c | |
| parent | 3e042d595b4a8dd4959de39942671c75add3c090 (diff) | |
Use a single state in Connection
Diffstat (limited to 'src/draw.c')
| -rw-r--r-- | src/draw.c | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -80,18 +80,9 @@ void draw_paint(Drawable *draw, Window *win) PangoLayout *layout = pango_cairo_create_layout(cr); pango_layout_set_font_description(layout, draw->desc); - int bwidth, bheight = height; - char *btn_text = btn->text; - char tmp[2] = { 0 }; - - if (btn->fixed_size) { - bwidth = height; - // Get only the first char - tmp[0] = btn->text[0]; - btn_text = tmp; - } + int bwidth = height, bheight = height; - pango_layout_set_text(layout, btn_text, -1); + pango_layout_set_text(layout, btn->text, -1); pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); int text_w, text_h; @@ -100,7 +91,7 @@ void draw_paint(Drawable *draw, Window *win) text_h = ceil(text_h / scale); if (!btn->fixed_size) { - bwidth = text_w + 2*radius; + bwidth = text_w + 2 * radius; } int text_x = bx + (bwidth / 2) - (text_w / 2); |
