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);
-
- 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);
+ /* 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);
+ }
}
/*
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);
/* 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);
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");