Path: utzoo!attcan!utgpu!watmath!att!dptg!rutgers!tut.cis.ohio-state.edu!bloom-beacon!LCS.MIT.EDU!MAP From: MAP@LCS.MIT.EDU (Michael A. Patton) Newsgroups: comp.windows.x Subject: Your double repaint problem Message-ID: <8908301910.AA11685@gaak.LCS.MIT.EDU> Date: 30 Aug 89 19:10:30 GMT References: <8908281723.AA16917@godzilla.goldhill.com> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 32 I used a different approach to solving this general problem (alluded to briefly in my previous message). Be aware that the simple solution as you describe will still get double repaints. If the window is popped up through several different overlapping windows it will get a bunch of Expose events. I used a solution with a flag which for reference I will call "need_repaint". The code below is from a program that uses Xlib, not a toolkit, but it may be quite possible to adapt this approach. There must be some place where you handle your incoming events, you can use the following code (or something like it): if (need_repaint && !XPending(dpy)) Repaint(); XNextEvent(dpy, &event); where Repaint sets need_repaint back to FALSE before doing the repaint. Then in your event processing for Expose you have simply: case Expose: need_repaint = TRUE; break; This will neatly arrange to get all the pending Expose events before doing any repainting. I can think of several approaches to adopting this for Toolkit use, but since your problem is that you're constrained by the structure of your existing program, I'll let you figure out what works best for you. If you want to discuss any particulars, feel free to contact me directly. __ /| /| /| \ Michael A. Patton, Network Manager / | / | /_|__/ Laboratory for Computer Science / |/ |/ |atton Massachusetts Institute of Technology Disclaimer: The opinions expressed above are a figment of the phosphor on your screen and do not represent the views of MIT, LCS, or MAP. :-)