Swap order when drawing. Now it underlines properly even small fonts.

This commit is contained in:
LemonBoy 2012-07-25 20:33:01 +02:00
parent 3f8bfbe514
commit 6c3b81602b
1 changed files with 4 additions and 4 deletions

8
bar.c
View File

@ -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;
}