Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: How do I get ID of the window that contains the pointer ? Message-ID: <9104130151.AA08621@lightning.McRCIM.McGill.EDU> Date: 13 Apr 91 01:51:31 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 30 > How do I get ID of the window that holds the pointer ? Which window that holds the pointer? There's a whole chain of windows, all the way from the root down to the smallest application window, all of which could be said to hold the pointer. Two plausible things you might want are (1) the "top-level" window containing the pointer (ie, the highest window that was created as a child of the root) or (2) the lowest (ie, innermost) window containing the pointer. > In most cases this window would belong to other application. Which > rules out XQueryPointer() I don't see why. You need to keep doing XQueryPointer calls, tracing your way down through the window tree until you find the window of interest, and unless you grab the server and the pointer there are race conditions, but with those caveats it should work fine. > Also, I want to get this window ID without any user input. The user need not do anything in the above scenario; in fact, the reason I said you need to grab the pointer is to freeze it, so that user input doesn't cause the mouse to change windows while you're chasing down the window tree. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu