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