Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!snorkelwacker!usc!brutus.cs.uiuc.edu!rpi!image.soe.clarkson.edu!sunybcs!rutgers!mcnc!rti!xyzzy!brennan From: brennan@rtp.dg.com (Dave Brennan) Newsgroups: comp.windows.x Subject: Re: Synchronous vs Asynchrounous Message-ID: Date: 6 Feb 90 22:56:25 GMT References: <1990Feb1.200702.25274@agate.berkeley.edu> <1990Feb1.213625.12870@ux1.cso.uiuc.edu> Sender: usenet@xyzzy.UUCP Organization: Data General, RTP, NC Lines: 52 In-reply-to: hammer@sp29.csrd.uiuc.edu's message of 1 Feb 90 21:36:25 GMT David Hammerslag recently posted a solution to the synchronous dialog problem. Here's a function that Greg Christy used to solve this problem. This function uses XWindowEvent to wait for the expose event. However, this doesn't give you the ability to time out if that expose event doen't come along as expected. Chris Peterson mentioned that this could be done in the loop in the funciton Hammerslag posted. (BTW, the "XFlush" at the end of this function was originally "XSync.") (This is from the motif-talk mailing list dated 31 Oct 89.) -------- Included text follows --------- /* * WaitForExpose() * * Greg Christy (greg@mickey.imsd.contel.com) * Contel Federal Systems * * October 30, 1989 * * This routine will wait (i.e., block) until an Expose event occurs * in the widget specified in the argument, process the event with * XtNextEvent() and then synchronize the server to flush out any * requests made during the execution of XtNextEvent(). This has the * effect of waiting for a widget to "appear". */ #include void WaitForExpose(w) Widget w; { XEvent event; Display * display = XtDisplay(w); Window window = XtWindow(w); XWindowEvent(display, window, ExposureMask, &event); /* wait for expose... */ XtDispatchEvent(&event); /* process it */ XFlush(display); /* flush out any requests made during */ /* XtDispatchEvent() */ } -- _________ Dave Brennan, User Interfaces, Data General Corp. / brennan@dg-rtp.dg.com Research Triangle Park, North Carolina, 27709 / ...mcnc!rti!dg-rtp!brennan Hm: (919) 460-5725 Wk: (919) 248-6330 _________/ dave_brennan@rpitsmts.bitnet