Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!trwacs!epstein From: epstein@trwacs.UUCP (Jeremy Epstein) Newsgroups: comp.windows.x Subject: Window visibility question Message-ID: <206@trwacs.UUCP> Date: 2 May 90 14:19:41 GMT Organization: TRW Systems Division, Fairfax VA Lines: 42 I'm looking for a way to calculate which portions of a window are visible and which are obscured. I know that expose events will tell me what I need to redraw, but I need to know when the window becomes obscured, *not* when it is exposed. Is there any mechanism in X11R4 to do this? I've come up with some hacky solutions (see below), as well as some ideas for extensions to the protocol, but nothing simple or elegant. Some ideas I've come up with (perhaps there's a refinement that would make one of these reasonable?): (1) Visibility events provide some assistance, however they only record state changes between three states (totally visible, partially visible, and totally obscured), plus they don't report what areas are obscured. One possible solution is to extend visibility events so they report all partial obscuring, and add the (x,y,width,height) values of what was obscured. Then using visibility events with expose events would be sufficient. (2) Another possibility is to periodically do XQueryTree() operations, and examine the placement and geometry of all windows higher in the stacking order. This makes it fairly easy to figure out what areas are obscured. The converse (what areas are visible) is somewhat more difficult, but still possible. However, it still doesn't solve the problem of when to do the XQueryTree() operations, since there's no notification of new window creation. (3) By setting up for CreateWindow and MapWindow events I could be notified of all windows which are created, and then use the XQueryTree method as described above. Of course, I'd probably also need to track resizing, window destruction, configuration, etc. Any better solutions, please???? -- Jeremy Epstein epstein@trwacs.uu.net TRW Systems Division 703-876-8776