diff --git a/src/win.c b/src/win.c index 64f93185..2ece9aaf 100644 --- a/src/win.c +++ b/src/win.c @@ -543,10 +543,13 @@ int win_update_name(session_t *ps, struct managed_win *w) { } if (!(wid_get_text_prop(ps, w->client_win, ps->atoms->a_NET_WM_NAME, &strlst, &nstr))) { - log_trace("(%#010x): _NET_WM_NAME unset, falling back to WM_NAME.", + log_debug("(%#010x): _NET_WM_NAME unset, falling back to WM_NAME.", w->client_win); if (!wid_get_text_prop(ps, w->client_win, ps->atoms->aWM_NAME, &strlst, &nstr)) { + log_debug("Unsetting window name for %#010x", w->client_win); + free(w->name); + w->name = NULL; return -1; } } @@ -560,7 +563,7 @@ int win_update_name(session_t *ps, struct managed_win *w) { free(strlst); - log_trace("(%#010x): client = %#010x, name = \"%s\", " + log_debug("(%#010x): client = %#010x, name = \"%s\", " "ret = %d", w->base.id, w->client_win, w->name, ret); return ret; diff --git a/src/x.c b/src/x.c index aef9005a..3539ac13 100644 --- a/src/x.c +++ b/src/x.c @@ -145,6 +145,17 @@ bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop, char ** nstr += 1; } + if (nstr == 0) { + // The property is set to an empty string, in that case, we return one + // string + char **strlst = malloc(sizeof(char *)); + strlst[0] = ""; + *pnstr = 1; + *pstrlst = strlst; + free(r); + return true; + } + // Allocate the pointers and the strings together void *buf = NULL; if (posix_memalign(&buf, alignof(char *), length + sizeof(char *) * nstr + 1) != 0) {