From 69f29b2b8e1dea450dd960baf498d879760657ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fernando=20Tarl=C3=A1=20Cardoso=20Lemos?= Date: Sun, 14 Nov 2010 21:14:49 -0200 Subject: [PATCH] Use the configured font to draw the decorations. --- src/x.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/x.c b/src/x.c index 5c854d01..1ee23e64 100644 --- a/src/x.c +++ b/src/x.c @@ -299,8 +299,11 @@ void x_draw_decoration(Con *con) { con->deco_rect.y + con->deco_rect.height - 1); /* to_y */ /* 5: draw the title */ - xcb_change_gc_single(conn, parent->gc, XCB_GC_BACKGROUND, color->background); - xcb_change_gc_single(conn, parent->gc, XCB_GC_FOREGROUND, color->text); + i3Font *font = load_font(conn, config.font); + uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT; + uint32_t values[] = { color->text, color->background, font->id }; + xcb_change_gc(conn, parent->gc, mask, values); + int text_offset_y = font->height + (con->deco_rect.height - font->height) / 2 - 1; struct Window *win = con->window; if (win == NULL || win->name_x == NULL) { @@ -312,7 +315,7 @@ void x_draw_decoration(Con *con) { parent->frame, parent->gc, con->deco_rect.x + 2, - con->deco_rect.y + 14, /* TODO: hardcoded */ + con->deco_rect.y + text_offset_y, "another container" ); return; @@ -342,7 +345,7 @@ void x_draw_decoration(Con *con) { parent->frame, parent->gc, con->deco_rect.x + 2 + indent_px, - con->deco_rect.y + 14, /* TODO: hardcoded */ + con->deco_rect.y + text_offset_y, (xcb_char2b_t*)win->name_x ); else @@ -352,7 +355,7 @@ void x_draw_decoration(Con *con) { parent->frame, parent->gc, con->deco_rect.x + 2 + indent_px, - con->deco_rect.y + 14, /* TODO: hardcoded */ + con->deco_rect.y + text_offset_y, win->name_x ); } -- 2.39.5