diamant@hpfclp.SDE.HP.COM (John Diamant) (08/04/88)
I am looking for a way to find the smallest enclosing window in which the pointer is located whenever a mouse click occurs. I've tried grabbing the pointer and getting the buttonpress event. The problem is that the subwindow returned is the child of the window upon which the grab was done (typically the root window). But that is the appliation toplevel window (or the window manager frame if it is a reparenting window manager). I need to get the smallest window (the one that would get the input event if all windows had expressed interest in the event). I've also tried using XQueryPointer, but it has the same problem (I have to know the parent of the window I'm interested in). I know I can get the info by executing successive XQueryPointer calls passing the child window in as the window each time, but I would probably have to grab the server to be on the safe side (making sure the pointer didn't move). That seems kind of anti-social. Is there a better (faster, easier) way than searching the window tree? It seems as though there should be since the server clearly knows which window this is in order to generate the event on it. Thanks in advance, John Diamant Software Development Environments Hewlett-Packard Co. ARPA Internet: diamant@hpfclp.sde.hp.com Fort Collins, CO UUCP: {hplabs,hpfcla}!hpfclp!diamant
swick@ATHENA.MIT.EDU (Ralph R. Swick) (08/10/88)
XTranslateCoordinates will give you the next lower level of the tree without having to assume the pointer is stationary. You still have to walk the tree yourself.