mirror of
https://github.com/vale981/yabar
synced 2025-03-05 09:31:39 -05:00
Merge pull request #81 from abarbu/master
better window title handling and an explanation for missing titles
This commit is contained in:
commit
b583b3417c
1 changed files with 12 additions and 14 deletions
|
@ -406,24 +406,22 @@ inline void ya_get_cur_window_title(ya_block_t * blk) {
|
|||
if(ya.curwin == XCB_NONE)
|
||||
blk->buf[0] = '\0';
|
||||
else {
|
||||
// Note that this is incomplete. Windows /should/ set
|
||||
// _NET_WM_NAME according to the ewmh docs but not all
|
||||
// do. ewmh bindings don't provide clean bindings to
|
||||
// WM_NAME.
|
||||
xcb_get_property_cookie_t wm_ck, wmvis_ck;
|
||||
wm_ck = xcb_ewmh_get_wm_name(ya.ewmh, ya.curwin);
|
||||
wmvis_ck = xcb_ewmh_get_wm_visible_name(ya.ewmh, ya.curwin);
|
||||
if (xcb_ewmh_get_wm_name_reply(ya.ewmh, wm_ck, &reply, NULL) == 1) {
|
||||
if (xcb_ewmh_get_wm_visible_name_reply(ya.ewmh, wmvis_ck, &reply, NULL) == 1) {
|
||||
int len = GET_MIN(blk->bufsize, reply.strings_len);
|
||||
strncpy(blk->buf, reply.strings, len);
|
||||
blk->buf[len]='\0';
|
||||
}
|
||||
else {
|
||||
int len = GET_MIN(blk->bufsize, reply.strings_len);
|
||||
strncpy(blk->buf, reply.strings, len);
|
||||
blk->buf[len]='\0';
|
||||
}
|
||||
xcb_ewmh_get_utf8_strings_reply_wipe(&reply);
|
||||
}
|
||||
if(xcb_ewmh_get_wm_name_reply(ya.ewmh, wm_ck, &reply, NULL) == 1 || xcb_ewmh_get_wm_visible_name_reply(ya.ewmh, wmvis_ck, &reply, NULL) == 1) {
|
||||
int len = GET_MIN(blk->bufsize, reply.strings_len);
|
||||
strncpy(blk->buf, reply.strings, len);
|
||||
blk->buf[len]='\0';
|
||||
xcb_ewmh_get_utf8_strings_reply_wipe(&reply);
|
||||
} else {
|
||||
blk->buf[0]='\0';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif //YA_INTERNAL_EWMH
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue