From c8575e1f91ef8482b4f6b3ee4df148a2df0b73f4 Mon Sep 17 00:00:00 2001 From: tatou-tatou Date: Fri, 30 May 2014 00:44:50 +0200 Subject: [PATCH] Center text vertically when there's an icon --- x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x.c b/x.c index 714817e..391d885 100644 --- a/x.c +++ b/x.c @@ -430,8 +430,10 @@ static void r_free_layouts(GSList *layouts) static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, dimension_t dim, bool first, bool last) { int h; + int h_text; pango_layout_get_pixel_size(cl->l, NULL, &h); if (cl->icon) { + h_text = h; h = MAX(cairo_image_surface_get_height(cl->icon), h); } @@ -453,7 +455,7 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, dimension_t d dim.y += settings.padding; if (cl->icon && settings.icon_position == icons_left) { - cairo_move_to(c, cairo_image_surface_get_width(cl->icon) + 2 * settings.h_padding, bg_y + settings.padding ); + cairo_move_to(c, cairo_image_surface_get_width(cl->icon) + 2 * settings.h_padding, bg_y + settings.padding + h/2 - h_text/2); } else { cairo_move_to(c, settings.h_padding, bg_y + settings.padding);