diff --git a/x.c b/x.c index 825f24d..e4216f1 100644 --- a/x.c +++ b/x.c @@ -215,3 +215,23 @@ GetMotifHintsCookie(XCBDisplay *display, XCBWindow win) } +char * +GetAtomNameQuick(XCBDisplay *display, XCBAtom atom) +{ + XCBCookie cookie; + XCBAtomName *rep; + cookie = XCBGetAtomNameCookie(display, atom); + rep = XCBGetAtomNameReply(display, cookie); + DEBUG("%u", atom); + char *buff = NULL; + if(rep->name_len) + { buff = malloc(sizeof(char) * rep->name_len + 1); + } + if(buff) + { + memcpy(buff, xcb_get_atom_name_name(rep), rep->name_len); + buff[rep->name_len] = '\0'; + } + free(rep); + return buff; +} diff --git a/x.h b/x.h index adc1d32..0a98e9e 100644 --- a/x.h +++ b/x.h @@ -38,5 +38,6 @@ XCBCookie GetPidCookie(XCBDisplay *display, XCBWindow window); XCBCookie GetIconCookie(XCBDisplay *display, XCBWindow window); XCBCookie GetMotifHintsCookie(XCBDisplay *display, XCBWindow window); +char *GetAtomNameQuick(XCBDisplay *display, XCBAtom atom); #endif