pickel@mcnc.org (Lisa C. Pickel) (06/21/89)
Okay, I give up. I'm still at work porting old things to X11, and my question is: what is the proper way to open popup windows and then get them to disappear again? Obviously, I'm missing completely the proper X "philosophy" on this issue. In the following, I use the ancient term "popup" to refer to any child window of the parent in my application. The children lie totally within the bounds of the parent and they are spawned by the parent window. I want to draw objects inside my popups and then, when I kill the popup, have the whole mess disappear. It does not. I've tried: 1) Save-under. We don't have it. That's out. 2) Saving the underlying pixmap before mapping the popup (with IncludeInferiors set). However, I still get garbage in the pixmap where other popups beneath the popup in question lie. (Yes, everybody has the same depth). 3) Drawing everything to the parent window and defining the popup as InputOnly. This seems kludgey and philosophically incorrect. I mean, you open a window, graphical operations are defined to occur in that window, shouldn't you *draw* in that window? Anyway, it too seems not to work properly. Lisa.
klee@gilroy.pa.dec.com (Ken Lee) (06/22/89)
In article <4748@alvin.mcnc.org>, pickel@mcnc.org (Lisa C. Pickel) writes: > I want to draw objects inside my popups and then, when I kill the popup, > have the whole mess disappear. It does not. I've tried: > > 1) Save-under. We don't have it. That's out. > > 2) Saving the underlying pixmap before mapping the popup (with > IncludeInferiors set). However, I still get garbage in the pixmap > where other popups beneath the popup in question lie. (Yes, > everybody has the same depth). Although I hate to admit it, I did this with an X11R1 server (no save-under or backing store): 1. grab the server to make sure the lower windows don't get modified when your popup is up 2. calculate your window position and size, then copy the pixmap (include inferiors) that would be beneath it 3. map your popup window override-redirect so the window manager doesn't put it somewhere else 4. send the underlying windows a client message containing the geometry of the popup (so they can ignore the exposure when you unmap the popup) - you do need a private inter-client protocol to manage this 5. eventually unmap your popup 6. copy the pixmap back into position 7. ungrab the server If you have multiple overlapping popups, this still works as long as they're unmapped in the reverse of the order in which they were mapped. Fortunately, this was true of my case, a popup-menu heirarachy. Note that step 4 is error-prone. If you're not really careful (or lucky) you may ignore valid exposure events. Is all this worth the effort? In most cases, definately not. But, if your machine is really slow AND your graphics will take a looong time to reproduce after an exposure AND you can't hack your server to add backing store or save under AND the server grab doesn't screw up your other clients, then maybe you have to do it. Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@decwrl.dec.com Uucp: uunet!decwrl!klee