窗口消失时清理对应的 client

This commit is contained in:
2025-08-23 00:28:35 +08:00
parent 69c69200d8
commit 2e75dbf75e
4 changed files with 57 additions and 7 deletions

View File

@@ -248,19 +248,19 @@ void map_window(xcb_window_t window) {
char *get_window_name(xcb_window_t window) {
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name(ewmh, window);
xcb_ewmh_get_utf8_strings_reply_t reply;
xcb_ewmh_get_wm_name_reply(ewmh, cookie, &reply, NULL);
if (reply.strings_len) {
if (xcb_ewmh_get_wm_name_reply(ewmh, cookie, &reply, NULL)) {
char *name = ecalloc(reply.strings_len + 1, sizeof(char));
strncpy(name, reply.strings, reply.strings_len);
xcb_ewmh_get_utf8_strings_reply_wipe(&reply);
return name;
}
cookie = xcb_icccm_get_wm_name(conn, window);
xcb_icccm_get_text_property_reply_t prop;
xcb_icccm_get_wm_name_reply(conn, cookie, &prop, NULL);
if (prop.name_len) {
if (xcb_icccm_get_wm_name_reply(conn, cookie, &prop, NULL)) {
char *name = ecalloc(prop.name_len + 1, sizeof(char));
strncpy(name, prop.name, prop.name_len);
xcb_icccm_get_text_property_reply_wipe(&prop);
return name;
}