Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!usc!elroy.jpl.nasa.gov!mahendo!wlbr!tweedledum!greg From: greg@tweedledum.imsd.contel.com (Greg Christy) Newsgroups: comp.windows.x Subject: Re: `Working dialogs' in Motif Keywords: Motif, dialogs, synchronous window display Message-ID: <47834@wlbr.IMSD.CONTEL.COM> Date: 1 Mar 90 01:38:22 GMT References: <1990Feb28.164742.1177@Citicorp.COM> Sender: news@wlbr.IMSD.CONTEL.COM Lines: 70 I brought this problem up on motif-talk in October and the message that follows contains the hack that I have been using since then to circumvent this annoyance. The code was written with the goal of waiting the minimum amount of time for the widget to "appear" and therefore only processing the event that is necessary for this to happen. -------------------- From: greg%tweedledum@WLV.imsd.contel.com (Greg Christy) To: motif-talk@osf.org Subject: Waiting for a Dialog to Appear... Date: Mon, 30 Oct 89 16:44:31 PST I think I've found the answer to my own question after mucking around with event dumps from xscope. I tried some variations on the events to process while waiting for the Expose event, but only the Expose event seems to be important. The code shown below seems to do the trick. Does anyone know of any side-effects that may be introduced by this method? /* * WaitForExpose() * October 30, 1989 * * Greg Christy (greg@mickey.imsd.contel.com) * * 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". * * Copyright 1989 by Contel Federal Systems * * Permission to use, copy, modify, and distribute this software * without fee is hereby granted, provided that the above copyright * notice appears in all copies. It is provided "as is" without any * express or implied warranty. */ #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 */ XSync(display,0); /* flush out any requests made during */ /* XtDispatchEvent() */ } ------------------------------------------------------------------------------- Greg Christy dumb email: greg%mickey@wlv.imsd.contel.com Contel Federal Systems smart email: greg@mickey.imsd.contel.com 31717 La Tienda Drive phone: (818) 706-4307 Westlake Village, CA 91359 -------------------------------------------------------------------------------