Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!usc!snorkelwacker!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: Synchronous vs Asynchrounous Message-ID: <9002021641.AA24460@expo.lcs.mit.edu> Date: 2 Feb 90 16:41:32 GMT References: <1990Feb1.213625.12870@ux1.cso.uiuc.edu> Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 40 [ David Hammerslag (hammer@uicsrd.csrd.uiuc.edu) writes: ] > I faced a similar problem. Here is what I did. (Caveat: it ain't pretty, > but is seems to work). If anybody is willing to share a more reasonable > solution, I would like to see it. > XfWorking() > { > register XEvent event; > XtAppContext app = _XtDefaultAppContext(); > Widget bboard; > Window win; > > bboard = XtParent(standby); > XtManageChild(bboard); /* this pops up the shell */ > > win = XtWindow(bboard); > do /* be XtMainLoop until the bboard gets an expose event */ > { > XtAppNextEvent(app, &event); > XtDispatchEvent(&event); > } while ((event.xany.window != win) || > (event.type != Expose)); > > XFlush(XtDisplay(standby)); > } This is one of the best solutions I have seen to this problem. In face using XtAppAddTimeout() you can even set a global variable to have this loop time out after a few seconds, so that your application doesn't hang if the window happens to be covered and doesn't receive an expose event. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213