1444c061aSmrg/*********************************************************** 2fdf6a26fSmrgCopyright (c) 1993, Oracle and/or its affiliates. 31477040fSmrg 41477040fSmrgPermission is hereby granted, free of charge, to any person obtaining a 51477040fSmrgcopy of this software and associated documentation files (the "Software"), 61477040fSmrgto deal in the Software without restriction, including without limitation 71477040fSmrgthe rights to use, copy, modify, merge, publish, distribute, sublicense, 81477040fSmrgand/or sell copies of the Software, and to permit persons to whom the 91477040fSmrgSoftware is furnished to do so, subject to the following conditions: 101477040fSmrg 111477040fSmrgThe above copyright notice and this permission notice (including the next 121477040fSmrgparagraph) shall be included in all copies or substantial portions of the 131477040fSmrgSoftware. 141477040fSmrg 151477040fSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 161477040fSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 171477040fSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 181477040fSmrgTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 191477040fSmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 201477040fSmrgFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 211477040fSmrgDEALINGS IN THE SOFTWARE. 221477040fSmrg 231477040fSmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 24444c061aSmrg 25444c061aSmrg All Rights Reserved 26444c061aSmrg 27444c061aSmrgPermission to use, copy, modify, and distribute this software and its 28444c061aSmrgdocumentation for any purpose and without fee is hereby granted, 29444c061aSmrgprovided that the above copyright notice appear in all copies and that 30444c061aSmrgboth that copyright notice and this permission notice appear in 311477040fSmrgsupporting documentation, and that the name of Digital not be 32444c061aSmrgused in advertising or publicity pertaining to distribution of the 33444c061aSmrgsoftware without specific, written prior permission. 34444c061aSmrg 35444c061aSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 36444c061aSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 37444c061aSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 38444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 39444c061aSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 40444c061aSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 41444c061aSmrgSOFTWARE. 42444c061aSmrg 43444c061aSmrg******************************************************************/ 44444c061aSmrg 45444c061aSmrg/* 46444c061aSmrg 47444c061aSmrgCopyright 1987, 1988, 1994, 1998 The Open Group 48444c061aSmrg 49444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its 50444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that 51444c061aSmrgthe above copyright notice appear in all copies and that both that 52444c061aSmrgcopyright notice and this permission notice appear in supporting 53444c061aSmrgdocumentation. 54444c061aSmrg 55444c061aSmrgThe above copyright notice and this permission notice shall be included in 56444c061aSmrgall copies or substantial portions of the Software. 57444c061aSmrg 58444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 62444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 63444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 64444c061aSmrg 65444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be 66444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings 67444c061aSmrgin this Software without prior written authorization from The Open Group. 68444c061aSmrg 69444c061aSmrg*/ 70444c061aSmrg 71444c061aSmrg#ifdef HAVE_CONFIG_H 72444c061aSmrg#include <config.h> 73444c061aSmrg#endif 74444c061aSmrg#include "IntrinsicI.h" 75444c061aSmrg 76444c061aSmrg/* 77a3bd7f05Smrg * XtSetValues(), XtSetSubvalues() 78444c061aSmrg */ 79444c061aSmrg 80a3bd7f05Smrgstatic void 81a3bd7f05SmrgSetValues(char *base, /* Base address to write values to */ 82a3bd7f05Smrg XrmResourceList *res, /* The current resource values. */ 83a3bd7f05Smrg register Cardinal num_resources, /* number of items in resources */ 84a3bd7f05Smrg ArgList args, /* The resource values to set */ 85a3bd7f05Smrg Cardinal num_args) /* number of items in arg list */ 86444c061aSmrg{ 87a3bd7f05Smrg register ArgList arg; 88a3bd7f05Smrg register Cardinal i; 89a3bd7f05Smrg register XrmName argName; 90a3bd7f05Smrg register XrmResourceList *xrmres; 91444c061aSmrg 92444c061aSmrg /* Resource lists are assumed to be in compiled form already via the 93444c061aSmrg initial XtGetResources, XtGetSubresources calls */ 94444c061aSmrg 95a3bd7f05Smrg for (arg = args; num_args != 0; num_args--, arg++) { 96a3bd7f05Smrg argName = StringToName(arg->name); 97a3bd7f05Smrg for (xrmres = res, i = 0; i < num_resources; i++, xrmres++) { 98a3bd7f05Smrg if (argName == (*xrmres)->xrm_name) { 99a3bd7f05Smrg _XtCopyFromArg(arg->value, 100a3bd7f05Smrg base - (*xrmres)->xrm_offset - 1, 101a3bd7f05Smrg (*xrmres)->xrm_size); 102a3bd7f05Smrg break; 103a3bd7f05Smrg } 104a3bd7f05Smrg } 105444c061aSmrg } 106a3bd7f05Smrg} /* SetValues */ 107a3bd7f05Smrg 108a3bd7f05Smrgstatic Boolean 109a3bd7f05SmrgCallSetValues(WidgetClass class, 110a3bd7f05Smrg Widget current, 111a3bd7f05Smrg Widget request, 112a3bd7f05Smrg Widget new, 113a3bd7f05Smrg ArgList args, 114a3bd7f05Smrg Cardinal num_args) 115444c061aSmrg{ 116444c061aSmrg Boolean redisplay = FALSE; 117444c061aSmrg WidgetClass superclass; 118444c061aSmrg XtArgsFunc set_values_hook; 119444c061aSmrg XtSetValuesFunc set_values; 120444c061aSmrg 121444c061aSmrg LOCK_PROCESS; 122444c061aSmrg superclass = class->core_class.superclass; 123444c061aSmrg UNLOCK_PROCESS; 124444c061aSmrg if (superclass) 125444c061aSmrg redisplay = 126a3bd7f05Smrg CallSetValues(superclass, current, request, new, args, num_args); 127444c061aSmrg 128444c061aSmrg LOCK_PROCESS; 129444c061aSmrg set_values = class->core_class.set_values; 130444c061aSmrg UNLOCK_PROCESS; 131444c061aSmrg if (set_values) 132444c061aSmrg redisplay |= (*set_values) (current, request, new, args, &num_args); 133444c061aSmrg 134444c061aSmrg LOCK_PROCESS; 135444c061aSmrg set_values_hook = class->core_class.set_values_hook; 136444c061aSmrg UNLOCK_PROCESS; 137444c061aSmrg if (set_values_hook) 138a3bd7f05Smrg redisplay |= (*set_values_hook) (new, args, &num_args); 139444c061aSmrg return (redisplay); 140444c061aSmrg} 141444c061aSmrg 142444c061aSmrgstatic Boolean 143a3bd7f05SmrgCallConstraintSetValues(ConstraintWidgetClass class, 144a3bd7f05Smrg Widget current, 145a3bd7f05Smrg Widget request, 146a3bd7f05Smrg Widget new, 147a3bd7f05Smrg ArgList args, 148a3bd7f05Smrg Cardinal num_args) 149444c061aSmrg{ 150444c061aSmrg Boolean redisplay = FALSE; 151444c061aSmrg XtSetValuesFunc set_values; 152444c061aSmrg 153a3bd7f05Smrg if ((WidgetClass) class != constraintWidgetClass) { 154a3bd7f05Smrg if (class == NULL) { 155a3bd7f05Smrg XtAppErrorMsg(XtWidgetToApplicationContext(current), 156a3bd7f05Smrg "invalidClass", "constraintSetValue", 157a3bd7f05Smrg XtCXtToolkitError, 158a3bd7f05Smrg "Subclass of Constraint required in CallConstraintSetValues", 159a3bd7f05Smrg NULL, NULL); 160a3bd7f05Smrg } 161a3bd7f05Smrg else { 162fdf6a26fSmrg ConstraintWidgetClass superclass; 163fdf6a26fSmrg 164a3bd7f05Smrg LOCK_PROCESS; 165a3bd7f05Smrg superclass = (ConstraintWidgetClass) class->core_class.superclass; 166a3bd7f05Smrg UNLOCK_PROCESS; 167a3bd7f05Smrg redisplay = 168a3bd7f05Smrg CallConstraintSetValues(superclass, 169a3bd7f05Smrg current, request, new, args, num_args); 170a3bd7f05Smrg } 171444c061aSmrg } 172444c061aSmrg LOCK_PROCESS; 1730568f49bSmrg set_values = class ? class->constraint_class.set_values : NULL; 174444c061aSmrg UNLOCK_PROCESS; 175444c061aSmrg if (set_values) 176444c061aSmrg redisplay |= (*set_values) (current, request, new, args, &num_args); 177444c061aSmrg return (redisplay); 178444c061aSmrg} 179444c061aSmrg 180a3bd7f05Smrgvoid 181a3bd7f05SmrgXtSetSubvalues(XtPointer base, /* Base address to write values to */ 182a3bd7f05Smrg register XtResourceList resources, /* The current resource values. */ 183a3bd7f05Smrg register Cardinal num_resources, /* number of items in resources */ 184a3bd7f05Smrg ArgList args, /* The resource values to set */ 185a3bd7f05Smrg Cardinal num_args) /* number of items in arg list */ 186444c061aSmrg{ 187a3bd7f05Smrg register XrmResourceList *xrmres; 188444c061aSmrg 189a3bd7f05Smrg xrmres = _XtCreateIndirectionTable(resources, num_resources); 190a3bd7f05Smrg SetValues((char *) base, xrmres, num_resources, args, num_args); 191a3bd7f05Smrg XtFree((char *) xrmres); 192a3bd7f05Smrg} 193444c061aSmrg 194a3bd7f05Smrgvoid 195a3bd7f05SmrgXtSetValues(register Widget w, ArgList args, Cardinal num_args) 196444c061aSmrg{ 197444c061aSmrg register Widget oldw, reqw; 198a3bd7f05Smrg 199444c061aSmrg /* need to use strictest alignment rules possible in next two decls. */ 200a3bd7f05Smrg double oldwCache[100], reqwCache[100]; 201a3bd7f05Smrg double oldcCache[20], reqcCache[20]; 202a3bd7f05Smrg Cardinal widgetSize, constraintSize; 203a3bd7f05Smrg Boolean redisplay, cleared_rect_obj = False; 204444c061aSmrg XtWidgetGeometry geoReq, geoReply; 205a3bd7f05Smrg WidgetClass wc; 2062265a131Smrg ConstraintWidgetClass cwc = NULL; 207a3bd7f05Smrg Boolean hasConstraints; 208444c061aSmrg XtAppContext app = XtWidgetToApplicationContext(w); 209444c061aSmrg Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(w)); 210444c061aSmrg 211444c061aSmrg LOCK_APP(app); 212444c061aSmrg wc = XtClass(w); 213444c061aSmrg if ((args == NULL) && (num_args != 0)) { 214444c061aSmrg XtAppErrorMsg(app, 215a3bd7f05Smrg "invalidArgCount", "xtSetValues", XtCXtToolkitError, 216a3bd7f05Smrg "Argument count > 0 on NULL argument list in XtSetValues", 217a3bd7f05Smrg NULL, NULL); 218444c061aSmrg } 219444c061aSmrg 220444c061aSmrg /* Allocate and copy current widget into old widget */ 221444c061aSmrg 222444c061aSmrg LOCK_PROCESS; 223444c061aSmrg widgetSize = wc->core_class.widget_size; 224444c061aSmrg UNLOCK_PROCESS; 225444c061aSmrg oldw = (Widget) XtStackAlloc(widgetSize, oldwCache); 226a3bd7f05Smrg reqw = (Widget) XtStackAlloc(widgetSize, reqwCache); 227fdf6a26fSmrg (void) memcpy(oldw, w, (size_t) widgetSize); 228444c061aSmrg 229444c061aSmrg /* Set resource values */ 230444c061aSmrg 231444c061aSmrg LOCK_PROCESS; 232a3bd7f05Smrg SetValues((char *) w, (XrmResourceList *) wc->core_class.resources, 233a3bd7f05Smrg wc->core_class.num_resources, args, num_args); 234444c061aSmrg UNLOCK_PROCESS; 235444c061aSmrg 236fdf6a26fSmrg (void) memcpy(reqw, w, (size_t) widgetSize); 237444c061aSmrg 238a3bd7f05Smrg hasConstraints = (XtParent(w) != NULL && !XtIsShell(w) && 239a3bd7f05Smrg XtIsConstraint(XtParent(w))); 240444c061aSmrg 241444c061aSmrg /* Some widget sets apparently do ugly things by freeing the 242444c061aSmrg * constraints on some children, thus the extra test here */ 243444c061aSmrg if (hasConstraints) { 244a3bd7f05Smrg cwc = (ConstraintWidgetClass) XtClass(w->core.parent); 245a3bd7f05Smrg if (w->core.constraints) { 246a3bd7f05Smrg LOCK_PROCESS; 247a3bd7f05Smrg constraintSize = cwc->constraint_class.constraint_size; 248a3bd7f05Smrg UNLOCK_PROCESS; 249a3bd7f05Smrg } 250a3bd7f05Smrg else 251a3bd7f05Smrg constraintSize = 0; 252a3bd7f05Smrg } 253a3bd7f05Smrg else 254a3bd7f05Smrg constraintSize = 0; 255444c061aSmrg 256444c061aSmrg if (constraintSize) { 257a3bd7f05Smrg /* Allocate and copy current constraints into oldw */ 258a3bd7f05Smrg oldw->core.constraints = XtStackAlloc(constraintSize, oldcCache); 259a3bd7f05Smrg reqw->core.constraints = XtStackAlloc(constraintSize, reqcCache); 260fdf6a26fSmrg (void) memcpy(oldw->core.constraints, 261fdf6a26fSmrg w->core.constraints, (size_t) constraintSize); 262a3bd7f05Smrg 263a3bd7f05Smrg /* Set constraint values */ 264a3bd7f05Smrg LOCK_PROCESS; 265a3bd7f05Smrg SetValues((char *) w->core.constraints, 266a3bd7f05Smrg (XrmResourceList *) (cwc->constraint_class.resources), 267a3bd7f05Smrg cwc->constraint_class.num_resources, args, num_args); 268a3bd7f05Smrg UNLOCK_PROCESS; 269fdf6a26fSmrg (void) memcpy(reqw->core.constraints, 270fdf6a26fSmrg w->core.constraints, (size_t) constraintSize); 271444c061aSmrg } 272444c061aSmrg 273444c061aSmrg /* Inform widget of changes, then inform parent of changes */ 274a3bd7f05Smrg redisplay = CallSetValues(wc, oldw, reqw, w, args, num_args); 275444c061aSmrg if (hasConstraints) { 276a3bd7f05Smrg redisplay |= 277a3bd7f05Smrg CallConstraintSetValues(cwc, oldw, reqw, w, args, num_args); 278444c061aSmrg } 279444c061aSmrg 280444c061aSmrg if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) { 281a3bd7f05Smrg XtChangeHookDataRec call_data; 282a3bd7f05Smrg XtChangeHookSetValuesDataRec set_val; 283a3bd7f05Smrg 284a3bd7f05Smrg set_val.old = oldw; 285a3bd7f05Smrg set_val.req = reqw; 286a3bd7f05Smrg set_val.args = args; 287a3bd7f05Smrg set_val.num_args = num_args; 288a3bd7f05Smrg call_data.type = XtHsetValues; 289a3bd7f05Smrg call_data.widget = w; 290a3bd7f05Smrg call_data.event_data = (XtPointer) &set_val; 291a3bd7f05Smrg XtCallCallbackList(hookobj, 292a3bd7f05Smrg ((HookObject) hookobj)->hooks.changehook_callbacks, 293a3bd7f05Smrg (XtPointer) &call_data); 294444c061aSmrg } 295444c061aSmrg 296444c061aSmrg if (XtIsRectObj(w)) { 297a3bd7f05Smrg /* Now perform geometry request if needed */ 298a3bd7f05Smrg geoReq.request_mode = 0; 299a3bd7f05Smrg if (oldw->core.x != w->core.x) { 300a3bd7f05Smrg geoReq.x = w->core.x; 301a3bd7f05Smrg w->core.x = oldw->core.x; 302a3bd7f05Smrg geoReq.request_mode |= CWX; 303a3bd7f05Smrg } 304a3bd7f05Smrg if (oldw->core.y != w->core.y) { 305a3bd7f05Smrg geoReq.y = w->core.y; 306a3bd7f05Smrg w->core.y = oldw->core.y; 307a3bd7f05Smrg geoReq.request_mode |= CWY; 308a3bd7f05Smrg } 309a3bd7f05Smrg if (oldw->core.width != w->core.width) { 310a3bd7f05Smrg geoReq.width = w->core.width; 311a3bd7f05Smrg w->core.width = oldw->core.width; 312a3bd7f05Smrg geoReq.request_mode |= CWWidth; 313a3bd7f05Smrg } 314a3bd7f05Smrg if (oldw->core.height != w->core.height) { 315a3bd7f05Smrg geoReq.height = w->core.height; 316a3bd7f05Smrg w->core.height = oldw->core.height; 317a3bd7f05Smrg geoReq.request_mode |= CWHeight; 318a3bd7f05Smrg } 319a3bd7f05Smrg if (oldw->core.border_width != w->core.border_width) { 320a3bd7f05Smrg geoReq.border_width = w->core.border_width; 321a3bd7f05Smrg w->core.border_width = oldw->core.border_width; 322a3bd7f05Smrg geoReq.request_mode |= CWBorderWidth; 323a3bd7f05Smrg } 324a3bd7f05Smrg 325a3bd7f05Smrg if (geoReq.request_mode != 0) { 326fdf6a26fSmrg XtGeometryResult result; 327fdf6a26fSmrg 328a3bd7f05Smrg /* Pass on any requests for unchanged geometry values */ 329a3bd7f05Smrg if (geoReq.request_mode != 330a3bd7f05Smrg (CWX | CWY | CWWidth | CWHeight | CWBorderWidth)) { 331a3bd7f05Smrg for (; num_args != 0; num_args--, args++) { 332a3bd7f05Smrg if (!(geoReq.request_mode & CWX) && 333a3bd7f05Smrg strcmp(XtNx, args->name) == 0) { 334a3bd7f05Smrg geoReq.x = w->core.x; 335a3bd7f05Smrg geoReq.request_mode |= CWX; 336a3bd7f05Smrg } 337a3bd7f05Smrg else if (!(geoReq.request_mode & CWY) && 338a3bd7f05Smrg strcmp(XtNy, args->name) == 0) { 339a3bd7f05Smrg geoReq.y = w->core.y; 340a3bd7f05Smrg geoReq.request_mode |= CWY; 341a3bd7f05Smrg } 342a3bd7f05Smrg else if (!(geoReq.request_mode & CWWidth) && 343a3bd7f05Smrg strcmp(XtNwidth, args->name) == 0) { 344a3bd7f05Smrg geoReq.width = w->core.width; 345a3bd7f05Smrg geoReq.request_mode |= CWWidth; 346a3bd7f05Smrg } 347a3bd7f05Smrg else if (!(geoReq.request_mode & CWHeight) && 348a3bd7f05Smrg strcmp(XtNheight, args->name) == 0) { 349a3bd7f05Smrg geoReq.height = w->core.height; 350a3bd7f05Smrg geoReq.request_mode |= CWHeight; 351a3bd7f05Smrg } 352a3bd7f05Smrg else if (!(geoReq.request_mode & CWBorderWidth) && 353a3bd7f05Smrg strcmp(XtNborderWidth, args->name) == 0) { 354a3bd7f05Smrg geoReq.border_width = w->core.border_width; 355a3bd7f05Smrg geoReq.request_mode |= CWBorderWidth; 356a3bd7f05Smrg } 357a3bd7f05Smrg } 358a3bd7f05Smrg } 359a3bd7f05Smrg CALLGEOTAT(_XtGeoTrace(w, 360a3bd7f05Smrg "\nXtSetValues sees some geometry changes for \"%s\".\n", 361a3bd7f05Smrg XtName(w))); 362a3bd7f05Smrg CALLGEOTAT(_XtGeoTab(1)); 363a3bd7f05Smrg do { 364a3bd7f05Smrg XtGeometryHookDataRec call_data; 365a3bd7f05Smrg XtAlmostProc set_values_almost; 366a3bd7f05Smrg 367a3bd7f05Smrg if (XtHasCallbacks(hookobj, XtNgeometryHook) == 368a3bd7f05Smrg XtCallbackHasSome) { 369a3bd7f05Smrg call_data.type = XtHpreGeometry; 370a3bd7f05Smrg call_data.widget = w; 371a3bd7f05Smrg call_data.request = &geoReq; 372a3bd7f05Smrg XtCallCallbackList(hookobj, 373a3bd7f05Smrg ((HookObject) hookobj)->hooks. 374a3bd7f05Smrg geometryhook_callbacks, 375a3bd7f05Smrg (XtPointer) &call_data); 376a3bd7f05Smrg call_data.result = result = 377a3bd7f05Smrg _XtMakeGeometryRequest(w, &geoReq, &geoReply, 378a3bd7f05Smrg &cleared_rect_obj); 379a3bd7f05Smrg call_data.type = XtHpostGeometry; 380a3bd7f05Smrg call_data.reply = &geoReply; 381a3bd7f05Smrg XtCallCallbackList(hookobj, 382a3bd7f05Smrg ((HookObject) hookobj)->hooks. 383a3bd7f05Smrg geometryhook_callbacks, 384a3bd7f05Smrg (XtPointer) &call_data); 385a3bd7f05Smrg } 386a3bd7f05Smrg else { 387a3bd7f05Smrg result = _XtMakeGeometryRequest(w, &geoReq, &geoReply, 388a3bd7f05Smrg &cleared_rect_obj); 389a3bd7f05Smrg } 390a3bd7f05Smrg if (result == XtGeometryYes || result == XtGeometryDone) 391a3bd7f05Smrg break; 392a3bd7f05Smrg 393a3bd7f05Smrg /* An Almost or No reply. Call widget and let it munge 394a3bd7f05Smrg request, reply */ 395a3bd7f05Smrg LOCK_PROCESS; 396a3bd7f05Smrg set_values_almost = wc->core_class.set_values_almost; 397a3bd7f05Smrg UNLOCK_PROCESS; 398a3bd7f05Smrg if (set_values_almost == NULL) { 399a3bd7f05Smrg XtAppWarningMsg(app, 400a3bd7f05Smrg "invalidProcedure", "set_values_almost", 401a3bd7f05Smrg XtCXtToolkitError, 402a3bd7f05Smrg "set_values_almost procedure shouldn't be NULL", 403a3bd7f05Smrg NULL, NULL); 404a3bd7f05Smrg break; 405a3bd7f05Smrg } 406a3bd7f05Smrg if (result == XtGeometryNo) 407a3bd7f05Smrg geoReply.request_mode = 0; 408a3bd7f05Smrg CALLGEOTAT(_XtGeoTrace(w, "calling SetValuesAlmost.\n")); 409a3bd7f05Smrg (*set_values_almost) (oldw, w, &geoReq, &geoReply); 410a3bd7f05Smrg } while (geoReq.request_mode != 0); 411a3bd7f05Smrg /* call resize proc if we changed size and parent 412a3bd7f05Smrg * didn't already invoke resize */ 413a3bd7f05Smrg { 414a3bd7f05Smrg XtWidgetProc resize; 415a3bd7f05Smrg 416a3bd7f05Smrg LOCK_PROCESS; 417a3bd7f05Smrg resize = wc->core_class.resize; 418a3bd7f05Smrg UNLOCK_PROCESS; 419a3bd7f05Smrg if ((w->core.width != oldw->core.width || 420a3bd7f05Smrg w->core.height != oldw->core.height) 421a3bd7f05Smrg && result != XtGeometryDone 422a3bd7f05Smrg && resize != (XtWidgetProc) NULL) { 423a3bd7f05Smrg CALLGEOTAT(_XtGeoTrace(w, 424a3bd7f05Smrg "XtSetValues calls \"%s\"'s resize proc.\n", 425a3bd7f05Smrg XtName(w))); 426a3bd7f05Smrg (*resize) (w); 427a3bd7f05Smrg } 428a3bd7f05Smrg } 429a3bd7f05Smrg CALLGEOTAT(_XtGeoTab(-1)); 430a3bd7f05Smrg } 431a3bd7f05Smrg /* Redisplay if needed. No point in clearing if the window is 432a3bd7f05Smrg * about to disappear, as the Expose event will just go straight 433a3bd7f05Smrg * to the bit bucket. */ 434444c061aSmrg if (XtIsWidget(w)) { 435444c061aSmrg /* widgets can distinguish between redisplay and resize, since 436a3bd7f05Smrg the server will cause an expose on resize */ 437444c061aSmrg if (redisplay && XtIsRealized(w) && !w->core.being_destroyed) { 438444c061aSmrg CALLGEOTAT(_XtGeoTrace(w, 439a3bd7f05Smrg "XtSetValues calls ClearArea on \"%s\".\n", 440a3bd7f05Smrg XtName(w))); 441a3bd7f05Smrg XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, TRUE); 442a3bd7f05Smrg } 443a3bd7f05Smrg } 444a3bd7f05Smrg else { /*non-window object */ 445a3bd7f05Smrg if (redisplay && !cleared_rect_obj) { 446a3bd7f05Smrg Widget pw = _XtWindowedAncestor(w); 447a3bd7f05Smrg 448a3bd7f05Smrg if (XtIsRealized(pw) && !pw->core.being_destroyed) { 449a3bd7f05Smrg RectObj r = (RectObj) w; 450a3bd7f05Smrg int bw2 = r->rectangle.border_width << 1; 451a3bd7f05Smrg 452a3bd7f05Smrg CALLGEOTAT(_XtGeoTrace(w, 453a3bd7f05Smrg "XtSetValues calls ClearArea on \"%s\"'s parent \"%s\".\n", 454a3bd7f05Smrg XtName(w), XtName(pw))); 455a3bd7f05Smrg XClearArea(XtDisplay(pw), XtWindow(pw), 456a3bd7f05Smrg r->rectangle.x, r->rectangle.y, 457a3bd7f05Smrg (unsigned) (r->rectangle.width + bw2), 458a3bd7f05Smrg (unsigned) (r->rectangle.height + bw2), TRUE); 459a3bd7f05Smrg } 460a3bd7f05Smrg } 461444c061aSmrg } 462444c061aSmrg } 463444c061aSmrg 464444c061aSmrg /* Free dynamic storage */ 465444c061aSmrg if (constraintSize) { 466444c061aSmrg XtStackFree(oldw->core.constraints, oldcCache); 467444c061aSmrg XtStackFree(reqw->core.constraints, reqcCache); 468444c061aSmrg } 469a3bd7f05Smrg XtStackFree((XtPointer) oldw, oldwCache); 470a3bd7f05Smrg XtStackFree((XtPointer) reqw, reqwCache); 471444c061aSmrg UNLOCK_APP(app); 472a3bd7f05Smrg} /* XtSetValues */ 473