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