Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / tas / xal / ForceUpdate.c
1 /****************************************************************************/
2 /* */
3 /* ALLIANCE CAD FRAMEWORK */
4 /* */
5 /* Tool : libXal Version 1.01 */
6 /* File : ForceUpdate.c */
7 /* */
8 /* (c) copyright 1993 MASI Laboratory. CAO & VLSI CAD Team */
9 /* All rights reserved. */
10 /* Support : e-mail cao-vlsi@masi.ibp.fr */
11 /* */
12 /* Author(s) : Nizar ABDALLAH Date : 02/02/1993 */
13 /* */
14 /* Modified by : Date : ../../.... */
15 /* Modified by : Date : ../../.... */
16 /* Modified by : Date : ../../.... */
17 /* */
18 /****************************************************************************/
19 /* */
20 /* This function is a superset of XmUpdateDisplay() in that it will ensure */
21 /* that a window's contents are visible before returning. The monitoring */
22 /* of window states is necessary because attempts to map a window are */
23 /* subject to the whim of the window manager. This introduces a signifi- */
24 /* cant delay before the window is actually mapped and exposed. */
25 /* */
26 /****************************************************************************/
27
28
29 /*--------------------------------------------------------------------------*/
30 /* INCLUDE FILES */
31 /*--------------------------------------------------------------------------*/
32 #include <Xm/Xm.h>
33
34 /*-----------------------------*/
35 /* Motif for Alliance includes */
36 /*-----------------------------*/
37 #include MUT_H
38
39 #include XAL_H
40
41 /*---------------------------------------------------------------------------*/
42 /* */
43 /* FUNCTION : XalForceUpdate */
44 /* */
45 /* IN ARGS : .w : The widget that will serve to get the display pointer */
46 /* */
47 /* OUT ARGS : ( void ) */
48 /* */
49 /* OBJECT : Forces and updates the contents of a specific window. */
50 /* */
51 /*---------------------------------------------------------------------------*/
52 void XalForceUpdate(w)
53 Widget w;
54 {
55 Display *dpy;
56 XEvent event;
57 Widget diashell, topshell;
58 Window diawindow, topwindow;
59 XWindowAttributes xwa;
60 XtAppContext cxt = XtWidgetToApplicationContext(w);
61
62 /*---------------------------------------*/
63 /* Locate the shell we are interested in */
64 /*---------------------------------------*/
65 for (diashell = w; !XtIsShell(diashell);diashell = XtParent(diashell)) ;
66
67 /*------------------------------------*/
68 /* Locate it's primary window's shell */
69 /*------------------------------------*/
70 for (topshell = diashell; !XtIsTopLevelShell(topshell);topshell = XtParent(topshell)) ;
71
72 /*-----------------------------------------------------------------------*/
73 /* If the dialog shell is not realized, don't bother. Nothing can happen */
74 /*-----------------------------------------------------------------------*/
75 if (XtIsRealized(diashell) && XtIsRealized(topshell))
76 {
77 dpy = XtDisplay( topshell );
78 diawindow = XtWindow( diashell );
79 topwindow = XtWindow( topshell );
80
81 /*----------------------------------*/
82 /* Wait for the dialog to be mapped */
83 /*----------------------------------*/
84 while ((XGetWindowAttributes( dpy, diawindow, &xwa )) &&
85 (xwa.map_state != IsViewable) )
86 {
87 if ((XGetWindowAttributes( dpy, topwindow, &xwa )) &&
88 (xwa.map_state != IsViewable ))
89 break;
90 XtAppNextEvent( cxt, &event );
91 XtDispatchEvent( &event );
92 }
93 }
94 XmUpdateDisplay( topshell );
95 }
96
97