[I suspect this sort of question would be more suited to the ``xfree86''
list than the ``devel'' list, hence the redirection.]
On Monday, Jan 13, Krasi Zlatev wrote:
> I would like to gather inforamtion about all the
> running X applicaiotns.
> Thus I do
> Window root = RootWindow (dpy, screenno);
> XQueryTree (dpy, root, &dummywindow, &dummywindow,
> &children, &nchildren);
>
> for (i = 0; i < nchildren; i++) {
> if (XGetWindowAttributes(dpy, children[i],
> &attr) && (attr.map_state == IsViewable)) {
> XFetchName(dpy, children[i], &win_name);
> printf("Window ID: 0x%lx\n",children[i]);
> }
> }
>
> I thought that win_name will contain the name of the
> window, but it is always null,
> what am I doing wrong?
The manual page for XFetchName says:
Status XFetchName(display, w, window_name_return)
Display *display;
Window w;
char **window_name_return;
[ ... ]
The XFetchName function returns the name of the specified
window. If it succeeds, it returns a nonzero status; oth�
erwise, no name has been set for the window, and it
returns zero. If the WM_NAME property has not been set
for this window, XFetchName sets window_name_return to
NULL. If the data returned by the server is in the Latin
Portable Character Encoding, then the returned string is
in the Host Portable Character Encoding. Otherwise, the
result is implementation-dependent. When finished with
it, a client must free the window name string using XFree.
Why aren't you checking the return-values of your function calls?
XFetchName() could be returning zero.
Alternatively, you might want to look more into this "WM_NAME" property.
You can find the XFree86 manual pages (section 3) online at:
http://www.xfree86.org/current/manindex3.html
_______________________________________________
XFree86 mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xfree86