Bugfix: Use _NET_WM_NAME (UTF-8) rather than WM_NAME (COMPOUND_TEXT). Only render client titles, if they are set
This commit is contained in:
parent
4e12c9b39c
commit
9e74378dd0
21
src/layout.c
21
src/layout.c
|
@ -162,16 +162,19 @@ void decorate_window(xcb_connection_t *conn, Client *client, xcb_drawable_t draw
|
|||
xcb_draw_line(conn, drawable, gc, border_color, 2, offset + font->height + 3,
|
||||
2 + client->rect.width, offset + font->height + 3);
|
||||
|
||||
/* Draw the font */
|
||||
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;
|
||||
uint32_t values[] = { text_color, background_color, font->id };
|
||||
xcb_change_gc(conn, gc, mask, values);
|
||||
/* If the client has a title, we draw it */
|
||||
if (client->name != NULL) {
|
||||
/* Draw the font */
|
||||
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;
|
||||
uint32_t values[] = { text_color, background_color, font->id };
|
||||
xcb_change_gc(conn, gc, mask, values);
|
||||
|
||||
int real_strlen;
|
||||
char *ucs2_label = convert_utf8_to_ucs2(client->name, &real_strlen);
|
||||
xcb_image_text_16(conn, real_strlen, drawable, gc, 3 /* X */,
|
||||
offset + font->height /* Y = baseline of font */, (xcb_char2b_t*)ucs2_label);
|
||||
free(ucs2_label);
|
||||
int real_strlen;
|
||||
char *ucs2_label = convert_utf8_to_ucs2(client->name, &real_strlen);
|
||||
xcb_image_text_16(conn, real_strlen, drawable, gc, 3 /* X */,
|
||||
offset + font->height /* Y = baseline of font */, (xcb_char2b_t*)ucs2_label);
|
||||
free(ucs2_label);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -105,7 +105,7 @@ void manage_window(xcb_property_handlers_t *prophs, xcb_connection_t *conn, xcb_
|
|||
if (attr && geom) {
|
||||
reparent_window(conn, window, attr->visual, geom->root, geom->depth,
|
||||
geom->x, geom->y, geom->width, geom->height);
|
||||
xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_NAME);
|
||||
xcb_property_changed(prophs, XCB_PROPERTY_NEW_VALUE, window, atoms[_NET_WM_NAME]);
|
||||
}
|
||||
|
||||
free(geom);
|
||||
|
@ -415,9 +415,6 @@ int main(int argc, char *argv[], char *env[]) {
|
|||
/* Initialize the property handlers */
|
||||
xcb_property_handlers_init(&prophs, &evenths);
|
||||
|
||||
/* Watch the WM_NAME (= title of the window) property */
|
||||
xcb_watch_wm_name(&prophs, 128, handle_windowname_change, 0);
|
||||
|
||||
/* Watch size hints (to obey correct aspect ratio) */
|
||||
xcb_property_set_handler(&prophs, WM_NORMAL_HINTS, UINT_MAX, handle_normal_hints, NULL);
|
||||
|
||||
|
@ -458,6 +455,9 @@ int main(int argc, char *argv[], char *env[]) {
|
|||
xcb_property_set_handler(&prophs, atoms[_NET_WM_WINDOW_TYPE], UINT_MAX, window_type_handler, NULL);
|
||||
/* TODO: In order to comply with EWMH, we have to watch _NET_WM_STRUT_PARTIAL */
|
||||
|
||||
/* Watch _NET_WM_NAME (= title of the window in UTF-8) property */
|
||||
xcb_property_set_handler(&prophs, atoms[_NET_WM_NAME], 128, handle_windowname_change, NULL);
|
||||
|
||||
/* Set up the atoms we support */
|
||||
check_error(conn, xcb_change_property_checked(conn, XCB_PROP_MODE_REPLACE, root, atoms[_NET_SUPPORTED],
|
||||
ATOM, 32, 7, atoms), "Could not set _NET_SUPPORTED");
|
||||
|
|
Loading…
Reference in New Issue