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, Karthik Ramamoorthy <[email protected]> wrote: > > > > 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 > Hi, By making some change in the above code i am able to find all the windows of my root window(by adding some "for" loops). Is there any particular class of windows or code for particular windows like Video players , Audio playes, Browsers etc. In windows "Video" window, "Rendering" window etc has some particular class or code for them. So is there similar class/code for Video, Audio, Browser window in Xlib/Xserver. If not how is it possible to identify that this particular window is for Video or Audio(other than "window name" comparison because this can change) . If somebody can guide me regarding how to identify particlar windows it will be great help for me. Karthik -- > > Josip Deanovic > > _______________________________________________ > > Devel mailing list > > [email protected] > > http://XFree86.Org/mailman/listinfo/devel > > > >