libi3: Rework draw_text

We now have two versions of draw_text
draw_text: Now takes an i3String
draw_text_ascii: Designed for static strings in plain ASCII
This commit is contained in:
Quentin Glidic
2012-08-07 20:28:39 +02:00
parent 284294e9c2
commit 53365fa887
8 changed files with 65 additions and 49 deletions

View File

@ -52,7 +52,7 @@ static int sig_draw_window(xcb_window_t win, int width, int height, int font_hei
set_font_colors(pixmap_gc, get_colorpixel("#FFFFFF"), get_colorpixel("#000000"));
for (int i = 0; crash_text_i3strings[i] != NULL; ++i) {
draw_text((char *)i3string_as_ucs2(crash_text_i3strings[i]), i3string_get_num_glyphs(crash_text_i3strings[i]), true, pixmap, pixmap_gc,
draw_text(crash_text_i3strings[i], pixmap, pixmap_gc,
8, 5 + i * font_height, width - 16);
}

View File

@ -484,7 +484,7 @@ void x_draw_decoration(Con *con) {
if (win == NULL || win->name == 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"
draw_text("another container", strlen("another container"), false,
draw_text_ascii("another container",
parent->pixmap, parent->pm_gc,
con->deco_rect.x + 2, con->deco_rect.y + text_offset_y,
con->deco_rect.width - 2);
@ -508,7 +508,7 @@ 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;
draw_text((char *)i3string_as_ucs2(win->name), i3string_get_num_glyphs(win->name), true,
draw_text(win->name,
parent->pixmap, parent->pm_gc,
con->deco_rect.x + 2 + indent_px, con->deco_rect.y + text_offset_y,
con->deco_rect.width - 2 - indent_px);