From 6c3b81602ba53c35889833117602168faef424a9 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 25 Jul 2012 20:33:01 +0200 Subject: [PATCH] Swap order when drawing. Now it underlines properly even small fonts. --- bar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bar.c b/bar.c index c91c905..3bf6afd 100644 --- a/bar.c +++ b/bar.c @@ -102,10 +102,6 @@ draw_char (int x, int align, wchar_t ch) /* Draw the background first */ xcb_fill_rect (clear_gc, x, 0, ch_width, BAR_HEIGHT); - /* Draw the underline */ - if (BAR_UNDERLINE_HEIGHT) - xcb_fill_rect (underl_gc, x, BAR_UNDERLINE*(BAR_HEIGHT-BAR_UNDERLINE_HEIGHT), ch_width, BAR_UNDERLINE_HEIGHT); - /* xcb accepts string in UCS-2 BE, so swap */ ch = (ch >> 8) | (ch << 8); @@ -113,6 +109,10 @@ draw_char (int x, int align, wchar_t ch) xcb_image_text_16 (c, 1, canvas, draw_gc, x, BAR_HEIGHT / 2 + sel_font->avg_height / 2 - sel_font->info->font_descent, (xcb_char2b_t *)&ch); + /* Draw the underline */ + if (BAR_UNDERLINE_HEIGHT) + xcb_fill_rect (underl_gc, x, BAR_UNDERLINE*(BAR_HEIGHT-BAR_UNDERLINE_HEIGHT), ch_width, BAR_UNDERLINE_HEIGHT); + return ch_width; }