Handle legacy window titles by rendering them not unicode-compatible.

This commit is contained in:
Michael Stapelberg
2009-03-11 21:31:54 +01:00
parent 17bcdd8b0f
commit cc2c63b860
5 changed files with 81 additions and 4 deletions

View File

@ -169,8 +169,15 @@ void decorate_window(xcb_connection_t *conn, Client *client, xcb_drawable_t draw
uint32_t values[] = { text_color, background_color, font->id };
xcb_change_gc(conn, gc, mask, values);
xcb_image_text_16(conn, client->name_len, drawable, gc, 3 /* X */,
offset + font->height /* Y = baseline of font */, (xcb_char2b_t*)client->name);
/* name_len == -1 means this is a legacy application which does not specify _NET_WM_NAME,
and we dont handle the old window name (COMPOUND_TEXT) but only _NET_WM_NAME, which
is UTF-8 */
if (client->name_len == -1)
xcb_image_text_8(conn, strlen(client->name), drawable, gc, 3 /* X */,
offset + font->height /* Y = baseline of font */, client->name);
else
xcb_image_text_16(conn, client->name_len, drawable, gc, 3 /* X */,
offset + font->height /* Y = baseline of font */, (xcb_char2b_t*)client->name);
}
}