17a84e134Smrg/***********************************************************
27a84e134Smrg
37a84e134SmrgCopyright 1987, 1988, 1994, 1998  The Open Group
47a84e134Smrg
57a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
67a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
77a84e134Smrgthe above copyright notice appear in all copies and that both that
87a84e134Smrgcopyright notice and this permission notice appear in supporting
97a84e134Smrgdocumentation.
107a84e134Smrg
117a84e134SmrgThe above copyright notice and this permission notice shall be included in
127a84e134Smrgall copies or substantial portions of the Software.
137a84e134Smrg
147a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
157a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
177a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
187a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
197a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
207a84e134Smrg
217a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
227a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
237a84e134Smrgin this Software without prior written authorization from The Open Group.
247a84e134Smrg
257a84e134Smrg
267a84e134SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
277a84e134Smrg
287a84e134Smrg                        All Rights Reserved
297a84e134Smrg
30421c997bSmrgPermission to use, copy, modify, and distribute this software and its
31421c997bSmrgdocumentation for any purpose and without fee is hereby granted,
327a84e134Smrgprovided that the above copyright notice appear in all copies and that
33421c997bSmrgboth that copyright notice and this permission notice appear in
347a84e134Smrgsupporting documentation, and that the name of Digital not be
357a84e134Smrgused in advertising or publicity pertaining to distribution of the
36421c997bSmrgsoftware without specific, written prior permission.
377a84e134Smrg
387a84e134SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
397a84e134SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
407a84e134SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
417a84e134SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
427a84e134SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
437a84e134SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
447a84e134SmrgSOFTWARE.
457a84e134Smrg
467a84e134Smrg******************************************************************/
477a84e134Smrg
487a84e134Smrg#ifdef HAVE_CONFIG_H
497a84e134Smrg#include <config.h>
507a84e134Smrg#endif
517a84e134Smrg#include <stdio.h>
527a84e134Smrg#include <X11/IntrinsicP.h>
537a84e134Smrg#include <X11/StringDefs.h>
547a84e134Smrg#include <X11/Xmu/Drawing.h>
557a84e134Smrg#include <X11/Xaw/SimpleP.h>
567a84e134Smrg#include <X11/Xaw/XawInit.h>
577a84e134Smrg#include "Private.h"
587a84e134Smrg#ifndef OLDXAW
597a84e134Smrg#include <X11/Xaw/Tip.h>
607a84e134Smrg#endif
617a84e134Smrg
627a84e134Smrg/*
637a84e134Smrg * Class Methods
647a84e134Smrg */
657a84e134Smrgstatic Bool ChangeSensitive(Widget);
667a84e134Smrgstatic void XawSimpleClassInitialize(void);
677a84e134Smrgstatic void XawSimpleClassPartInitialize(WidgetClass);
687a84e134Smrg#ifndef OLDXAW
697a84e134Smrgstatic void XawSimpleInitialize(Widget, Widget, ArgList, Cardinal*);
707a84e134Smrgstatic void XawSimpleDestroy(Widget);
717a84e134Smrgstatic void XawSimpleExpose(Widget, XEvent*, Region);
727a84e134Smrg#endif
737a84e134Smrgstatic void XawSimpleRealize(Widget, Mask*, XSetWindowAttributes*);
747a84e134Smrgstatic Boolean XawSimpleSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
757a84e134Smrg
767a84e134Smrg/*
777a84e134Smrg * Prototypes
787a84e134Smrg */
797a84e134Smrgstatic void ConvertCursor(Widget);
807a84e134Smrg
817a84e134Smrg/*
827a84e134Smrg * Initialization
837a84e134Smrg */
847a84e134Smrg#ifndef OLDXAW
857a84e134Smrgstatic XtActionsRec actions[] = {
867a84e134Smrg  {"set-values", XawSetValuesAction},
877a84e134Smrg  {"get-values", XawGetValuesAction},
887a84e134Smrg  {"declare",    XawDeclareAction},
897a84e134Smrg  {"call-proc",  XawCallProcAction},
907a84e134Smrg};
917a84e134Smrg#endif
927a84e134Smrg
937a84e134Smrg#define offset(field) XtOffsetOf(SimpleRec, simple.field)
947a84e134Smrgstatic XtResource resources[] = {
957a84e134Smrg  {
967a84e134Smrg    XtNcursor,
977a84e134Smrg    XtCCursor,
987a84e134Smrg    XtRCursor,
997a84e134Smrg    sizeof(Cursor),
1007a84e134Smrg    offset(cursor),
1017a84e134Smrg    XtRImmediate,
1027a84e134Smrg    (XtPointer)None
1037a84e134Smrg  },
1047a84e134Smrg  {
1057a84e134Smrg    XtNinsensitiveBorder,
1067a84e134Smrg    XtCInsensitive,
1077a84e134Smrg    XtRPixmap,
1087a84e134Smrg    sizeof(Pixmap),
1097a84e134Smrg    offset(insensitive_border),
1107a84e134Smrg    XtRImmediate,
1117a84e134Smrg    NULL
1127a84e134Smrg  },
1137a84e134Smrg  {
1147a84e134Smrg    XtNpointerColor,
1157a84e134Smrg    XtCForeground,
1167a84e134Smrg    XtRPixel,
1177a84e134Smrg    sizeof(Pixel),
1187a84e134Smrg    offset(pointer_fg),
1197a84e134Smrg    XtRString,
1205ec34c4cSmrg    (XtPointer)XtDefaultForeground
1217a84e134Smrg  },
1227a84e134Smrg  {
1237a84e134Smrg    XtNpointerColorBackground,
1247a84e134Smrg    XtCBackground,
1257a84e134Smrg    XtRPixel,
1267a84e134Smrg    sizeof(Pixel),
1277a84e134Smrg    offset(pointer_bg),
1287a84e134Smrg    XtRString,
1295ec34c4cSmrg    (XtPointer)XtDefaultBackground
1307a84e134Smrg  },
1317a84e134Smrg  {
1327a84e134Smrg    XtNcursorName,
1337a84e134Smrg    XtCCursor,
1347a84e134Smrg    XtRString,
1357a84e134Smrg    sizeof(String),
1367a84e134Smrg    offset(cursor_name),
1377a84e134Smrg    XtRString,
1387a84e134Smrg    NULL
1397a84e134Smrg  },
1407a84e134Smrg  {
1417a84e134Smrg    XtNinternational,
1427a84e134Smrg    XtCInternational,
1437a84e134Smrg    XtRBoolean,
1447a84e134Smrg    sizeof(Boolean),
1457a84e134Smrg    offset(international),
1467a84e134Smrg    XtRImmediate,
1477a84e134Smrg    (XtPointer)False
1487a84e134Smrg  },
1497a84e134Smrg#ifndef OLDXAW
1507a84e134Smrg  {
1517a84e134Smrg    XawNdisplayList,
1527a84e134Smrg    XawCDisplayList,
1537a84e134Smrg    XawRDisplayList,
1547a84e134Smrg    sizeof(XawDisplayList*),
1557a84e134Smrg    offset(display_list),
1567a84e134Smrg    XtRImmediate,
1577a84e134Smrg    NULL
1587a84e134Smrg  },
1597a84e134Smrg  {
1607a84e134Smrg    XtNtip,
1617a84e134Smrg    XtCTip,
1627a84e134Smrg    XtRString,
1637a84e134Smrg    sizeof(String),
1647a84e134Smrg    offset(tip),
1657a84e134Smrg    XtRImmediate,
1667a84e134Smrg    NULL
1677a84e134Smrg  },
1687a84e134Smrg#endif
1697a84e134Smrg#undef offset
1707a84e134Smrg};
1717a84e134Smrg
1727a84e134SmrgSimpleClassRec simpleClassRec = {
1737a84e134Smrg  /* core */
1747a84e134Smrg  {
1757a84e134Smrg    (WidgetClass)&widgetClassRec,	/* superclass */
1767a84e134Smrg    "Simple",				/* class_name */
1777a84e134Smrg    sizeof(SimpleRec),			/* widget_size */
1787a84e134Smrg    XawSimpleClassInitialize,		/* class_initialize */
1797a84e134Smrg    XawSimpleClassPartInitialize,	/* class_part_initialize */
1807a84e134Smrg    False,				/* class_inited */
1817a84e134Smrg#ifndef OLDXAW
1827a84e134Smrg    XawSimpleInitialize,		/* initialize */
1837a84e134Smrg#else
1847a84e134Smrg    NULL,				/* initialize */
1857a84e134Smrg#endif
1867a84e134Smrg    NULL,				/* initialize_hook */
1877a84e134Smrg    XawSimpleRealize,			/* realize */
1887a84e134Smrg#ifndef OLDXAW
1897a84e134Smrg    actions,				/* actions */
1907a84e134Smrg    XtNumber(actions),			/* num_actions */
1917a84e134Smrg#else
1927a84e134Smrg    NULL,				/* actions */
1937a84e134Smrg    0,					/* num_actions */
1947a84e134Smrg#endif
1957a84e134Smrg    resources,				/* resources */
1967a84e134Smrg    XtNumber(resources),		/* num_resources */
1977a84e134Smrg    NULLQUARK,				/* xrm_class */
1987a84e134Smrg    True,				/* compress_motion */
1997a84e134Smrg    True,				/* compress_exposure */
2007a84e134Smrg    True,				/* compress_enterleave */
2017a84e134Smrg    False,				/* visible_interest */
2027a84e134Smrg#ifndef OLDXAW
2037a84e134Smrg    XawSimpleDestroy,			/* destroy */
2047a84e134Smrg#else
2057a84e134Smrg    NULL,				/* destroy */
2067a84e134Smrg#endif
2077a84e134Smrg    NULL,				/* resize */
2087a84e134Smrg#ifndef OLDXAW
2097a84e134Smrg    XawSimpleExpose,			/* expose */
2107a84e134Smrg#else
2117a84e134Smrg    NULL,				/* expose */
2127a84e134Smrg#endif
2137a84e134Smrg    XawSimpleSetValues,			/* set_values */
2147a84e134Smrg    NULL,				/* set_values_hook */
2157a84e134Smrg    XtInheritSetValuesAlmost,		/* set_values_almost */
2167a84e134Smrg    NULL,				/* get_values_hook */
2177a84e134Smrg    NULL,				/* accept_focus */
2187a84e134Smrg    XtVersion,				/* version */
2197a84e134Smrg    NULL,				/* callback_private */
2207a84e134Smrg    NULL,				/* tm_table */
2217a84e134Smrg    XtInheritQueryGeometry,		/* query_geometry */
2227a84e134Smrg    XtInheritDisplayAccelerator,	/* display_accelerator */
2237a84e134Smrg    NULL,				/* extension */
2247a84e134Smrg  },
2257a84e134Smrg  /* simple */
2267a84e134Smrg  {
2277a84e134Smrg    ChangeSensitive,			/* change_sensitive */
228efbcb2bfSmrg#ifndef OLDXAW
229efbcb2bfSmrg    NULL,
230efbcb2bfSmrg#endif
2317a84e134Smrg  },
2327a84e134Smrg};
2337a84e134Smrg
2347a84e134SmrgWidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec;
2357a84e134Smrg
2367a84e134Smrgstatic void
2377a84e134SmrgXawSimpleClassInitialize(void)
2387a84e134Smrg{
2397a84e134Smrg    static XtConvertArgRec convertArg[] = {
2407a84e134Smrg    {
2417a84e134Smrg      XtWidgetBaseOffset,
2427a84e134Smrg      (XtPointer)XtOffsetOf(WidgetRec, core.screen),
2437a84e134Smrg      sizeof(Screen *)
2447a84e134Smrg    },
2457a84e134Smrg    {
2467a84e134Smrg      XtResourceString,
2477a84e134Smrg      (XtPointer)XtNpointerColor,
2487a84e134Smrg      sizeof(Pixel)
2497a84e134Smrg    },
2507a84e134Smrg    {
2517a84e134Smrg      XtResourceString,
2527a84e134Smrg      (XtPointer)XtNpointerColorBackground,
2537a84e134Smrg      sizeof(Pixel)
2547a84e134Smrg    },
2557a84e134Smrg    {
2567a84e134Smrg      XtWidgetBaseOffset,
2577a84e134Smrg      (XtPointer)XtOffsetOf(WidgetRec, core.colormap),
2587a84e134Smrg      sizeof(Colormap)
2597a84e134Smrg    },
2607a84e134Smrg    };
2617a84e134Smrg
2627a84e134Smrg    XawInitializeWidgetSet();
2637a84e134Smrg    XtSetTypeConverter(XtRString, XtRColorCursor, XmuCvtStringToColorCursor,
2647a84e134Smrg		       convertArg, XtNumber(convertArg), XtCacheByDisplay, NULL);
2657a84e134Smrg}
2667a84e134Smrg
2677a84e134Smrgstatic void
2687a84e134SmrgXawSimpleClassPartInitialize(WidgetClass cclass)
2697a84e134Smrg{
2707a84e134Smrg    SimpleWidgetClass c = (SimpleWidgetClass)cclass;
2717a84e134Smrg    SimpleWidgetClass super = (SimpleWidgetClass)c->core_class.superclass;
2727a84e134Smrg
2737a84e134Smrg    if (c->simple_class.change_sensitive == NULL) {
2747a84e134Smrg	char buf[BUFSIZ];
2757a84e134Smrg
276421c997bSmrg	snprintf(buf, sizeof(buf),
277421c997bSmrg		 "%s Widget: The Simple Widget class method "
278421c997bSmrg		 "'change_sensitive' is undefined.\n"
279421c997bSmrg		 "A function must be defined or inherited.",
280421c997bSmrg		 c->core_class.class_name);
2817a84e134Smrg	XtWarning(buf);
2827a84e134Smrg	c->simple_class.change_sensitive = ChangeSensitive;
2837a84e134Smrg    }
2847a84e134Smrg
2857a84e134Smrg    if (c->simple_class.change_sensitive == XtInheritChangeSensitive)
2867a84e134Smrg	c->simple_class.change_sensitive = super->simple_class.change_sensitive;
2877a84e134Smrg}
2887a84e134Smrg
2897a84e134Smrg#ifndef OLDXAW
2907a84e134Smrg/*ARGSUSED*/
2917a84e134Smrgstatic void
2925ec34c4cSmrgXawSimpleInitialize(Widget request _X_UNUSED, Widget cnew,
2935ec34c4cSmrg		    ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED)
2947a84e134Smrg{
2957a84e134Smrg    SimpleWidget simple = (SimpleWidget)cnew;
2967a84e134Smrg
2977a84e134Smrg    if (simple->simple.tip)
2987a84e134Smrg	simple->simple.tip = XtNewString(simple->simple.tip);
2997a84e134Smrg}
3007a84e134Smrg
3017a84e134Smrgstatic void
3027a84e134SmrgXawSimpleDestroy(Widget w)
3037a84e134Smrg{
3047a84e134Smrg    SimpleWidget simple = (SimpleWidget)w;
3057a84e134Smrg
3067a84e134Smrg    if (simple->simple.tip)
3077a84e134Smrg	XtFree((XtPointer)simple->simple.tip);
3087a84e134Smrg}
3097a84e134Smrg#endif
3107a84e134Smrg
3117a84e134Smrgstatic void
3127a84e134SmrgXawSimpleRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
3137a84e134Smrg{
3147a84e134Smrg#ifndef OLDXAW
3157a84e134Smrg    XawPixmap *pixmap;
3167a84e134Smrg#endif
3177a84e134Smrg    Pixmap border_pixmap = CopyFromParent;
3187a84e134Smrg
3197a84e134Smrg  if (!XtIsSensitive(w))
3207a84e134Smrg    {
3217a84e134Smrg	/* change border to gray; have to remember the old one,
3227a84e134Smrg	 * so XtDestroyWidget deletes the proper one */
3237a84e134Smrg	if (((SimpleWidget)w)->simple.insensitive_border == None)
3247a84e134Smrg	    ((SimpleWidget)w)->simple.insensitive_border =
3257a84e134Smrg		XmuCreateStippledPixmap(XtScreen(w),
326421c997bSmrg					w->core.border_pixel,
3277a84e134Smrg					w->core.background_pixel,
3287a84e134Smrg					w->core.depth);
3297a84e134Smrg        border_pixmap = w->core.border_pixmap;
3307a84e134Smrg	attributes->border_pixmap =
3317a84e134Smrg	  w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border;
3327a84e134Smrg
3337a84e134Smrg	*valueMask |= CWBorderPixmap;
3345ec34c4cSmrg	*valueMask &= (Mask)(~CWBorderPixel);
3357a84e134Smrg    }
3367a84e134Smrg
3377a84e134Smrg    ConvertCursor(w);
3387a84e134Smrg
3397a84e134Smrg    if ((attributes->cursor = ((SimpleWidget)w)->simple.cursor) != None)
3407a84e134Smrg	*valueMask |= CWCursor;
3417a84e134Smrg
3427a84e134Smrg  XtCreateWindow(w, InputOutput, (Visual *)CopyFromParent,
3437a84e134Smrg		 *valueMask, attributes);
3447a84e134Smrg
3457a84e134Smrg    if (!XtIsSensitive(w))
3467a84e134Smrg	w->core.border_pixmap = border_pixmap;
3477a84e134Smrg
3487a84e134Smrg#ifndef OLDXAW
3497a84e134Smrg    if (w->core.background_pixmap > XtUnspecifiedPixmap) {
3507a84e134Smrg	pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w),
3515ec34c4cSmrg				      w->core.colormap, (int)w->core.depth);
3527a84e134Smrg	if (pixmap && pixmap->mask)
3537a84e134Smrg	    XawReshapeWidget(w, pixmap);
3547a84e134Smrg    }
3557a84e134Smrg
3567a84e134Smrg    if (((SimpleWidget)w)->simple.tip)
3577a84e134Smrg	XawTipEnable(w);
3587a84e134Smrg#endif
3597a84e134Smrg}
3607a84e134Smrg
3617a84e134Smrg/*
3627a84e134Smrg * Function:
3637a84e134Smrg *	ConvertCursor
3647a84e134Smrg *
3657a84e134Smrg * Parameters:
3667a84e134Smrg *	w - simple widget
3677a84e134Smrg *
3687a84e134Smrg * Description:
3697a84e134Smrg *	Converts a name to a new cursor.
3707a84e134Smrg */
3717a84e134Smrgstatic void
3727a84e134SmrgConvertCursor(Widget w)
3737a84e134Smrg{
3747a84e134Smrg    SimpleWidget simple = (SimpleWidget) w;
3757a84e134Smrg    XrmValue from, to;
3767a84e134Smrg    Cursor cursor = None;
377421c997bSmrg
3787a84e134Smrg    if (simple->simple.cursor_name == NULL)
3797a84e134Smrg	return;
3807a84e134Smrg
3817a84e134Smrg    from.addr = (XPointer)simple->simple.cursor_name;
3825ec34c4cSmrg    from.size = (unsigned)strlen((char *)from.addr) + 1;
3837a84e134Smrg
3847a84e134Smrg    to.size = sizeof(Cursor);
3857a84e134Smrg    to.addr = (XPointer)&cursor;
3867a84e134Smrg
3877a84e134Smrg    if (XtConvertAndStore(w, XtRString, &from, XtRColorCursor, &to))
3887a84e134Smrg      simple->simple.cursor = cursor;
3897a84e134Smrg    else
3907a84e134Smrg	XtAppErrorMsg(XtWidgetToApplicationContext(w),
3917a84e134Smrg		      "convertFailed","ConvertCursor","XawError",
3927a84e134Smrg		      "Simple: ConvertCursor failed.",
3937a84e134Smrg		      NULL, NULL);
3947a84e134Smrg}
3957a84e134Smrg
3967a84e134Smrg
3977a84e134Smrg/*ARGSUSED*/
3987a84e134Smrgstatic Boolean
3995ec34c4cSmrgXawSimpleSetValues(Widget current, Widget request _X_UNUSED, Widget cnew,
4005ec34c4cSmrg		   ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED)
4017a84e134Smrg{
4027a84e134Smrg    SimpleWidget s_old = (SimpleWidget)current;
4037a84e134Smrg    SimpleWidget s_new = (SimpleWidget)cnew;
4047a84e134Smrg    Bool new_cursor = False;
4057a84e134Smrg
4067a84e134Smrg    /* this disables user changes after creation */
4077a84e134Smrg    s_new->simple.international = s_old->simple.international;
4087a84e134Smrg
4097a84e134Smrg    if (XtIsSensitive(current) != XtIsSensitive(cnew))
4107a84e134Smrg	(*((SimpleWidgetClass)XtClass(cnew))->simple_class.change_sensitive)
4117a84e134Smrg	   (cnew);
4127a84e134Smrg
4137a84e134Smrg    if (s_old->simple.cursor != s_new->simple.cursor)
4147a84e134Smrg	new_cursor = True;
415421c997bSmrg
4167a84e134Smrg    /*
4177a84e134Smrg     * We are not handling the string cursor_name correctly here
4187a84e134Smrg     */
4197a84e134Smrg
4207a84e134Smrg    if (s_old->simple.pointer_fg != s_new->simple.pointer_fg ||
4217a84e134Smrg	s_old->simple.pointer_bg != s_new->simple.pointer_bg ||
4227a84e134Smrg	s_old->simple.cursor_name != s_new->simple.cursor_name) {
4237a84e134Smrg	ConvertCursor(cnew);
4247a84e134Smrg	new_cursor = True;
4257a84e134Smrg    }
4267a84e134Smrg
4277a84e134Smrg    if (new_cursor && XtIsRealized(cnew)) {
4287a84e134Smrg	if (s_new->simple.cursor != None)
4297a84e134Smrg	    XDefineCursor(XtDisplay(cnew), XtWindow(cnew), s_new->simple.cursor);
4307a84e134Smrg	else
4317a84e134Smrg	    XUndefineCursor(XtDisplay(cnew), XtWindow(cnew));
4327a84e134Smrg      }
4337a84e134Smrg
4347a84e134Smrg#ifndef OLDXAW
4357a84e134Smrg    if (s_old->core.background_pixmap != s_new->core.background_pixmap) {
4367a84e134Smrg	XawPixmap *opix, *npix;
4377a84e134Smrg
4387a84e134Smrg	opix = XawPixmapFromXPixmap(s_old->core.background_pixmap,
4397a84e134Smrg				    XtScreen(s_old), s_old->core.colormap,
4405ec34c4cSmrg				    (int)s_old->core.depth);
4417a84e134Smrg	npix = XawPixmapFromXPixmap(s_new->core.background_pixmap,
4427a84e134Smrg				    XtScreen(s_new), s_new->core.colormap,
4435ec34c4cSmrg				    (int)s_new->core.depth);
4447a84e134Smrg	if ((npix && npix->mask) || (opix && opix->mask))
4457a84e134Smrg	    XawReshapeWidget(cnew, npix);
4467a84e134Smrg    }
4477a84e134Smrg
4487a84e134Smrg    if (s_old->simple.tip != s_new->simple.tip) {
4497a84e134Smrg	if (s_old->simple.tip)
4507a84e134Smrg	    XtFree((XtPointer)s_old->simple.tip);
4517a84e134Smrg	if (s_new->simple.tip)
4527a84e134Smrg	    s_new->simple.tip = XtNewString(s_new->simple.tip);
4537a84e134Smrg    }
4547a84e134Smrg
4557a84e134Smrg    if (s_old->simple.tip && !s_new->simple.tip)
4567a84e134Smrg	XawTipDisable(cnew);
4577a84e134Smrg    else if (!s_old->simple.tip && s_new->simple.tip)
4587a84e134Smrg	XawTipEnable(cnew);
4597a84e134Smrg
4607a84e134Smrg    if (s_old->simple.display_list != s_new->simple.display_list)
4617a84e134Smrg	return (True);
4627a84e134Smrg#endif /* OLDXAW */
4637a84e134Smrg
4647a84e134Smrg    return (False);
4657a84e134Smrg}
4667a84e134Smrg
4677a84e134Smrg#ifndef OLDXAW
4687a84e134Smrgstatic void
4697a84e134SmrgXawSimpleExpose(Widget w, XEvent *event, Region region)
4707a84e134Smrg{
4717a84e134Smrg    SimpleWidget xaw = (SimpleWidget)w;
4727a84e134Smrg
4737a84e134Smrg    if (xaw->simple.display_list)
4747a84e134Smrg	XawRunDisplayList(w, xaw->simple.display_list, event, region);
4757a84e134Smrg}
4767a84e134Smrg#endif
4777a84e134Smrg
4787a84e134Smrgstatic Bool
4797a84e134SmrgChangeSensitive(Widget w)
4807a84e134Smrg{
4817a84e134Smrg    if (XtIsRealized(w)) {
4827a84e134Smrg	if (XtIsSensitive(w))
4837a84e134Smrg	    if (w->core.border_pixmap != XtUnspecifiedPixmap)
4847a84e134Smrg	    XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
4857a84e134Smrg				    w->core.border_pixmap);
4867a84e134Smrg	    else
4877a84e134Smrg		XSetWindowBorder(XtDisplay(w), XtWindow(w),
4887a84e134Smrg				 w->core.border_pixel);
4897a84e134Smrg	else {
4907a84e134Smrg	    if (((SimpleWidget)w)->simple.insensitive_border == None)
4917a84e134Smrg		((SimpleWidget)w)->simple.insensitive_border =
4927a84e134Smrg		    XmuCreateStippledPixmap(XtScreen(w),
493421c997bSmrg					    w->core.border_pixel,
4947a84e134Smrg					    w->core.background_pixel,
4957a84e134Smrg					    w->core.depth);
4967a84e134Smrg	    XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
4977a84e134Smrg				   ((SimpleWidget)w)->simple.insensitive_border);
4987a84e134Smrg	}
4997a84e134Smrg    }
5007a84e134Smrg
5017a84e134Smrg    return (False);
5027a84e134Smrg}
503