Re: how to get handle of active window
Karthik Ramamoorthy <[email protected]>
| Newsgroups | gmane.comp.xfree86.devel |
|---|---|
| Message-ID | <[email protected]> |
On 9/6/05, Josip Deanovic <[email protected]> wrote: > >You can use XQueryTree to get all the windows and then chose only > >those you are interested in. > > I tried with XQueryTree, but its not giving the proper window id of the > kids. I had opened one shell Terminal window and Mozilla. I wote the program > as below static char *window_id_format = "0x%lx"; int main(void) { unsigned int numkids, i,mapped,scrn; Window r, p, *kids; XWindowAttributes attr; Window root; Display *dipsy; char *win_name; dipsy = XOpenDisplay(0); scrn = DefaultScreen(dipsy); root = RootWindow(dipsy, scrn); mapped = 0; XQueryTree(dipsy, root, &r, &p, &kids, &numkids); for (i = 0; i < numkids; ++i) { XGetWindowAttributes(dipsy, kids[i], &attr); if (attr.map_state == IsViewable) { ++mapped; printf(window_id_format, kids[i]); if (!XFetchName(dipsy, kids[i], &win_name)) { /* Get window name if any */ printf(" (has no name)\n"); printf(" \n"); } else if (win_name) { printf(" %s ", win_name); XFree(win_name); } } } Its printing some other window id not that of shell and Mozilla(i checked it using xwininfo), and also its printing 'no name' instead of Mozilla or shell Terminal. So Josip can u tell me whats wrong with XQueryTree, is it not the proper function or what. Please guide me regarding this problem Karthik -- > Josip Deanovic > _______________________________________________ > Devel mailing list > [email protected] > http://XFree86.Org/mailman/listinfo/devel >