Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bionet!agate!shelby!decwrl!gilroy.pa.dec.com!klee From: klee@gilroy.pa.dec.com (Ken Lee) Newsgroups: comp.windows.x Subject: Re: do-it-yourself popups in Xlib Keywords: how Message-ID: <1519@bacchus.dec.com> Date: 21 Jun 89 17:47:55 GMT References: <4748@alvin.mcnc.org> Sender: news@decwrl.dec.com Distribution: na Lines: 44 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