SetValues.c revision 2265a131
1444c061aSmrg/* $Xorg: SetValues.c,v 1.4 2001/02/09 02:03:58 xorgcvs Exp $ */
2444c061aSmrg
3444c061aSmrg/***********************************************************
4444c061aSmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
5444c061aSmrgCopyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
6444c061aSmrg
7444c061aSmrg                        All Rights Reserved
8444c061aSmrg
9444c061aSmrgPermission to use, copy, modify, and distribute this software and its
10444c061aSmrgdocumentation for any purpose and without fee is hereby granted,
11444c061aSmrgprovided that the above copyright notice appear in all copies and that
12444c061aSmrgboth that copyright notice and this permission notice appear in
13444c061aSmrgsupporting documentation, and that the names of Digital or Sun not be
14444c061aSmrgused in advertising or publicity pertaining to distribution of the
15444c061aSmrgsoftware without specific, written prior permission.
16444c061aSmrg
17444c061aSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
18444c061aSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
19444c061aSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
20444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21444c061aSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22444c061aSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23444c061aSmrgSOFTWARE.
24444c061aSmrg
25444c061aSmrgSUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
26444c061aSmrgINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
27444c061aSmrgNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
28444c061aSmrgABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
29444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
30444c061aSmrgPROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
31444c061aSmrgOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
32444c061aSmrgTHE USE OR PERFORMANCE OF THIS SOFTWARE.
33444c061aSmrg
34444c061aSmrg******************************************************************/
35444c061aSmrg
36444c061aSmrg/*
37444c061aSmrg
38444c061aSmrgCopyright 1987, 1988, 1994, 1998  The Open Group
39444c061aSmrg
40444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its
41444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that
42444c061aSmrgthe above copyright notice appear in all copies and that both that
43444c061aSmrgcopyright notice and this permission notice appear in supporting
44444c061aSmrgdocumentation.
45444c061aSmrg
46444c061aSmrgThe above copyright notice and this permission notice shall be included in
47444c061aSmrgall copies or substantial portions of the Software.
48444c061aSmrg
49444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
52444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
53444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
54444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55444c061aSmrg
56444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be
57444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings
58444c061aSmrgin this Software without prior written authorization from The Open Group.
59444c061aSmrg
60444c061aSmrg*/
61444c061aSmrg/* $XFree86: xc/lib/Xt/SetValues.c,v 1.2 2001/08/22 22:52:19 dawes Exp $ */
62444c061aSmrg
63444c061aSmrg#ifdef HAVE_CONFIG_H
64444c061aSmrg#include <config.h>
65444c061aSmrg#endif
66444c061aSmrg#include "IntrinsicI.h"
67444c061aSmrg
68444c061aSmrg/*
69444c061aSmrg *	XtSetValues(), XtSetSubvalues()
70444c061aSmrg */
71444c061aSmrg
72444c061aSmrg
73444c061aSmrgstatic void SetValues(
74444c061aSmrg  char*			base,		/* Base address to write values to   */
75444c061aSmrg  XrmResourceList*	res,		/* The current resource values.      */
76444c061aSmrg  register Cardinal	num_resources,	/* number of items in resources      */
77444c061aSmrg  ArgList 		args,		/* The resource values to set        */
78444c061aSmrg  Cardinal		num_args)	/* number of items in arg list       */
79444c061aSmrg{
80444c061aSmrg    register ArgList		arg;
81444c061aSmrg    register Cardinal 	        i;
82444c061aSmrg    register XrmName		argName;
83444c061aSmrg    register XrmResourceList*   xrmres;
84444c061aSmrg
85444c061aSmrg    /* Resource lists are assumed to be in compiled form already via the
86444c061aSmrg       initial XtGetResources, XtGetSubresources calls */
87444c061aSmrg
88444c061aSmrg    for (arg = args ; num_args != 0; num_args--, arg++) {
89444c061aSmrg	argName = StringToName(arg->name);
90444c061aSmrg	for (xrmres = res, i = 0; i < num_resources; i++, xrmres++) {
91444c061aSmrg	    if (argName == (*xrmres)->xrm_name) {
92444c061aSmrg		_XtCopyFromArg(arg->value,
93444c061aSmrg		    base - (*xrmres)->xrm_offset - 1,
94444c061aSmrg		    (*xrmres)->xrm_size);
95444c061aSmrg		break;
96444c061aSmrg	    }
97444c061aSmrg	}
98444c061aSmrg    }
99444c061aSmrg} /* SetValues */
100444c061aSmrg
101444c061aSmrgstatic Boolean CallSetValues (
102444c061aSmrg    WidgetClass class,
103444c061aSmrg    Widget      current,
104444c061aSmrg    Widget      request,
105444c061aSmrg    Widget      new,
106444c061aSmrg    ArgList     args,
107444c061aSmrg    Cardinal    num_args)
108444c061aSmrg{
109444c061aSmrg    Boolean redisplay = FALSE;
110444c061aSmrg    WidgetClass superclass;
111444c061aSmrg    XtArgsFunc set_values_hook;
112444c061aSmrg    XtSetValuesFunc set_values;
113444c061aSmrg
114444c061aSmrg    LOCK_PROCESS;
115444c061aSmrg    superclass = class->core_class.superclass;
116444c061aSmrg    UNLOCK_PROCESS;
117444c061aSmrg    if (superclass)
118444c061aSmrg        redisplay =
119444c061aSmrg	    CallSetValues(superclass, current, request, new, args, num_args);
120444c061aSmrg
121444c061aSmrg    LOCK_PROCESS;
122444c061aSmrg    set_values = class->core_class.set_values;
123444c061aSmrg    UNLOCK_PROCESS;
124444c061aSmrg    if (set_values)
125444c061aSmrg        redisplay |= (*set_values) (current, request, new, args, &num_args);
126444c061aSmrg
127444c061aSmrg    LOCK_PROCESS;
128444c061aSmrg    set_values_hook = class->core_class.set_values_hook;
129444c061aSmrg    UNLOCK_PROCESS;
130444c061aSmrg    if (set_values_hook)
131444c061aSmrg	redisplay |= (*set_values_hook) (new, args, &num_args);
132444c061aSmrg    return (redisplay);
133444c061aSmrg}
134444c061aSmrg
135444c061aSmrgstatic Boolean
136444c061aSmrgCallConstraintSetValues (
137444c061aSmrg    ConstraintWidgetClass class,
138444c061aSmrg    Widget      current,
139444c061aSmrg    Widget      request,
140444c061aSmrg    Widget      new,
141444c061aSmrg    ArgList     args,
142444c061aSmrg    Cardinal    num_args)
143444c061aSmrg{
144444c061aSmrg    Boolean redisplay = FALSE;
145444c061aSmrg    XtSetValuesFunc set_values;
146444c061aSmrg    ConstraintWidgetClass superclass;
147444c061aSmrg
148444c061aSmrg    if ((WidgetClass)class != constraintWidgetClass) {
149444c061aSmrg	if (class == NULL)
150444c061aSmrg	    XtAppErrorMsg(XtWidgetToApplicationContext(current),
151444c061aSmrg		    "invalidClass","constraintSetValue",XtCXtToolkitError,
152444c061aSmrg                 "Subclass of Constraint required in CallConstraintSetValues",
153444c061aSmrg                  (String *)NULL, (Cardinal *)NULL);
154444c061aSmrg	LOCK_PROCESS;
155444c061aSmrg	superclass = (ConstraintWidgetClass) class->core_class.superclass;
156444c061aSmrg	UNLOCK_PROCESS;
157444c061aSmrg	redisplay =
158444c061aSmrg	   CallConstraintSetValues(superclass,
159444c061aSmrg				   current, request, new, args, num_args);
160444c061aSmrg    }
161444c061aSmrg    LOCK_PROCESS;
162444c061aSmrg    set_values = class->constraint_class.set_values;
163444c061aSmrg    UNLOCK_PROCESS;
164444c061aSmrg    if (set_values)
165444c061aSmrg        redisplay |= (*set_values) (current, request, new, args, &num_args);
166444c061aSmrg    return (redisplay);
167444c061aSmrg}
168444c061aSmrg
169444c061aSmrgvoid XtSetSubvalues(
170444c061aSmrg  XtPointer             base,           /* Base address to write values to   */
171444c061aSmrg  register XtResourceList resources,    /* The current resource values.      */
172444c061aSmrg  register Cardinal     num_resources,  /* number of items in resources      */
173444c061aSmrg  ArgList               args,           /* The resource values to set        */
174444c061aSmrg  Cardinal              num_args)       /* number of items in arg list       */
175444c061aSmrg{
176444c061aSmrg      register XrmResourceList*   xrmres;
177444c061aSmrg      xrmres = _XtCreateIndirectionTable (resources, num_resources);
178444c061aSmrg      SetValues((char*)base,xrmres,num_resources, args, num_args);
179444c061aSmrg      XtFree((char *)xrmres);
180444c061aSmrg}
181444c061aSmrg
182444c061aSmrg
183444c061aSmrgvoid XtSetValues(
184444c061aSmrg    register Widget   w,
185444c061aSmrg	     ArgList  args,
186444c061aSmrg	     Cardinal num_args)
187444c061aSmrg{
188444c061aSmrg    register Widget oldw, reqw;
189444c061aSmrg    /* need to use strictest alignment rules possible in next two decls. */
190444c061aSmrg    double	    oldwCache[100], reqwCache[100];
191444c061aSmrg    double	    oldcCache[20], reqcCache[20];
192444c061aSmrg    Cardinal	    widgetSize, constraintSize;
193444c061aSmrg    Boolean	    redisplay, cleared_rect_obj = False;
194444c061aSmrg    XtGeometryResult result;
195444c061aSmrg    XtWidgetGeometry geoReq, geoReply;
196444c061aSmrg    WidgetClass     wc;
1972265a131Smrg    ConstraintWidgetClass cwc = NULL;
198444c061aSmrg    Boolean	    hasConstraints;
199444c061aSmrg    XtAlmostProc set_values_almost;
200444c061aSmrg    XtAppContext app = XtWidgetToApplicationContext(w);
201444c061aSmrg    Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(w));
202444c061aSmrg
203444c061aSmrg    LOCK_APP(app);
204444c061aSmrg    wc = XtClass(w);
205444c061aSmrg    if ((args == NULL) && (num_args != 0)) {
206444c061aSmrg        XtAppErrorMsg(app,
207444c061aSmrg		"invalidArgCount","xtSetValues",XtCXtToolkitError,
208444c061aSmrg                "Argument count > 0 on NULL argument list in XtSetValues",
209444c061aSmrg                 (String *)NULL, (Cardinal *)NULL);
210444c061aSmrg    }
211444c061aSmrg
212444c061aSmrg    /* Allocate and copy current widget into old widget */
213444c061aSmrg
214444c061aSmrg    LOCK_PROCESS;
215444c061aSmrg    widgetSize = wc->core_class.widget_size;
216444c061aSmrg    UNLOCK_PROCESS;
217444c061aSmrg    oldw = (Widget) XtStackAlloc(widgetSize, oldwCache);
218444c061aSmrg    reqw = (Widget) XtStackAlloc (widgetSize, reqwCache);
219444c061aSmrg    (void) memmove((char *) oldw, (char *) w, (int) widgetSize);
220444c061aSmrg
221444c061aSmrg    /* Set resource values */
222444c061aSmrg
223444c061aSmrg    LOCK_PROCESS;
224444c061aSmrg    SetValues((char*)w, (XrmResourceList *) wc->core_class.resources,
225444c061aSmrg	wc->core_class.num_resources, args, num_args);
226444c061aSmrg    UNLOCK_PROCESS;
227444c061aSmrg
228444c061aSmrg    (void) memmove ((char *) reqw, (char *) w, (int) widgetSize);
229444c061aSmrg
230444c061aSmrg    hasConstraints = (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)));
231444c061aSmrg
232444c061aSmrg    /* Some widget sets apparently do ugly things by freeing the
233444c061aSmrg     * constraints on some children, thus the extra test here */
234444c061aSmrg    if (hasConstraints) {
235444c061aSmrg	cwc = (ConstraintWidgetClass) XtClass(w->core.parent);
236444c061aSmrg	if (w->core.constraints) {
237444c061aSmrg	    LOCK_PROCESS;
238444c061aSmrg	    constraintSize = cwc->constraint_class.constraint_size;
239444c061aSmrg	    UNLOCK_PROCESS;
240444c061aSmrg	} else constraintSize = 0;
241444c061aSmrg    } else constraintSize = 0;
242444c061aSmrg
243444c061aSmrg    if (constraintSize) {
244444c061aSmrg	/* Allocate and copy current constraints into oldw */
245444c061aSmrg	oldw->core.constraints = XtStackAlloc(constraintSize, oldcCache);
246444c061aSmrg	reqw->core.constraints = XtStackAlloc(constraintSize, reqcCache);
247444c061aSmrg	(void) memmove((char *) oldw->core.constraints,
248444c061aSmrg		       (char *) w->core.constraints, (int) constraintSize);
249444c061aSmrg
250444c061aSmrg	/* Set constraint values */
251444c061aSmrg	LOCK_PROCESS;
252444c061aSmrg	SetValues((char*)w->core.constraints,
253444c061aSmrg	    (XrmResourceList *)(cwc->constraint_class.resources),
254444c061aSmrg	    cwc->constraint_class.num_resources, args, num_args);
255444c061aSmrg	UNLOCK_PROCESS;
256444c061aSmrg	(void) memmove((char *) reqw->core.constraints,
257444c061aSmrg		       (char *) w->core.constraints, (int) constraintSize);
258444c061aSmrg    }
259444c061aSmrg
260444c061aSmrg    /* Inform widget of changes, then inform parent of changes */
261444c061aSmrg    redisplay = CallSetValues (wc, oldw, reqw, w, args, num_args);
262444c061aSmrg    if (hasConstraints) {
263444c061aSmrg	redisplay |= CallConstraintSetValues(cwc, oldw, reqw, w, args, num_args);
264444c061aSmrg    }
265444c061aSmrg
266444c061aSmrg    if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
267444c061aSmrg	XtChangeHookDataRec call_data;
268444c061aSmrg	XtChangeHookSetValuesDataRec set_val;
269444c061aSmrg
270444c061aSmrg	set_val.old = oldw;
271444c061aSmrg	set_val.req = reqw;
272444c061aSmrg	set_val.args = args;
273444c061aSmrg	set_val.num_args = num_args;
274444c061aSmrg	call_data.type = XtHsetValues;
275444c061aSmrg	call_data.widget = w;
276444c061aSmrg	call_data.event_data = (XtPointer) &set_val;
277444c061aSmrg	XtCallCallbackList(hookobj,
278444c061aSmrg		((HookObject)hookobj)->hooks.changehook_callbacks,
279444c061aSmrg		(XtPointer)&call_data);
280444c061aSmrg    }
281444c061aSmrg
282444c061aSmrg    if (XtIsRectObj(w)) {
283444c061aSmrg	/* Now perform geometry request if needed */
284444c061aSmrg	geoReq.request_mode = 0;
285444c061aSmrg	if (oldw->core.x	!= w->core.x) {
286444c061aSmrg	    geoReq.x		= w->core.x;
287444c061aSmrg	    w->core.x		= oldw->core.x;
288444c061aSmrg	    geoReq.request_mode |= CWX;
289444c061aSmrg	}
290444c061aSmrg	if (oldw->core.y	!= w->core.y) {
291444c061aSmrg	    geoReq.y		= w->core.y;
292444c061aSmrg	    w->core.y		= oldw->core.y;
293444c061aSmrg	    geoReq.request_mode |= CWY;
294444c061aSmrg	}
295444c061aSmrg	if (oldw->core.width	!= w->core.width) {
296444c061aSmrg	    geoReq.width	= w->core.width;
297444c061aSmrg	    w->core.width	= oldw->core.width;
298444c061aSmrg	    geoReq.request_mode |= CWWidth;
299444c061aSmrg	}
300444c061aSmrg	if (oldw->core.height	!= w->core.height) {
301444c061aSmrg	    geoReq.height	= w->core.height;
302444c061aSmrg	    w->core.height	= oldw->core.height;
303444c061aSmrg	    geoReq.request_mode |= CWHeight;
304444c061aSmrg	}
305444c061aSmrg	if (oldw->core.border_width != w->core.border_width) {
306444c061aSmrg	    geoReq.border_width	    = w->core.border_width;
307444c061aSmrg	    w->core.border_width    = oldw->core.border_width;
308444c061aSmrg	    geoReq.request_mode	    |= CWBorderWidth;
309444c061aSmrg	}
310444c061aSmrg
311444c061aSmrg	if (geoReq.request_mode != 0) {
312444c061aSmrg	    /* Pass on any requests for unchanged geometry values */
313444c061aSmrg	    if (geoReq.request_mode !=
314444c061aSmrg		(CWX | CWY | CWWidth | CWHeight | CWBorderWidth)) {
315444c061aSmrg		for ( ; num_args != 0; num_args--, args++) {
316444c061aSmrg		    if (! (geoReq.request_mode & CWX) &&
317444c061aSmrg			strcmp(XtNx, args->name) == 0) {
318444c061aSmrg			geoReq.x = w->core.x;
319444c061aSmrg			geoReq.request_mode |= CWX;
320444c061aSmrg		    } else if (! (geoReq.request_mode & CWY) &&
321444c061aSmrg			       strcmp(XtNy, args->name) == 0) {
322444c061aSmrg			geoReq.y = w->core.y;
323444c061aSmrg			geoReq.request_mode |= CWY;
324444c061aSmrg		    } else if (! (geoReq.request_mode & CWWidth) &&
325444c061aSmrg			       strcmp(XtNwidth, args->name) == 0) {
326444c061aSmrg			geoReq.width = w->core.width;
327444c061aSmrg			geoReq.request_mode |= CWWidth;
328444c061aSmrg		    } else if (! (geoReq.request_mode & CWHeight) &&
329444c061aSmrg			       strcmp(XtNheight, args->name) == 0) {
330444c061aSmrg			geoReq.height = w->core.height;
331444c061aSmrg			geoReq.request_mode |= CWHeight;
332444c061aSmrg		    } else if (! (geoReq.request_mode & CWBorderWidth) &&
333444c061aSmrg			       strcmp(XtNborderWidth, args->name) == 0) {
334444c061aSmrg			geoReq.border_width = w->core.border_width;
335444c061aSmrg			geoReq.request_mode |= CWBorderWidth;
336444c061aSmrg		    }
337444c061aSmrg		}
338444c061aSmrg	    }
339444c061aSmrg	    CALLGEOTAT(_XtGeoTrace(w,
340444c061aSmrg		     "\nXtSetValues sees some geometry changes for \"%s\".\n",
341444c061aSmrg			   XtName(w)));
342444c061aSmrg	    CALLGEOTAT(_XtGeoTab(1));
343444c061aSmrg	    do {
344444c061aSmrg		XtGeometryHookDataRec call_data;
345444c061aSmrg
346444c061aSmrg		if (XtHasCallbacks(hookobj, XtNgeometryHook) == XtCallbackHasSome) {
347444c061aSmrg		    call_data.type = XtHpreGeometry;
348444c061aSmrg		    call_data.widget = w;
349444c061aSmrg		    call_data.request = &geoReq;
350444c061aSmrg		    XtCallCallbackList(hookobj,
351444c061aSmrg			((HookObject)hookobj)->hooks.geometryhook_callbacks,
352444c061aSmrg			(XtPointer)&call_data);
353444c061aSmrg		    call_data.result = result =
354444c061aSmrg			_XtMakeGeometryRequest(w, &geoReq, &geoReply,
355444c061aSmrg					       &cleared_rect_obj);
356444c061aSmrg		    call_data.type = XtHpostGeometry;
357444c061aSmrg		    call_data.reply = &geoReply;
358444c061aSmrg		    XtCallCallbackList(hookobj,
359444c061aSmrg			((HookObject)hookobj)->hooks.geometryhook_callbacks,
360444c061aSmrg			(XtPointer)&call_data);
361444c061aSmrg		} else {
362444c061aSmrg		    result = _XtMakeGeometryRequest(w, &geoReq, &geoReply,
363444c061aSmrg						    &cleared_rect_obj);
364444c061aSmrg		}
365444c061aSmrg		if (result == XtGeometryYes || result == XtGeometryDone)
366444c061aSmrg		    break;
367444c061aSmrg
368444c061aSmrg		/* An Almost or No reply.  Call widget and let it munge
369444c061aSmrg		   request, reply */
370444c061aSmrg		LOCK_PROCESS;
371444c061aSmrg		set_values_almost = wc->core_class.set_values_almost;
372444c061aSmrg		UNLOCK_PROCESS;
373444c061aSmrg		if (set_values_almost == NULL) {
374444c061aSmrg		    XtAppWarningMsg(app,
375444c061aSmrg			    "invalidProcedure","set_values_almost",
376444c061aSmrg			  XtCXtToolkitError,
377444c061aSmrg			  "set_values_almost procedure shouldn't be NULL",
378444c061aSmrg			  (String *)NULL, (Cardinal *)NULL);
379444c061aSmrg		    break;
380444c061aSmrg		}
381444c061aSmrg		if (result == XtGeometryNo) geoReply.request_mode = 0;
382444c061aSmrg		CALLGEOTAT(_XtGeoTrace(w,"calling SetValuesAlmost.\n"));
383444c061aSmrg		(*set_values_almost) (oldw, w, &geoReq, &geoReply);
384444c061aSmrg	    } while (geoReq.request_mode != 0);
385444c061aSmrg	    /* call resize proc if we changed size and parent
386444c061aSmrg	     * didn't already invoke resize */
387444c061aSmrg	    {
388444c061aSmrg	    XtWidgetProc resize;
389444c061aSmrg	    LOCK_PROCESS;
390444c061aSmrg	    resize = wc->core_class.resize;
391444c061aSmrg	    UNLOCK_PROCESS;
392444c061aSmrg	    if ((w->core.width != oldw->core.width ||
393444c061aSmrg		 w->core.height != oldw->core.height)
394444c061aSmrg		&& result != XtGeometryDone
395444c061aSmrg		&& resize != (XtWidgetProc) NULL) {
396444c061aSmrg		CALLGEOTAT(_XtGeoTrace(w,
397444c061aSmrg				 "XtSetValues calls \"%s\"'s resize proc.\n",
398444c061aSmrg			       XtName(w)));
399444c061aSmrg		(*resize)(w);
400444c061aSmrg	      }
401444c061aSmrg	    }
402444c061aSmrg	    CALLGEOTAT(_XtGeoTab(-1));
403444c061aSmrg	}
404444c061aSmrg	/* Redisplay if needed.  No point in clearing if the window is
405444c061aSmrg	 * about to disappear, as the Expose event will just go straight
406444c061aSmrg	 * to the bit bucket. */
407444c061aSmrg        if (XtIsWidget(w)) {
408444c061aSmrg            /* widgets can distinguish between redisplay and resize, since
409444c061aSmrg             the server will cause an expose on resize */
410444c061aSmrg            if (redisplay && XtIsRealized(w) && !w->core.being_destroyed) {
411444c061aSmrg                CALLGEOTAT(_XtGeoTrace(w,
412444c061aSmrg				 "XtSetValues calls ClearArea on \"%s\".\n",
413444c061aSmrg			       XtName(w)));
414444c061aSmrg		XClearArea (XtDisplay(w), XtWindow(w), 0, 0, 0, 0, TRUE);
415444c061aSmrg	    }
416444c061aSmrg        } else { /*non-window object */
417444c061aSmrg	  if (redisplay && ! cleared_rect_obj ) {
418444c061aSmrg	      Widget pw = _XtWindowedAncestor(w);
419444c061aSmrg	      if (XtIsRealized(pw) && !pw->core.being_destroyed) {
420444c061aSmrg		  RectObj r = (RectObj)w;
421444c061aSmrg		  int bw2 = r->rectangle.border_width << 1;
422444c061aSmrg		  CALLGEOTAT(_XtGeoTrace(w,
423444c061aSmrg		   "XtSetValues calls ClearArea on \"%s\"'s parent \"%s\".\n",
424444c061aSmrg				 XtName(w),XtName(pw)));
425444c061aSmrg		  XClearArea (XtDisplay (pw), XtWindow (pw),
426444c061aSmrg			      r->rectangle.x, r->rectangle.y,
427444c061aSmrg			      r->rectangle.width + bw2,
428444c061aSmrg			      r->rectangle.height + bw2,TRUE);
429444c061aSmrg	      }
430444c061aSmrg	  }
431444c061aSmrg        }
432444c061aSmrg    }
433444c061aSmrg
434444c061aSmrg
435444c061aSmrg    /* Free dynamic storage */
436444c061aSmrg    if (constraintSize) {
437444c061aSmrg        XtStackFree(oldw->core.constraints, oldcCache);
438444c061aSmrg        XtStackFree(reqw->core.constraints, reqcCache);
439444c061aSmrg    }
440444c061aSmrg    XtStackFree((XtPointer)oldw, oldwCache);
441444c061aSmrg    XtStackFree((XtPointer)reqw, reqwCache);
442444c061aSmrg    UNLOCK_APP(app);
443444c061aSmrg} /* XtSetValues */
444