home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!mcsun!Germany.EU.net!rrz.uni-koeln.de!risc3.mi.uni-koeln.de!mm
- From: mm@risc3.mi.uni-koeln.de (Martin Malich)
- Subject: Re: how to implement slow calback routines ?
- Message-ID: <1992Aug28.065258.161670@rrz.uni-koeln.de>
- Sender: news@rrz.uni-koeln.de (Usenet News System)
- Reply-To: mm@risc3.mi.uni-koeln.de (Martin Malich)
- Organization: Universit"at zu K"oln
- References: <1992Aug27.130557.6965@dxcern.cern.ch> <1992Aug27.172308.26372@sj.nec.com>
- Distribution: comp
- Date: Fri, 28 Aug 92 06:52:58 GMT
- Lines: 87
-
-
- The following code can be used to wait until a specific widget
- is displayed on the screen.
-
- Call ForceWidget(msgbox) to solve your problem.
-
-
-
- void ForceDialog(Widget w)
- {
- Widget diashell, topshell;
- Window diawindow, topwindow;
- Display *dpy;
- XWindowAttributes xwa;
- XEvent event;
- XtAppContext cxt;
-
- /* Locate the shell we are interested in. In a particular instance,
- you
- * may know these shells already.
- */
-
- for (diashell = w;
- !XtIsShell(diashell);
- diashell = XtParent(diashell))
- ;
-
- /* Locate its primary window's shell (which may be the same) */
-
- for (topshell = diashell;
- !XtIsTopLevelShell(topshell);
- topshell = XtParent(topshell))
- ;
-
- if (XtIsRealized(diashell) && XtIsRealized(topshell)) {
- dpy = XtDisplay(topshell);
- diawindow = XtWindow(diashell);
- topwindow = XtWindow(topshell);
- cxt = XtWidgetToApplicationContext(diashell);
-
- /* Wait for the dialog to be mapped. It's guaranteed to become so
- unless... */
-
- while (XGetWindowAttributes(dpy, diawindow, &xwa),
- xwa.map_state != IsViewable) {
-
- /* ...if the primary is (or becomes) unviewable or unmapped, it's
- probably iconified, and nothing will happen. */
-
- if (XGetWindowAttributes(dpy, topwindow, &xwa),
- xwa.map_state != IsViewable)
- break;
-
- /* At this stage, we are guaranteed there will be an event of some
- kind.
- Beware; we are presumably in a callback, so this can recurse. */
-
- XtAppNextEvent(cxt, &event);
- XtDispatchEvent(&event);
- }
- }
- /* The next XSync() will get an expose event if the dialog was
- unmapped. */
-
- XmUpdateDisplay(topshell);
- }
-
-
-
- hope this will help.
-
-
-
-
- ----------------------------------------------------------------------
- -------
- Martin Malich (mm@risc3.mi.uni-koeln.de)
-
- Universit"at zu K"oln
- Mathematisches Institut
- Lehrstuhl Prof.Dr.A.Bachem
- Weyertal 86-90
- 5000 K"oln 41
- Germany
- ----------------------------------------------------------------------
- -------
-
-