Use the configured font to draw the decorations.

This commit is contained in:
Fernando Tarlá Cardoso Lemos 2010-11-14 21:14:49 -02:00 committed by Michael Stapelberg
parent cbd53e8a7f
commit 69f29b2b8e
1 changed files with 8 additions and 5 deletions

13
src/x.c
View File

@ -299,8 +299,11 @@ void x_draw_decoration(Con *con) {
con->deco_rect.y + con->deco_rect.height - 1); /* to_y */ con->deco_rect.y + con->deco_rect.height - 1); /* to_y */
/* 5: draw the title */ /* 5: draw the title */
xcb_change_gc_single(conn, parent->gc, XCB_GC_BACKGROUND, color->background); i3Font *font = load_font(conn, config.font);
xcb_change_gc_single(conn, parent->gc, XCB_GC_FOREGROUND, color->text); 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; struct Window *win = con->window;
if (win == NULL || win->name_x == NULL) { if (win == NULL || win->name_x == NULL) {
@ -312,7 +315,7 @@ void x_draw_decoration(Con *con) {
parent->frame, parent->frame,
parent->gc, parent->gc,
con->deco_rect.x + 2, con->deco_rect.x + 2,
con->deco_rect.y + 14, /* TODO: hardcoded */ con->deco_rect.y + text_offset_y,
"another container" "another container"
); );
return; return;
@ -342,7 +345,7 @@ void x_draw_decoration(Con *con) {
parent->frame, parent->frame,
parent->gc, parent->gc,
con->deco_rect.x + 2 + indent_px, 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 (xcb_char2b_t*)win->name_x
); );
else else
@ -352,7 +355,7 @@ void x_draw_decoration(Con *con) {
parent->frame, parent->frame,
parent->gc, parent->gc,
con->deco_rect.x + 2 + indent_px, con->deco_rect.x + 2 + indent_px,
con->deco_rect.y + 14, /* TODO: hardcoded */ con->deco_rect.y + text_offset_y,
win->name_x win->name_x
); );
} }