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, 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 "IntrinsicP.h"
75444c061aSmrg#include "EventI.h"
76444c061aSmrg#include "ConvertI.h"
77444c061aSmrg#include "TranslateI.h"
78444c061aSmrg#include "ResourceI.h"
79444c061aSmrg#include "RectObj.h"
80444c061aSmrg#include "RectObjP.h"
81444c061aSmrg#include "ThreadsI.h"
82444c061aSmrg#include "StringDefs.h"
83444c061aSmrg
84444c061aSmrg/******************************************************************
85444c061aSmrg *
86444c061aSmrg * CoreWidget Resources
87444c061aSmrg *
88444c061aSmrg ******************************************************************/
89444c061aSmrg
90a3bd7f05Smrgexternaldef(xtinherittranslations)
91a3bd7f05Smrgint _XtInheritTranslations = 0;
92a3bd7f05Smrgextern String XtCXtToolkitError;        /* from IntrinsicI.h */
93a3bd7f05Smrgstatic void
94a3bd7f05SmrgXtCopyScreen(Widget, int, XrmValue *);
95444c061aSmrg
96444c061aSmrgstatic XtResource resources[] = {
97a3bd7f05Smrg    {XtNscreen, XtCScreen, XtRScreen, sizeof(Screen *),
98a3bd7f05Smrg     XtOffsetOf(CoreRec, core.screen), XtRCallProc, (XtPointer) XtCopyScreen},
99444c061aSmrg/*_XtCopyFromParent does not work for screen because the Display
100444c061aSmrgparameter is not passed through to the XtRCallProc routines */
101a3bd7f05Smrg    {XtNdepth, XtCDepth, XtRInt, sizeof(int),
102a3bd7f05Smrg     XtOffsetOf(CoreRec, core.depth),
103a3bd7f05Smrg     XtRCallProc, (XtPointer) _XtCopyFromParent},
104444c061aSmrg    {XtNcolormap, XtCColormap, XtRColormap, sizeof(Colormap),
105a3bd7f05Smrg     XtOffsetOf(CoreRec, core.colormap),
106a3bd7f05Smrg     XtRCallProc, (XtPointer) _XtCopyFromParent},
107a3bd7f05Smrg    {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
108a3bd7f05Smrg     XtOffsetOf(CoreRec, core.background_pixel),
109a3bd7f05Smrg     XtRString, (XtPointer) "XtDefaultBackground"},
110444c061aSmrg    {XtNbackgroundPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
111a3bd7f05Smrg     XtOffsetOf(CoreRec, core.background_pixmap),
112a3bd7f05Smrg     XtRImmediate, (XtPointer) XtUnspecifiedPixmap},
113a3bd7f05Smrg    {XtNborderColor, XtCBorderColor, XtRPixel, sizeof(Pixel),
114a3bd7f05Smrg     XtOffsetOf(CoreRec, core.border_pixel),
115a3bd7f05Smrg     XtRString, (XtPointer) "XtDefaultForeground"},
116444c061aSmrg    {XtNborderPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
117a3bd7f05Smrg     XtOffsetOf(CoreRec, core.border_pixmap),
118a3bd7f05Smrg     XtRImmediate, (XtPointer) XtUnspecifiedPixmap},
119444c061aSmrg    {XtNmappedWhenManaged, XtCMappedWhenManaged, XtRBoolean, sizeof(Boolean),
120a3bd7f05Smrg     XtOffsetOf(CoreRec, core.mapped_when_managed),
121a3bd7f05Smrg     XtRImmediate, (XtPointer) True},
122444c061aSmrg    {XtNtranslations, XtCTranslations, XtRTranslationTable,
123a3bd7f05Smrg     sizeof(XtTranslations), XtOffsetOf(CoreRec, core.tm.translations),
124a3bd7f05Smrg     XtRTranslationTable, (XtPointer) NULL},
125444c061aSmrg    {XtNaccelerators, XtCAccelerators, XtRAcceleratorTable,
126a3bd7f05Smrg     sizeof(XtTranslations), XtOffsetOf(CoreRec, core.accelerators),
127a3bd7f05Smrg     XtRTranslationTable, (XtPointer) NULL}
128a3bd7f05Smrg};
129444c061aSmrg
130444c061aSmrgstatic void CoreInitialize(Widget, Widget, ArgList, Cardinal *);
131444c061aSmrgstatic void CoreClassPartInitialize(WidgetClass);
132444c061aSmrgstatic void CoreDestroy(Widget);
133444c061aSmrgstatic void CoreRealize(Widget, XtValueMask *, XSetWindowAttributes *);
134444c061aSmrgstatic Boolean CoreSetValues(Widget, Widget, Widget, ArgList, Cardinal *);
135a3bd7f05Smrgstatic void CoreSetValuesAlmost(Widget, Widget, XtWidgetGeometry *,
136a3bd7f05Smrg                                XtWidgetGeometry *);
137444c061aSmrg
138444c061aSmrgstatic RectObjClassRec unNamedObjClassRec = {
139a3bd7f05Smrg    {
140a3bd7f05Smrg     /* superclass         */ (WidgetClass) &rectObjClassRec,
141a3bd7f05Smrg     /* class_name         */ "UnNamedObj",
142a3bd7f05Smrg     /* widget_size        */ 0,
143a3bd7f05Smrg     /* class_initialize   */ NULL,
144a3bd7f05Smrg     /* class_part_initialize */ NULL,
145a3bd7f05Smrg     /* class_inited       */ FALSE,
146a3bd7f05Smrg     /* initialize         */ NULL,
147a3bd7f05Smrg     /* initialize_hook    */ NULL,
148a3bd7f05Smrg     /* realize            */ (XtProc) XtInheritRealize,
149a3bd7f05Smrg     /* actions            */ NULL,
150a3bd7f05Smrg     /* num_actions        */ 0,
151a3bd7f05Smrg     /* resources          */ NULL,
152a3bd7f05Smrg     /* num_resources      */ 0,
153a3bd7f05Smrg     /* xrm_class          */ NULLQUARK,
154a3bd7f05Smrg     /* compress_motion    */ FALSE,
155a3bd7f05Smrg     /* compress_exposure  */ FALSE,
156a3bd7f05Smrg     /* compress_enterleave */ FALSE,
157a3bd7f05Smrg     /* visible_interest   */ FALSE,
158a3bd7f05Smrg     /* destroy            */ NULL,
159a3bd7f05Smrg     /* resize             */ NULL,
160a3bd7f05Smrg     /* expose             */ NULL,
161a3bd7f05Smrg     /* set_values         */ NULL,
162a3bd7f05Smrg     /* set_values_hook    */ NULL,
163a3bd7f05Smrg     /* set_values_almost  */ XtInheritSetValuesAlmost,
164a3bd7f05Smrg     /* get_values_hook    */ NULL,
165a3bd7f05Smrg     /* accept_focus       */ NULL,
166a3bd7f05Smrg     /* version            */ XtVersion,
167a3bd7f05Smrg     /* callback_offsets   */ NULL,
168a3bd7f05Smrg     /* tm_table           */ NULL,
169a3bd7f05Smrg     /* query_geometry       */ NULL,
170a3bd7f05Smrg     /* display_accelerator  */ NULL,
171a3bd7f05Smrg     /* extension            */ NULL
172a3bd7f05Smrg     }
173444c061aSmrg};
174444c061aSmrg
175a3bd7f05Smrgexternaldef(widgetclassrec)
176a3bd7f05SmrgWidgetClassRec widgetClassRec = {
177a3bd7f05Smrg    {
178a3bd7f05Smrg     /* superclass         */ (WidgetClass) &unNamedObjClassRec,
179a3bd7f05Smrg     /* class_name         */ "Core",
180a3bd7f05Smrg     /* widget_size        */ sizeof(WidgetRec),
181a3bd7f05Smrg     /* class_initialize   */ NULL,
182a3bd7f05Smrg     /* class_part_initialize */ CoreClassPartInitialize,
183a3bd7f05Smrg     /* class_inited       */ FALSE,
184a3bd7f05Smrg     /* initialize         */ CoreInitialize,
185a3bd7f05Smrg     /* initialize_hook    */ NULL,
186a3bd7f05Smrg     /* realize            */ CoreRealize,
187a3bd7f05Smrg     /* actions            */ NULL,
188a3bd7f05Smrg     /* num_actions        */ 0,
189a3bd7f05Smrg     /* resources          */ resources,
190a3bd7f05Smrg     /* num_resources      */ XtNumber(resources),
191a3bd7f05Smrg     /* xrm_class          */ NULLQUARK,
192a3bd7f05Smrg     /* compress_motion    */ FALSE,
193a3bd7f05Smrg     /* compress_exposure  */ TRUE,
194a3bd7f05Smrg     /* compress_enterleave */ FALSE,
195a3bd7f05Smrg     /* visible_interest   */ FALSE,
196a3bd7f05Smrg     /* destroy            */ CoreDestroy,
197a3bd7f05Smrg     /* resize             */ NULL,
198a3bd7f05Smrg     /* expose             */ NULL,
199a3bd7f05Smrg     /* set_values         */ CoreSetValues,
200a3bd7f05Smrg     /* set_values_hook    */ NULL,
201a3bd7f05Smrg     /* set_values_almost  */ CoreSetValuesAlmost,
202a3bd7f05Smrg     /* get_values_hook    */ NULL,
203a3bd7f05Smrg     /* accept_focus       */ NULL,
204a3bd7f05Smrg     /* version            */ XtVersion,
205a3bd7f05Smrg     /* callback_offsets   */ NULL,
206a3bd7f05Smrg     /* tm_table           */ NULL,
207a3bd7f05Smrg     /* query_geometry       */ NULL,
208a3bd7f05Smrg     /* display_accelerator  */ NULL,
209a3bd7f05Smrg     /* extension            */ NULL
210a3bd7f05Smrg     }
211444c061aSmrg};
212444c061aSmrg
213a3bd7f05Smrgexternaldef(WidgetClass)
214a3bd7f05SmrgWidgetClass widgetClass = &widgetClassRec;
215444c061aSmrg
216a3bd7f05Smrgexternaldef(WidgetClass)
217a3bd7f05SmrgWidgetClass coreWidgetClass = &widgetClassRec;
218444c061aSmrg
219a3bd7f05Smrgstatic void
220a3bd7f05SmrgXtCopyScreen(Widget widget, int offset _X_UNUSED, XrmValue *value)
221444c061aSmrg{
222a3bd7f05Smrg    value->addr = (XPointer) (&widget->core.screen);
223444c061aSmrg}
224444c061aSmrg
225444c061aSmrg/*
226444c061aSmrg * Start of Core methods
227444c061aSmrg */
228444c061aSmrg
229a3bd7f05Smrgstatic void
230a3bd7f05SmrgCoreClassPartInitialize(register WidgetClass wc)
231444c061aSmrg{
232444c061aSmrg    /* We don't need to check for null super since we'll get to object
233444c061aSmrg       eventually, and it had better define them!  */
234444c061aSmrg
235444c061aSmrg    register WidgetClass super = wc->core_class.superclass;
236444c061aSmrg
237444c061aSmrg    LOCK_PROCESS;
238444c061aSmrg    if (wc->core_class.realize == XtInheritRealize) {
239a3bd7f05Smrg        wc->core_class.realize = super->core_class.realize;
240444c061aSmrg    }
241444c061aSmrg
242444c061aSmrg    if (wc->core_class.accept_focus == XtInheritAcceptFocus) {
243a3bd7f05Smrg        wc->core_class.accept_focus = super->core_class.accept_focus;
244444c061aSmrg    }
245444c061aSmrg
246444c061aSmrg    if (wc->core_class.display_accelerator == XtInheritDisplayAccelerator) {
247a3bd7f05Smrg        wc->core_class.display_accelerator =
248a3bd7f05Smrg            super->core_class.display_accelerator;
249444c061aSmrg    }
250444c061aSmrg
251a3bd7f05Smrg    if (wc->core_class.tm_table == XtInheritTranslations) {
252a3bd7f05Smrg        wc->core_class.tm_table =
253a3bd7f05Smrg            wc->core_class.superclass->core_class.tm_table;
254a3bd7f05Smrg    }
255a3bd7f05Smrg    else if (wc->core_class.tm_table != NULL) {
256a3bd7f05Smrg        wc->core_class.tm_table =
257a3bd7f05Smrg            (String) XtParseTranslationTable(wc->core_class.tm_table);
258444c061aSmrg    }
259444c061aSmrg
260444c061aSmrg    if (wc->core_class.actions != NULL) {
261a3bd7f05Smrg        Boolean inPlace;
262a3bd7f05Smrg
263a3bd7f05Smrg        if (wc->core_class.version == XtVersionDontCheck)
264a3bd7f05Smrg            inPlace = True;
265a3bd7f05Smrg        else
266a3bd7f05Smrg            inPlace = (wc->core_class.version < XtVersion) ? False : True;
267a3bd7f05Smrg
268a3bd7f05Smrg        /* Compile the action table into a more efficient form */
269a3bd7f05Smrg        wc->core_class.actions =
270a3bd7f05Smrg            (XtActionList) _XtInitializeActionData(wc->core_class.actions,
271a3bd7f05Smrg                                                   wc->core_class.num_actions,
272a3bd7f05Smrg                                                   inPlace);
273444c061aSmrg    }
274444c061aSmrg    UNLOCK_PROCESS;
275444c061aSmrg}
276a3bd7f05Smrg
277a3bd7f05Smrgstatic void
278a3bd7f05SmrgCoreInitialize(Widget requested_widget _X_UNUSED,
279a3bd7f05Smrg               register Widget new_widget,
280a3bd7f05Smrg               ArgList args _X_UNUSED,
281a3bd7f05Smrg               Cardinal *num_args _X_UNUSED)
282444c061aSmrg{
283444c061aSmrg    XtTranslations save1, save2;
284a3bd7f05Smrg
285444c061aSmrg    new_widget->core.event_table = NULL;
286444c061aSmrg    new_widget->core.tm.proc_table = NULL;
287444c061aSmrg    new_widget->core.tm.lastEventTime = 0;
288444c061aSmrg    /* magic semi-resource fetched by GetResources */
289a3bd7f05Smrg    save1 = (XtTranslations) new_widget->core.tm.current_state;
290444c061aSmrg    new_widget->core.tm.current_state = NULL;
291444c061aSmrg    save2 = new_widget->core.tm.translations;
292444c061aSmrg    LOCK_PROCESS;
293444c061aSmrg    new_widget->core.tm.translations =
294a3bd7f05Smrg        (XtTranslations) new_widget->core.widget_class->core_class.tm_table;
295444c061aSmrg    UNLOCK_PROCESS;
296444c061aSmrg    if (save1)
297a3bd7f05Smrg        _XtMergeTranslations(new_widget, save1, save1->operation);
298444c061aSmrg    if (save2)
299a3bd7f05Smrg        _XtMergeTranslations(new_widget, save2, save2->operation);
300444c061aSmrg}
301444c061aSmrg
302a3bd7f05Smrgstatic void
303a3bd7f05SmrgCoreRealize(Widget widget,
304a3bd7f05Smrg            XtValueMask *value_mask,
305a3bd7f05Smrg            XSetWindowAttributes *attributes)
306444c061aSmrg{
307444c061aSmrg    XtCreateWindow(widget, (unsigned int) InputOutput,
308a3bd7f05Smrg                   (Visual *) CopyFromParent, *value_mask, attributes);
309a3bd7f05Smrg}                               /* CoreRealize */
310444c061aSmrg
311a3bd7f05Smrgstatic void
312a3bd7f05SmrgCoreDestroy(Widget widget)
313444c061aSmrg{
314444c061aSmrg    _XtFreeEventTable(&widget->core.event_table);
315444c061aSmrg    _XtDestroyTMData(widget);
316444c061aSmrg    XtUnregisterDrawable(XtDisplay(widget), widget->core.window);
317444c061aSmrg
318444c061aSmrg    if (widget->core.popup_list != NULL)
319a3bd7f05Smrg        XtFree((char *) widget->core.popup_list);
320444c061aSmrg
321a3bd7f05Smrg}                               /* CoreDestroy */
322444c061aSmrg
323a3bd7f05Smrgstatic Boolean
324a3bd7f05SmrgCoreSetValues(Widget old,
325a3bd7f05Smrg              Widget reference _X_UNUSED,
326a3bd7f05Smrg              Widget new,
327a3bd7f05Smrg              ArgList args _X_UNUSED,
328a3bd7f05Smrg              Cardinal *num_args _X_UNUSED)
329444c061aSmrg{
330444c061aSmrg    Boolean redisplay;
331a3bd7f05Smrg    Mask window_mask;
332444c061aSmrg    XSetWindowAttributes attributes;
333444c061aSmrg
334444c061aSmrg    redisplay = FALSE;
335a3bd7f05Smrg    if (old->core.tm.translations != new->core.tm.translations) {
336a3bd7f05Smrg        XtTranslations save = new->core.tm.translations;
337a3bd7f05Smrg
338a3bd7f05Smrg        new->core.tm.translations = old->core.tm.translations;
339a3bd7f05Smrg        _XtMergeTranslations(new, save, XtTableReplace);
340444c061aSmrg    }
341444c061aSmrg
342444c061aSmrg    /* Check everything that depends upon window being realized */
343444c061aSmrg    if (XtIsRealized(old)) {
344a3bd7f05Smrg        window_mask = 0;
345a3bd7f05Smrg        /* Check window attributes */
346a3bd7f05Smrg        if (old->core.background_pixel != new->core.background_pixel
347a3bd7f05Smrg            && new->core.background_pixmap == XtUnspecifiedPixmap) {
348a3bd7f05Smrg            attributes.background_pixel = new->core.background_pixel;
349a3bd7f05Smrg            window_mask |= CWBackPixel;
350a3bd7f05Smrg            redisplay = TRUE;
351a3bd7f05Smrg        }
352a3bd7f05Smrg        if (old->core.background_pixmap != new->core.background_pixmap) {
353a3bd7f05Smrg            if (new->core.background_pixmap == XtUnspecifiedPixmap) {
354a3bd7f05Smrg                window_mask |= CWBackPixel;
355a3bd7f05Smrg                attributes.background_pixel = new->core.background_pixel;
356a3bd7f05Smrg            }
357a3bd7f05Smrg            else {
358a3bd7f05Smrg                attributes.background_pixmap = new->core.background_pixmap;
359a3bd7f05Smrg                window_mask &= (unsigned long) (~CWBackPixel);
360a3bd7f05Smrg                window_mask |= CWBackPixmap;
361a3bd7f05Smrg            }
362a3bd7f05Smrg            redisplay = TRUE;
363a3bd7f05Smrg        }
364a3bd7f05Smrg        if (old->core.border_pixel != new->core.border_pixel
365a3bd7f05Smrg            && new->core.border_pixmap == XtUnspecifiedPixmap) {
366a3bd7f05Smrg            attributes.border_pixel = new->core.border_pixel;
367a3bd7f05Smrg            window_mask |= CWBorderPixel;
368a3bd7f05Smrg        }
369a3bd7f05Smrg        if (old->core.border_pixmap != new->core.border_pixmap) {
370a3bd7f05Smrg            if (new->core.border_pixmap == XtUnspecifiedPixmap) {
371a3bd7f05Smrg                window_mask |= CWBorderPixel;
372a3bd7f05Smrg                attributes.border_pixel = new->core.border_pixel;
373a3bd7f05Smrg            }
374a3bd7f05Smrg            else {
375a3bd7f05Smrg                attributes.border_pixmap = new->core.border_pixmap;
376a3bd7f05Smrg                window_mask &= (unsigned long) (~CWBorderPixel);
377a3bd7f05Smrg                window_mask |= CWBorderPixmap;
378a3bd7f05Smrg            }
379a3bd7f05Smrg        }
380a3bd7f05Smrg        if (old->core.depth != new->core.depth) {
381a3bd7f05Smrg            XtAppWarningMsg(XtWidgetToApplicationContext(old),
382a3bd7f05Smrg                            "invalidDepth", "setValues", XtCXtToolkitError,
383a3bd7f05Smrg                            "Can't change widget depth", NULL, NULL);
384a3bd7f05Smrg            new->core.depth = old->core.depth;
385a3bd7f05Smrg        }
386a3bd7f05Smrg        if (old->core.colormap != new->core.colormap) {
387a3bd7f05Smrg            window_mask |= CWColormap;
388a3bd7f05Smrg            attributes.colormap = new->core.colormap;
389a3bd7f05Smrg        }
390a3bd7f05Smrg        if (window_mask != 0) {
391a3bd7f05Smrg            /* Actually change X window attributes */
392a3bd7f05Smrg            XChangeWindowAttributes(XtDisplay(new), XtWindow(new), window_mask,
393a3bd7f05Smrg                                    &attributes);
394a3bd7f05Smrg        }
395a3bd7f05Smrg
396a3bd7f05Smrg        if (old->core.mapped_when_managed != new->core.mapped_when_managed) {
397a3bd7f05Smrg            Boolean mapped_when_managed = new->core.mapped_when_managed;
398a3bd7f05Smrg
399a3bd7f05Smrg            new->core.mapped_when_managed = !mapped_when_managed;
400a3bd7f05Smrg            XtSetMappedWhenManaged(new, mapped_when_managed);
401a3bd7f05Smrg        }
402a3bd7f05Smrg    }                           /* if realized */
403444c061aSmrg
404444c061aSmrg    return redisplay;
405a3bd7f05Smrg}                               /* CoreSetValues */
406a3bd7f05Smrg
407a3bd7f05Smrgstatic void
408a3bd7f05SmrgCoreSetValuesAlmost(Widget old _X_UNUSED,
409a3bd7f05Smrg                    Widget new _X_UNUSED,
410a3bd7f05Smrg                    XtWidgetGeometry *request,
411a3bd7f05Smrg                    XtWidgetGeometry *reply)
412444c061aSmrg{
413444c061aSmrg    *request = *reply;
414444c061aSmrg}
415