Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!bmc.uu.se!heap From: heap@bmc.uu.se Newsgroups: comp.windows.x.motif Subject: Re: Problem using the WorkingDialog Message-ID: <1990Oct10.091924.3527@bmc.uu.se> Date: 10 Oct 90 08:19:23 GMT References: <1990Oct1.111721.3499@bmc.uu.se> <901004143230.998@alphalpha> <1990Oct5.134155.3518@bmc.uu.se> Distribution: inet Organization: Biomedical Center, University of Uppsala, Sweden Lines: 67 I received another solution of my problem, it doesn't use Xt-calls but is more compact and reliable than "my own" solution. It was (most kindly) mailed to me by cuweiss.US2.oramail@us.oracle.com. She didn't think that the original author would have anything against it being posted. So here it comes : =============================================================================== Received: 06-01-90 21:07 Sent: 06-02-90 00:03 From: kit@expo.lcs.mit.edu To: cuweiss.US2.oramail@us.oracle.com Subject: Re: Code for working around timing problems in X Cc: kit@expo.lcs.mit.edu kit@expo.lcs.mit.edu Reply-To: DVLSEQ:kit@expo.lcs.mit.edu In-Reply-To: Your message of Fri, 25 May 90 15:51:20 -0700. Anything like this is a kludge at best, and if you are not very careful you can get into trouble. Bad things can happen, like you application will hang waiting for an event that will never come. Keeping that in mind, here is one method of coding that will block until an expose event occures in the widget specified. No remember that an obscured widget will never receive an expose event, so it is important that you KNOW that the widget in question will be visable. Not just mapped, but it can also no be obscured by any other widget. This code also only returns one expose event. Expose events may come in groups, since they contain a rectangle that is the region that has been exposed. Consider the case of when an "L" shaped region has been uncovered. There are two possibilities, you can either return two expose events One for this part of the L "|" and one for this part "_". Or you could return a rectangle containing the entire box that contines the L (this also gives you some region that does not need to be repainted). Because you only get one expose event your widget may not repaint the entire widget, but just part of it. I know this all sounds like pretty ominous, but I just want you to understand that you are breaking the rules here a bit, so you had better know what you are doing. I have used this code in one of my applicaions, and it works just fine. Without further adoo... Widget widget; XEvent event; while ( !XCheckTypedWindowEvent(XtDisplay(widget), XtWindow(widget), Expose, &event) ); XtDispatchEvent( &event ); XFlush(XtDisplay(widget)); This is by no means the only way to do this, using the Xlib functions that let you peek into the event queue, you can see that there are many ways to accomplish the same task. I hope this helps you solve your problem. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213 -- ---------------------------------------------------------------------- Per Bengtsson, Dept. of Scientific Computing, Univ. of Uppsala, Sweden Internet: heap@tdb.uu.se Sunet/Decnet: tdb::heap ----------------------------------------------------------------------