Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: Traversing a X11 window tree Message-ID: <9009231647.AA02795@Larry.McRCIM.McGill.EDU> Date: 23 Sep 90 16:47:50 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 31 > I am looking for a way to figure out the window id of an xterm or > hpterm window. What I would like to do is XLIB graphics in the > hpterm window or create a child window with the hpterm as its parent > window. > I have used xwininfo to observe the window tree, but am not sure how > to traverse the tree, or really how to know when I have found the > window tree of the hpterm. Traversing the tree is relatively easy. You start with the root window and do an XQueryTree on it to get the window IDs of its children, then recurse down the tree. How to tell when you have the window you want is the sticky part. Finding an hpterm window is presumably not that hard; the really difficult part is trying to tell *which* hpterm window you want. Presumably you want the window from within which your program was started - but such a window may not even exist, and if it does, the association between it and anything you have access to is spread through a half-dozen places, most of which you do not have access to. I notice that xterm creates an environment variable WINDOWID which is, at least in a simple test I just ran, the ID of the xterm window (in decimal, interestingly); hpterm may do something similar. Of course, this cannot be entirely trusted, because the user may change or destroy the variable, but it may be of some use. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu