I'm using the following to get the names of all X windows:
Atom nameAtom = XInternAtom(dpy,"_NET_WM_NAME",false);
Atom type;
int format;
unsigned long nitems, after;
unsigned char *data = 0;
if (Success == XGetWindowProperty(dpy, window, nameAtom, 0, 65536,
false, XA_ATOM, &type, &format,
&nitems, &after, &data)) {
if (data) {
Atom windowName = *(Atom*)data;
const char* name = XGetAtomName(dpy, windowName);
log.debug("Name: %s", name);
XFree(data);
}
}
But in my log I'm just getting (null)
for every single window. What am I doing wrong?
What was required was to specify the req_type as
UTF8_STRING
accordingly: