Make all programs use draw_text.
This commit is contained in:
committed by
Michael Stapelberg
parent
5c2088c87e
commit
eafc7af606
38
src/x.c
38
src/x.c
@ -411,22 +411,15 @@ void x_draw_decoration(Con *con) {
|
||||
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;
|
||||
uint32_t values[] = { p->color->text, p->color->background, config.font.id };
|
||||
xcb_change_gc(conn, parent->pm_gc, mask, values);
|
||||
int text_offset_y = config.font.height + (con->deco_rect.height - config.font.height) / 2 - 1;
|
||||
int text_offset_y = (con->deco_rect.height - config.font.height) / 2;
|
||||
|
||||
struct Window *win = con->window;
|
||||
if (win == NULL || win->name_x == NULL) {
|
||||
/* this is a non-leaf container, we need to make up a good description */
|
||||
// TODO: use a good description instead of just "another container"
|
||||
xcb_image_text_8(
|
||||
conn,
|
||||
strlen("another container"),
|
||||
parent->pixmap,
|
||||
parent->pm_gc,
|
||||
con->deco_rect.x + 2,
|
||||
con->deco_rect.y + text_offset_y,
|
||||
"another container"
|
||||
);
|
||||
|
||||
draw_text("another container", strlen("another container"), false,
|
||||
parent->pixmap, parent->pm_gc,
|
||||
con->deco_rect.x + 2, con->deco_rect.y + text_offset_y);
|
||||
goto copy_pixmaps;
|
||||
}
|
||||
|
||||
@ -447,26 +440,9 @@ void x_draw_decoration(Con *con) {
|
||||
//DLOG("indent_level = %d, indent_mult = %d\n", indent_level, indent_mult);
|
||||
int indent_px = (indent_level * 5) * indent_mult;
|
||||
|
||||
if (win->uses_net_wm_name)
|
||||
xcb_image_text_16(
|
||||
conn,
|
||||
win->name_len,
|
||||
parent->pixmap,
|
||||
parent->pm_gc,
|
||||
con->deco_rect.x + 2 + indent_px,
|
||||
con->deco_rect.y + text_offset_y,
|
||||
(xcb_char2b_t*)win->name_x
|
||||
);
|
||||
else
|
||||
xcb_image_text_8(
|
||||
conn,
|
||||
win->name_len,
|
||||
parent->pixmap,
|
||||
parent->pm_gc,
|
||||
con->deco_rect.x + 2 + indent_px,
|
||||
con->deco_rect.y + text_offset_y,
|
||||
win->name_x
|
||||
);
|
||||
draw_text(win->name_x, win->name_len, win->uses_net_wm_name,
|
||||
parent->pixmap, parent->pm_gc,
|
||||
con->deco_rect.x + 2 + indent_px, con->deco_rect.y + text_offset_y);
|
||||
|
||||
copy_pixmaps:
|
||||
xcb_copy_area(conn, con->pixmap, con->frame, con->pm_gc, 0, 0, 0, 0, con->rect.width, con->rect.height);
|
||||
|
Reference in New Issue
Block a user