[Xaw3d/f14/master] Add patches from http://gitorious.org/xaw3d to git

Hans de Goede jwrdegoede at fedoraproject.org
Wed Nov 10 08:36:29 UTC 2010


commit 2e47ef4657a955c187c7a1cb8b7c9547bbd23659
Author: Orion Poplawski <orion at cora.nwra.com>
Date:   Mon Nov 8 14:45:19 2010 -0700

    Add patches from http://gitorious.org/xaw3d to git

 Xaw3d-1.5E-3Dlabel.patch             |  179 ++++
 Xaw3d-1.5E-cast.patch                |   25 +
 Xaw3d-1.5E-close-destroy-crash.patch |   30 +
 Xaw3d-1.5E-compat.patch              |   80 ++
 Xaw3d-1.5E-fontset.patch             |  302 ++++++
 Xaw3d-1.5E-hsbar.patch               |  283 ++++++
 Xaw3d-1.5E-null.patch                |   88 ++
 Xaw3d-1.5E-secure.patch              |  557 +++++++++++
 Xaw3d-1.5E-thumb.patch               | 1747 ++++++++++++++++++++++++++++++++++
 9 files changed, 3291 insertions(+), 0 deletions(-)
---
diff --git a/Xaw3d-1.5E-3Dlabel.patch b/Xaw3d-1.5E-3Dlabel.patch
new file mode 100644
index 0000000..5a9b5b8
--- /dev/null
+++ b/Xaw3d-1.5E-3Dlabel.patch
@@ -0,0 +1,179 @@
+From 282b0b2a42dec11a772be36f4b4aa70ae7fb6a0d Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:54:15 +0200
+Subject: [PATCH] Xaw3d-1.5E-3Dlabel.patch
+
+---
+ xc/lib/Xaw3d/Label.c |   67 +++++++++++++++++++++++++++++++++++---------------
+ 1 files changed, 47 insertions(+), 20 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/Label.c b/xc/lib/Xaw3d/Label.c
+index 8bda3a7..c4e1ff9 100644
+--- a/xc/lib/Xaw3d/Label.c
++++ b/xc/lib/Xaw3d/Label.c
+@@ -422,9 +422,16 @@ static void GetgrayGC(lw)
+ static void compute_bitmap_offsets (lw)
+     LabelWidget lw;
+ {
+-    if (lw->label.lbm_height != 0)
+-	lw->label.lbm_y = (lw->core.height - lw->label.lbm_height) / 2;
+-    else
++    /*
++     * bitmap will be eventually be displayed at 
++     * (internal_width, internal_height + lbm_y)
++     */
++    if (lw->label.lbm_height != 0) {
++	lw->label.lbm_y = (lw->core.height -
++			   (lw->threeD.shadow_width * 2 +
++			    lw->label.internal_height * 2 +
++			    lw->label.lbm_height)) / 2;
++    } else
+ 	lw->label.lbm_y = 0;
+ }
+ 
+@@ -450,12 +457,16 @@ static void Initialize(request, new, args, num_args)
+     ArgList args;
+     Cardinal *num_args;
+ {
++#if 0
+     extern WidgetClass commandWidgetClass;
++#endif
+     LabelWidget lw = (LabelWidget) new;
+ 
++#if 0
+     /* disable shadows if we're not a subclass of Command */
+     if (!XtIsSubclass(new, commandWidgetClass))
+ 	lw->threeD.shadow_width = 0;
++#endif
+ 
+     if (lw->label.label == NULL) 
+         lw->label.label = XtNewString(lw->core.name);
+@@ -469,18 +480,20 @@ static void Initialize(request, new, args, num_args)
+ 
+     if (lw->core.height == 0)
+ 	lw->core.height = lw->label.label_height +
+-				2 * lw->label.internal_height;
++			  2 * lw->label.internal_height +
++			  2 * lw->threeD.shadow_width;
+ 
+     set_bitmap_info(lw);  /* req's core.height, sets label.lbm_* */
+ 
+     if (lw->label.lbm_height > lw->label.label_height)
+ 	lw->core.height = lw->label.lbm_height +
+-				2 * lw->label.internal_height;
++			  2 * lw->label.internal_height;
+ 
+     if (lw->core.width == 0)
+         lw->core.width = lw->label.label_width +
+-				2 * lw->label.internal_width +
+-				LEFT_OFFSET(lw);  /* req's label.lbm_width */
++			 2 * lw->label.internal_width +
++			 2 * lw->threeD.shadow_width +
++			 LEFT_OFFSET(lw);	/* req's label.lbm_width */
+ 
+     lw->label.label_x = lw->label.label_y = 0;
+     (*XtClass(new)->core_class.resize) ((Widget)lw);
+@@ -559,14 +572,16 @@ static void Redisplay(gw, event, region)
+ 	    if (w->label.depth == 1)
+ 		XCopyPlane(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
+ 			   w->label.lbm_width, w->label.lbm_height,
+-			   (int) w->label.internal_width,
+-			   (int) w->label.lbm_y,
++			   (int) w->label.internal_width + w->threeD.shadow_width,
++			   (int) w->label.internal_height + w->threeD.shadow_width
++				 + w->label.lbm_y,
+ 			   (unsigned long) 1L);
+ 	    else
+ 		XCopyArea(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
+ 			  w->label.lbm_width, w->label.lbm_height,
+-			  (int) w->label.internal_width,
+-			  (int) w->label.lbm_y);
++			  (int) w->label.internal_width + w->threeD.shadow_width,
++			  (int) w->label.internal_height + w->threeD.shadow_width
++				+ w->label.lbm_y);
+ 	}
+ 
+ #ifdef XAW_INTERNATIONALIZATION
+@@ -657,14 +672,16 @@ static void _Reposition(lw, width, height, dx, dy)
+     Position *dx, *dy;
+ {
+     Position newPos;
+-    Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw);
++    Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw) +
++			lw->threeD.shadow_width;
+ 
+     switch (lw->label.justify) {
+ 	case XtJustifyLeft:
+ 	    newPos = leftedge;
+ 	    break;
+ 	case XtJustifyRight:
+-	    newPos = width - lw->label.label_width - lw->label.internal_width;
++	    newPos = width - (lw->label.label_width + lw->label.internal_width +
++			      lw->threeD.shadow_width);
+ 	    break;
+ 	case XtJustifyCenter:
+ 	default:
+@@ -758,17 +775,20 @@ static Boolean SetValues(current, request, new, args, num_args)
+     if (newlw->label.resize && was_resized) {
+ 	if (curlw->core.height == reqlw->core.height && !checks[HEIGHT])
+ 	    newlw->core.height = newlw->label.label_height +
+-				2 * newlw->label.internal_height;
++				 2 * newlw->label.internal_height +
++				 2 * newlw->threeD.shadow_width;
+ 
+ 	set_bitmap_info (newlw);  /* req's core.height, sets label.lbm_* */
+ 
+ 	if (newlw->label.lbm_height > newlw->label.label_height)
+ 	    newlw->core.height = newlw->label.lbm_height +
+-					2 * newlw->label.internal_height;
++				 2 * newlw->label.internal_height +
++				 2 * newlw->threeD.shadow_width;
+ 
+ 	if (curlw->core.width == reqlw->core.width && !checks[WIDTH])
+ 	    newlw->core.width = newlw->label.label_width +
+ 				2 * newlw->label.internal_width +
++				2 * newlw->threeD.shadow_width +
+ 				LEFT_OFFSET(newlw);  /* req's label.lbm_width */
+     }
+ 
+@@ -777,15 +797,20 @@ static Boolean SetValues(current, request, new, args, num_args)
+ 	if (checks[HEIGHT]) {
+ 	    if (newlw->label.label_height > newlw->label.lbm_height)
+ 		i = newlw->label.label_height +
+-			2 * newlw->label.internal_height;
++		    2 * newlw->label.internal_height +
++		    2 * newlw->threeD.shadow_width;
+ 	    else
+-		i = newlw->label.lbm_height + 2 * newlw->label.internal_height;
++		i = newlw->label.lbm_height +
++		    2 * newlw->label.internal_height +
++		    2 * newlw->threeD.shadow_width;
+ 	    if (i > newlw->core.height)
+ 		newlw->core.height = i;
+ 	}
+ 	if (checks[WIDTH]) {
+-	    i = newlw->label.label_width + 2 * newlw->label.internal_width +
+-			LEFT_OFFSET(newlw);  /* req's label.lbm_width */
++	    i = newlw->label.label_width +
++		2 * newlw->label.internal_width +
++		2 * newlw->threeD.shadow_width +
++		LEFT_OFFSET(newlw);		    /* req's label.lbm_width */
+ 	    if (i > newlw->core.width)
+ 		newlw->core.width = i;
+ 	}
+@@ -857,9 +882,11 @@ static XtGeometryResult QueryGeometry(w, intended, preferred)
+     preferred->request_mode = CWWidth | CWHeight;
+     preferred->width = (lw->label.label_width + 
+ 			    2 * lw->label.internal_width +
++			    2 * lw->threeD.shadow_width +
+ 			    LEFT_OFFSET(lw));
+     preferred->height = lw->label.label_height + 
+-			    2 * lw->label.internal_height;
++			    2 * lw->label.internal_height +
++			    2 * lw->threeD.shadow_width;
+     if (  ((intended->request_mode & (CWWidth | CWHeight))
+ 	   	== (CWWidth | CWHeight)) &&
+ 	  intended->width == preferred->width &&
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-cast.patch b/Xaw3d-1.5E-cast.patch
new file mode 100644
index 0000000..f7f4f62
--- /dev/null
+++ b/Xaw3d-1.5E-cast.patch
@@ -0,0 +1,25 @@
+From 2a809cfbe5335bfa13a9f6496c4e04fffd93d930 Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:55:21 +0200
+Subject: [PATCH] Xaw3d-1.5E-cast.patch
+
+---
+ xc/lib/Xaw3d/Scrollbar.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/Scrollbar.c b/xc/lib/Xaw3d/Scrollbar.c
+index 0566733..6ed1480 100644
+--- a/xc/lib/Xaw3d/Scrollbar.c
++++ b/xc/lib/Xaw3d/Scrollbar.c
+@@ -1375,7 +1375,7 @@ static void NotifyThumb (w, event, params, num_params )
+        the arrows. */
+     top += 0.0001;
+ /* #endif */
+-    XtCallCallbacks (w, XtNthumbProc, *(XtPointer*)&top);
++    XtCallCallbacks (w, XtNthumbProc, (XtPointer)(long)top);
+     XtCallCallbacks (w, XtNjumpProc, (XtPointer)&top);
+ }
+ 
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-close-destroy-crash.patch b/Xaw3d-1.5E-close-destroy-crash.patch
new file mode 100644
index 0000000..265ad88
--- /dev/null
+++ b/Xaw3d-1.5E-close-destroy-crash.patch
@@ -0,0 +1,30 @@
+From 23b3ca50395f180cba4a923eb8827dcc961629da Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:48:38 +0200
+Subject: [PATCH] Xaw3d-1.5E-close-destroy-crash.patch
+
+---
+ xc/lib/Xaw3d/XawIm.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/XawIm.c b/xc/lib/Xaw3d/XawIm.c
+index ead7166..730c393 100644
+--- a/xc/lib/Xaw3d/XawIm.c
++++ b/xc/lib/Xaw3d/XawIm.c
+@@ -331,12 +331,12 @@ static void DestroyAllIM( ve )
+     /*
+      * Close Input Method
+      */
+-    CloseIM(ve);
+     if (!XFindContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext,
+ 		      (XPointer*)&contextErrData)) {
+ 	if (contextErrData) XtFree((char *)contextErrData);
+     }
+     XDeleteContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext);
++    CloseIM(ve);
+     ve->im.xim = NULL;
+ 
+     /*
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-compat.patch b/Xaw3d-1.5E-compat.patch
new file mode 100644
index 0000000..1a25815
--- /dev/null
+++ b/Xaw3d-1.5E-compat.patch
@@ -0,0 +1,80 @@
+From 59033c0e4242f3a09a5116b4120e5c8353f89372 Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:53:58 +0200
+Subject: [PATCH] Xaw3d-1.5E-compat.patch
+
+---
+ xc/lib/Xaw3d/Command.c |    2 ++
+ xc/lib/Xaw3d/Label.c   |    2 ++
+ xc/lib/Xaw3d/Text.c    |   11 +++++++++++
+ xc/lib/Xaw3d/Text.h    |    6 ++++++
+ 4 files changed, 21 insertions(+), 0 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/Command.c b/xc/lib/Xaw3d/Command.c
+index 5fe16b6..6e04860 100644
+--- a/xc/lib/Xaw3d/Command.c
++++ b/xc/lib/Xaw3d/Command.c
+@@ -91,6 +91,8 @@ static XtResource resources[] = {
+    {XtNcornerRoundPercent, XtCCornerRoundPercent, XtRDimension,
+         sizeof(Dimension), offset(command.corner_round), XtRImmediate,
+ 	(XtPointer) 25},
++   {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension),
++	offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2},
+    {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
+       XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
+       (XtPointer) 0}
+diff --git a/xc/lib/Xaw3d/Label.c b/xc/lib/Xaw3d/Label.c
+index 5fd2e32..8bda3a7 100644
+--- a/xc/lib/Xaw3d/Label.c
++++ b/xc/lib/Xaw3d/Label.c
+@@ -113,6 +113,8 @@ static XtResource resources[] = {
+ 	offset(label.pixmap), XtRImmediate, (XtPointer)None},
+     {XtNresize, XtCResize, XtRBoolean, sizeof(Boolean),
+ 	offset(label.resize), XtRImmediate, (XtPointer)True},
++    {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension),
++	offset(threeD.shadow_width), XtRImmediate, (XtPointer) 0},
+     {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
+          XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
+          (XtPointer)1}
+diff --git a/xc/lib/Xaw3d/Text.c b/xc/lib/Xaw3d/Text.c
+index baaba17..81ff472 100644
+--- a/xc/lib/Xaw3d/Text.c
++++ b/xc/lib/Xaw3d/Text.c
+@@ -3527,6 +3527,17 @@ Widget w;
+   return ((TextWidget)w)->text.source;
+ }
+ 
++Widget
++#if NeedFunctionPrototypes
++XawTextGetSink(Widget w)
++#else
++XawTextGetSink(w)
++Widget w;
++#endif
++{
++  return (((TextWidget)w)->text.sink);
++}
++
+ void
+ #if NeedFunctionPrototypes
+ XawTextDisplayCaret (Widget w,
+diff --git a/xc/lib/Xaw3d/Text.h b/xc/lib/Xaw3d/Text.h
+index 9157927..d68f94e 100644
+--- a/xc/lib/Xaw3d/Text.h
++++ b/xc/lib/Xaw3d/Text.h
+@@ -274,6 +274,12 @@ extern Widget XawTextGetSource(
+ #endif
+ );
+ 
++extern Widget XawTextGetSink(
++#if NeedFunctionPrototypes
++    Widget		/* w */
++#endif
++);
++
+ extern XawTextPosition XawTextSearch(
+ #if NeedFunctionPrototypes
+     Widget			/* w */,
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-fontset.patch b/Xaw3d-1.5E-fontset.patch
new file mode 100644
index 0000000..fd20ba4
--- /dev/null
+++ b/Xaw3d-1.5E-fontset.patch
@@ -0,0 +1,302 @@
+From 762bcb8c50fd0256a545ad6ed2304403daca8081 Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:54:35 +0200
+Subject: [PATCH] Xaw3d-1.5E-fontset.patch
+
+---
+ xc/lib/Xaw3d/AsciiSink.c |    2 ++
+ xc/lib/Xaw3d/Command.c   |    2 ++
+ xc/lib/Xaw3d/Label.c     |   11 ++++++++++-
+ xc/lib/Xaw3d/List.c      |   14 ++++++++++++--
+ xc/lib/Xaw3d/MultiSink.c |   34 ++++++++++++++++++++++++++--------
+ xc/lib/Xaw3d/SmeBSB.c    |    2 ++
+ xc/lib/Xaw3d/Tip.c       |   16 ++++++++++++++--
+ xc/lib/Xaw3d/XawIm.c     |   14 +++++++++-----
+ 8 files changed, 77 insertions(+), 18 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/AsciiSink.c b/xc/lib/Xaw3d/AsciiSink.c
+index 2ebd952..a664db5 100644
+--- a/xc/lib/Xaw3d/AsciiSink.c
++++ b/xc/lib/Xaw3d/AsciiSink.c
+@@ -532,6 +532,8 @@ Cardinal *num_args;
+ {
+     AsciiSinkObject sink = (AsciiSinkObject) new;
+ 
++    if (!sink->ascii_sink.font) XtError("Aborting: no font found\n");
++
+     GetGC(sink);
+     
+     sink->ascii_sink.insertCursorOn= CreateInsertCursor(XtScreenOfObject(new));
+diff --git a/xc/lib/Xaw3d/Command.c b/xc/lib/Xaw3d/Command.c
+index 6e04860..9f22d78 100644
+--- a/xc/lib/Xaw3d/Command.c
++++ b/xc/lib/Xaw3d/Command.c
+@@ -215,6 +215,8 @@ Cardinal *num_args;		/* unused */
+   CommandWidget cbw = (CommandWidget) new;
+   int shape_event_base, shape_error_base;
+ 
++  if (!cbw->label.font) XtError("Aborting: no font found\n");
++
+   if (cbw->command.shape_style != XawShapeRectangle
+       && !XShapeQueryExtension(XtDisplay(new), &shape_event_base, 
+ 			       &shape_error_base))
+diff --git a/xc/lib/Xaw3d/Label.c b/xc/lib/Xaw3d/Label.c
+index c4e1ff9..7e964f8 100644
+--- a/xc/lib/Xaw3d/Label.c
++++ b/xc/lib/Xaw3d/Label.c
+@@ -278,7 +278,10 @@ static void SetTextWidthAndHeight(lw)
+ #ifdef XAW_INTERNATIONALIZATION
+     if ( lw->simple.international == True ) {
+       XFontSet	fset = lw->label.fontset;
+-      XFontSetExtents *ext = XExtentsOfFontSet(fset);
++      XFontSetExtents *ext;
++
++      if (!lw->label.fontset || !(ext = XExtentsOfFontSet(fset)))
++	 XtError("Aborting: no fontset found\n");
+ 
+       lw->label.label_height = ext->max_ink_extent.height;
+       if (lw->label.label == NULL) {
+@@ -468,6 +471,12 @@ static void Initialize(request, new, args, num_args)
+ 	lw->threeD.shadow_width = 0;
+ #endif
+ 
++    if (!lw->label.font) XtError("Aborting: no font found\n");
++#ifdef XAW_INTERNATIONALIZATION
++    if (lw->simple.international && !lw->label.fontset)
++	XtError("Aborting: no fontset found\n");
++#endif
++    
+     if (lw->label.label == NULL) 
+         lw->label.label = XtNewString(lw->core.name);
+     else
+diff --git a/xc/lib/Xaw3d/List.c b/xc/lib/Xaw3d/List.c
+index 99faf31..e7d7d57 100644
+--- a/xc/lib/Xaw3d/List.c
++++ b/xc/lib/Xaw3d/List.c
+@@ -366,6 +366,12 @@ Cardinal *num_args;
+ {
+     ListWidget lw = (ListWidget) new;
+ 
++    if (!lw->list.font) XtError("Aborting: no font found\n");
++#ifdef XAW_INTERNATIONALIZATION
++    if (lw->simple.international && !lw->list.fontset)
++	XtError("Aborting: no fontset found\n");
++#endif
++
+ /* 
+  * Initialize all private resources.
+  */
+@@ -590,7 +596,9 @@ int item;
+     int x, y, str_y;
+     ListWidget lw = (ListWidget) w;
+ #ifdef XAW_INTERNATIONALIZATION
+-    XFontSetExtents *ext  = XExtentsOfFontSet(lw->list.fontset);
++    XFontSetExtents *ext;
++    if (!lw->list.fontset || !(ext = XExtentsOfFontSet(lw->list.fontset)))
++       XtError("Aborting: no fontset found\n");
+ #endif
+ 
+     if (!XtIsRealized(w)) return; /* Just in case... */
+@@ -969,7 +977,9 @@ Cardinal *num_args;
+     ListWidget nl = (ListWidget) new;
+     Boolean redraw = FALSE;
+ #ifdef XAW_INTERNATIONALIZATION
+-    XFontSetExtents *ext = XExtentsOfFontSet(nl->list.fontset);
++    XFontSetExtents *ext;
++    if (!nl->list.fontset || !(ext = XExtentsOfFontSet(nl->list.fontset)))
++       XtError("Aborting: no fontset found\n");
+ #endif
+ 
+     /* If the request height/width is different, lock it.  Unless its 0. If */
+diff --git a/xc/lib/Xaw3d/MultiSink.c b/xc/lib/Xaw3d/MultiSink.c
+index d8aac3f..0c4d7d0 100644
+--- a/xc/lib/Xaw3d/MultiSink.c
++++ b/xc/lib/Xaw3d/MultiSink.c
+@@ -254,7 +254,9 @@ PaintText(w, gc, x, y, buf, len)
+     XFontSet fontset = sink->multi_sink.fontset;
+     Position max_x;
+     Dimension width = XwcTextEscapement(fontset, buf, len);
+-    XFontSetExtents *ext = XExtentsOfFontSet(fontset);
++    XFontSetExtents *ext;
++    if (!fontset || !(ext = XExtentsOfFontSet(fontset)))
++       XtError("Aborting: no fontset found\n");
+     max_x = (Position) ctx->core.width;
+ 
+     if ( ((int) width) <= -x)	           /* Don't draw if we can't see it. */
+@@ -291,7 +293,9 @@ DisplayText(w, x, y, pos1, pos2, highlight)
+     MultiSinkObject sink = (MultiSinkObject) w;
+     Widget source = XawTextGetSource(XtParent(w));
+     wchar_t buf[BUFSIZ];
+-    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
++    XFontSetExtents *ext;
++    if (!sink->multi_sink.fontset || !(ext = XExtentsOfFontSet(sink->multi_sink.fontset)))
++       XtError("Aborting: no fontset found\n");
+ 
+     int j, k;
+     XawTextBlock blk;
+@@ -420,8 +424,10 @@ FindDistance (w, fromPos, fromx, toPos, resWidth, resPos, resHeight)
+ 
+     XawTextPosition index, lastPos;
+     wchar_t c;
+-    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
+     XawTextBlock blk;
++    XFontSetExtents *ext;
++    if (!sink->multi_sink.fontset || !(ext = XExtentsOfFontSet(sink->multi_sink.fontset)))
++       XtError("Aborting: no fontset found\n");
+ 
+     /* we may not need this */
+     lastPos = GETLASTPOS;
+@@ -461,8 +467,10 @@ FindPosition(w, fromPos, fromx, width, stopAtWordBreak, resPos, resWidth, resHei
+     int     lastWidth = 0, whiteSpaceWidth = 0;
+     Boolean whiteSpaceSeen;
+     wchar_t c;
+-    XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
+     XawTextBlock blk;
++    XFontSetExtents *ext;
++    if (!sink->multi_sink.fontset || !(ext = XExtentsOfFontSet(sink->multi_sink.fontset)))
++       XtError("Aborting: no fontset found\n");
+ 
+     lastPos = GETLASTPOS;
+ 
+@@ -566,7 +574,11 @@ Initialize(request, new, args, num_args)
+     MultiSinkObject sink = (MultiSinkObject) new;
+ 
+     GetGC(sink);
+-    
++
++#ifdef XAW_INTERNATIONALIZATION
++    if (!sink->multi_sink.fontset) XtError("Aborting: no fontset found\n");
++#endif
++
+     sink->multi_sink.insertCursorOn= CreateInsertCursor(XtScreenOfObject(new));
+     sink->multi_sink.laststate = XawisOff;
+     sink->multi_sink.cursor_x = sink->multi_sink.cursor_y = 0;
+@@ -653,7 +665,9 @@ MaxLines(w, height)
+ {
+   MultiSinkObject sink = (MultiSinkObject) w;
+   int font_height;
+-  XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
++  XFontSetExtents *ext;
++  if (!sink->multi_sink.fontset || !(ext = XExtentsOfFontSet(sink->multi_sink.fontset)))
++     XtError("Aborting: no fontset found\n");
+ 
+   font_height = ext->max_logical_extent.height;
+   return( ((int) height) / font_height );
+@@ -680,7 +694,9 @@ MaxHeight( w, lines )
+ #endif
+ {
+   MultiSinkObject sink = (MultiSinkObject) w;
+-  XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
++  XFontSetExtents *ext;
++  if (!sink->multi_sink.fontset || !(ext = XExtentsOfFontSet(sink->multi_sink.fontset)))
++     XtError("Aborting: no fontset found\n");
+ 
+   return(lines * ext->max_logical_extent.height); 
+ }
+@@ -776,7 +792,9 @@ _XawMultiSinkPosToXY( w, pos, x, y )
+ #endif
+ {
+     MultiSinkObject sink = (MultiSinkObject) ((TextWidget)w)->text.sink;
+-    XFontSetExtents *ext = XExtentsOfFontSet( sink->multi_sink.fontset );
++    XFontSetExtents *ext;
++    if (!sink->multi_sink.fontset || !(ext = XExtentsOfFontSet( sink->multi_sink.fontset )))
++       XtError("Aborting: no fontset found\n");
+ 
+     _XawTextPosToXY( w, pos, x, y );
+     *y += abs( ext->max_logical_extent.y );
+diff --git a/xc/lib/Xaw3d/SmeBSB.c b/xc/lib/Xaw3d/SmeBSB.c
+index abf811f..dbb39aa 100644
+--- a/xc/lib/Xaw3d/SmeBSB.c
++++ b/xc/lib/Xaw3d/SmeBSB.c
+@@ -203,6 +203,8 @@ Cardinal *num_args;
+     else
+ 	entry->sme_bsb.label = XtNewString( entry->sme_bsb.label );
+ 
++    if (!entry->sme_bsb.font) XtError("Aborting: no font found\n");
++
+     CreateGCs(new);
+ 
+     GetBitmapInfo(new, TRUE);	/* Left Bitmap Info */
+diff --git a/xc/lib/Xaw3d/Tip.c b/xc/lib/Xaw3d/Tip.c
+index 888eeac..233cc8d 100644
+--- a/xc/lib/Xaw3d/Tip.c
++++ b/xc/lib/Xaw3d/Tip.c
+@@ -252,6 +252,12 @@ Cardinal *num_args;
+     TipWidget tip = (TipWidget)w;
+     XGCValues values;
+ 
++    if (!tip->tip.font) XtError("Aborting: no font found\n");
++#ifdef XAW_INTERNATIONALIZATION
++    if (tip->tip.international && !tip->tip.fontset)
++	XtError("Aborting: no fontset found\n");
++#endif
++
+     tip->tip.timer = 0;
+ 
+     values.foreground = tip->tip.foreground;
+@@ -344,7 +350,10 @@ Region region;
+ #ifdef XAW_INTERNATIONALIZATION
+     if (tip->tip.international == True) {
+ 	Position ksy = tip->tip.internal_height;
+-	XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset);
++	XFontSetExtents *ext;
++
++        if (!tip->tip.fontset || !(ext = XExtentsOfFontSet(tip->tip.fontset)))
++	   XtError("Aborting: no fontset found\n");
+ 
+ 	ksy += abs(ext->max_ink_extent.y);
+ 
+@@ -429,7 +438,10 @@ XawTipInfo *info;
+ #ifdef XAW_INTERNATIONALIZATION
+     if (info->tip->tip.international == True) {
+ 	XFontSet fset = info->tip->tip.fontset;
+-	XFontSetExtents *ext = XExtentsOfFontSet(fset);
++	XFontSetExtents *ext;
++
++	if (!fset || !(ext = XExtentsOfFontSet(fset)))
++	   XtError("Aborting: no fontset found\n");
+ 
+ 	height = ext->max_ink_extent.height;
+ 	if ((nl = index(label, '\n')) != NULL) {
+diff --git a/xc/lib/Xaw3d/XawIm.c b/xc/lib/Xaw3d/XawIm.c
+index 2cf2113..0aeb9ac 100644
+--- a/xc/lib/Xaw3d/XawIm.c
++++ b/xc/lib/Xaw3d/XawIm.c
+@@ -752,8 +752,10 @@ static void CreateIC( w, ve )
+ 	    SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++;
+ 	    SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++;
+ 	    SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++;
+-	    height = maxAscentOfFontSet(p->font_set)
+-		   + maxDescentOfFontSet(p->font_set);
++	    if (p->font_set) {
++		height = maxAscentOfFontSet(p->font_set)
++			+ maxDescentOfFontSet(p->font_set);
++	    }
+ 	    height = SetVendorShellHeight(ve, height);
+ 	}
+ 	if (p->flg & CIFg) {
+@@ -884,7 +886,7 @@ static void SetICValues( w, ve, focus )
+     XPointer		ic_a[20], pe_a[20], st_a[20];
+     int			ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
+     XawTextMargin	*margin;
+-    int			height;
++    int			height = 0;
+ 
+     if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
+ 	(p->xic == NULL)) return;
+@@ -911,8 +913,10 @@ static void SetICValues( w, ve, focus )
+ 	    SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++;
+ 	    SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++;
+ 	    SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++;
+-	    height = maxAscentOfFontSet(p->font_set)
+-		   + maxDescentOfFontSet(p->font_set);
++	    if (p->font_set) {
++		height = maxAscentOfFontSet(p->font_set)
++			+ maxDescentOfFontSet(p->font_set);
++	    }
+ 	    height = SetVendorShellHeight(ve, height);
+ 	}
+ 	if (p->flg & CIFg) {
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-hsbar.patch b/Xaw3d-1.5E-hsbar.patch
new file mode 100644
index 0000000..92a9476
--- /dev/null
+++ b/Xaw3d-1.5E-hsbar.patch
@@ -0,0 +1,283 @@
+From 4b6b6b0ee611cdbff470794c9ec9e095296abfd2 Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:53:43 +0200
+Subject: [PATCH] Xaw3d-1.5E-hsbar.patch
+
+---
+ xc/lib/Xaw3d/Text.c     |   12 ++++--
+ xc/lib/Xaw3d/Viewport.c |   92 ++++++++++++++---------------------------------
+ 2 files changed, 35 insertions(+), 69 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/Text.c b/xc/lib/Xaw3d/Text.c
+index 1716890..baaba17 100644
+--- a/xc/lib/Xaw3d/Text.c
++++ b/xc/lib/Xaw3d/Text.c
+@@ -478,8 +478,10 @@ TextWidget ctx;
+ 		    (XtPointer) NULL);
+ 
+ /**/
+-  ctx->text.r_margin.bottom += hbar->core.height + hbar->core.border_width;
+-  ctx->text.margin.bottom = ctx->text.r_margin.bottom;
++  if (ctx->text.scroll_vert == XawtextScrollAlways) {
++    ctx->text.r_margin.bottom += hbar->core.height + hbar->core.border_width;
++    ctx->text.margin.bottom = ctx->text.r_margin.bottom;
++  }
+ /**/
+   PositionHScrollBar(ctx);
+   if (XtIsRealized((Widget)ctx)) {
+@@ -503,8 +505,10 @@ TextWidget ctx;
+   if (hbar == NULL) return;
+ 
+ /**/
+-  ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
+-  ctx->text.margin.bottom = ctx->text.r_margin.bottom;
++  if (ctx->text.scroll_vert == XawtextScrollAlways) {
++    ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
++    ctx->text.margin.bottom = ctx->text.r_margin.bottom;
++  }
+ /**/
+   if (ctx->text.vbar == NULL)
+       XtRemoveCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars,
+diff --git a/xc/lib/Xaw3d/Viewport.c b/xc/lib/Xaw3d/Viewport.c
+index 813cea6..c50d629 100644
+--- a/xc/lib/Xaw3d/Viewport.c
++++ b/xc/lib/Xaw3d/Viewport.c
+@@ -239,7 +239,7 @@ static void Initialize(request, new, args, num_args)
+     XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+     if (sw)
+     {
+-	pad = 2;
++	pad = 2 * sw;
+ 
+ 	arg_cnt = 0;
+ 	XtSetArg(threeD_args[arg_cnt], XtNborderWidth, 0); arg_cnt++;
+@@ -257,8 +257,8 @@ static void Initialize(request, new, args, num_args)
+     XtSetArg(clip_args[arg_cnt], XtNright, XtChainRight); arg_cnt++;
+     XtSetArg(clip_args[arg_cnt], XtNtop, XtChainTop); arg_cnt++;
+     XtSetArg(clip_args[arg_cnt], XtNbottom, XtChainBottom); arg_cnt++;
+-    XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width - 2 * sw); arg_cnt++;
+-    XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height - 2 * sw); arg_cnt++;
++    XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width - pad); arg_cnt++;
++    XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height - pad); arg_cnt++;
+ 
+     w->viewport.clip = XtCreateManagedWidget("clip", widgetClass, new,
+ 					     clip_args, arg_cnt);
+@@ -278,8 +278,8 @@ static void Initialize(request, new, args, num_args)
+  * Set the clip widget to the correct height.
+  */
+ 
+-    clip_width = w->core.width - 2 * sw;
+-    clip_height = w->core.height - 2 * sw;
++    clip_width = w->core.width - pad;
++    clip_height = w->core.height - pad;
+ 
+     if ( (h_bar != NULL) &&
+ 	 ((int)w->core.width >
+@@ -498,7 +498,6 @@ static void MoveChild(w, x, y)
+     RedrawThumbs(w);
+ }
+ 
+-
+ static void ComputeLayout(widget, query, destroy_scrollbars)
+     Widget widget;		/* Viewport */
+     Boolean query;		/* query child's preferred geom? */
+@@ -516,23 +515,13 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+     XtWidgetGeometry intended;
+     Dimension pad = 0, sw = 0;
+ 
+-    /*
+-     * I've made two optimizations here. The first does away with the
+-     * loop, and the second defers setting the child dimensions to the
+-     * clip if smaller until after adjusting for possible scrollbars.
+-     * If you find that these go too far, define the identifiers here
+-     * as required.  -- djhjr
+-     */
+-#define NEED_LAYOUT_LOOP
+-#undef PREP_CHILD_TO_CLIP
+-
+     if (child == (Widget) NULL) return;
+ 
+     XtVaGetValues(threeD, XtNshadowWidth, &sw, NULL);
+-    if (sw) pad = 2;
++    if (sw) pad = 2 * sw;
+ 
+-    clip_width = w->core.width - 2 * sw;
+-    clip_height = w->core.height - 2 * sw;
++    clip_width = w->core.width - pad;
++    clip_height = w->core.height - pad;
+     intended.request_mode = CWBorderWidth;
+     intended.border_width = 0;
+ 
+@@ -543,10 +532,8 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ 			     &clip_width, &clip_height);
+     }
+     else {
+-#ifdef NEED_LAYOUT_LOOP
+         Dimension prev_width, prev_height;
+ 	XtGeometryMask prev_mode;
+-#endif
+ 	XtWidgetGeometry preferred;
+ 
+ 	needshoriz = needsvert = False;
+@@ -560,31 +547,25 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ 	if (!w->viewport.allowhoriz) 
+ 	    intended.request_mode |= CWWidth;
+ 
+-#ifdef PREP_CHILD_TO_CLIP
+-	if ((int)child->core.width < clip_width) 
+-	    intended.width = clip_width;
++	if ((int)child->core.width < clip_width + pad)
++	    intended.width = clip_width + pad;
+ 	else
+-#endif
+ 	    intended.width = child->core.width;
+ 
+-	if (!w->viewport.allowvert) 
+-	    intended.request_mode |= CWHeight;
+-
+-#ifdef PREP_CHILD_TO_CLIP
+-	if ((int)child->core.height < clip_height) 
+-	    intended.height = clip_height;
++	if ((int)child->core.height < clip_height + pad)
++	    intended.height = clip_height + pad;
+ 	else
+-#endif
+ 	    intended.height = child->core.height;
+ 
++	if (!w->viewport.allowvert) 
++	    intended.request_mode |= CWHeight;
++
+ 	if (!query) {
+ 	    preferred.width = child->core.width;
+ 	    preferred.height = child->core.height;
+ 	}
+ 
+-#ifdef NEED_LAYOUT_LOOP
+ 	do { /* while intended != prev */
+-#endif
+ 	    if (query) {
+ 	        (void) XtQueryGeometry( child, &intended, &preferred );
+ 		if ( !(preferred.request_mode & CWWidth) )
+@@ -592,12 +573,9 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ 		if ( !(preferred.request_mode & CWHeight) )
+ 		    preferred.height = intended.height;
+ 	    }
+-
+-#ifdef NEED_LAYOUT_LOOP
+ 	    prev_width = intended.width;
+ 	    prev_height = intended.height;
+ 	    prev_mode = intended.request_mode;
+-#endif
+ 
+ 	    /*
+ 	     * Note that having once decided to turn on either bar
+@@ -607,7 +585,7 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ 
+ #define CheckHoriz()							\
+ 	    if (w->viewport.allowhoriz &&				\
+-		    (int)preferred.width > clip_width + 2 * sw) {	\
++		    (int)preferred.width > clip_width + pad) {		\
+ 		if (!needshoriz) {					\
+ 		    Widget bar = w->viewport.horiz_bar;			\
+ 		    needshoriz = True;					\
+@@ -622,7 +600,7 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ /* enddef */
+ 	    CheckHoriz();
+ 	    if (w->viewport.allowvert &&
+-		    (int)preferred.height > clip_height + 2 * sw) {
++		    (int)preferred.height > clip_height + pad) {
+ 		if (!needsvert) {
+ 		    Widget bar = w->viewport.vert_bar;
+ 		    needsvert = True;
+@@ -636,38 +614,22 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ 		intended.height = preferred.height;
+ 	    }
+ 
+-#ifdef PREP_CHILD_TO_CLIP
+ 	    if (!w->viewport.allowhoriz ||
+-		    (int)preferred.width < clip_width) {
+-	        intended.width = clip_width;
++		    (int)preferred.width < clip_width + pad) {
++	        intended.width = clip_width + pad;
+ 		intended.request_mode |= CWWidth;
+ 	    }
+ 	    if (!w->viewport.allowvert ||
+-		    (int)preferred.height < clip_height) {
+-	        intended.height = clip_height;
++		    (int)preferred.height < clip_height + pad) {
++	        intended.height = clip_height + pad;
+ 		intended.request_mode |= CWHeight;
+ 	    }
+-#endif
+-#ifdef NEED_LAYOUT_LOOP
++
+ 	} while ( intended.request_mode != prev_mode ||
+ 		  (intended.request_mode & CWWidth &&
+ 			intended.width != prev_width) ||
+ 		  (intended.request_mode & CWHeight &&
+ 			intended.height != prev_height) );
+-#endif
+-
+-#ifndef PREP_CHILD_TO_CLIP
+-	if (!w->viewport.allowhoriz ||
+-		(int)preferred.width < clip_width) {
+-	    intended.width = clip_width;
+-	    intended.request_mode |= CWWidth;
+-	}
+-	if (!w->viewport.allowvert ||
+-		(int)preferred.height < clip_height) {
+-	    intended.height = clip_height;
+-	    intended.request_mode |= CWHeight;
+-	}
+-#endif
+     }
+ 
+     bar_width = bar_height = 0;
+@@ -712,7 +674,7 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ 	else {
+ 	    int bw = bar->core.border_width;
+ 	    XtResizeWidget( bar,
+-			    (Dimension)(clip_width + 2 * sw), bar->core.height,
++			    (Dimension)(clip_width + pad), bar->core.height,
+ 			    (Dimension)bw );
+ 	    XtMoveWidget( bar,
+ 			  (Position)((needsvert && !w->viewport.useright)
+@@ -737,7 +699,7 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
+ 	else {
+ 	    int bw = bar->core.border_width;
+ 	    XtResizeWidget( bar,
+-			    bar->core.width, (Dimension)(clip_height + 2 * sw),
++			    bar->core.width, (Dimension)(clip_height + pad),
+ 			    (Dimension)bw );
+ 	    XtMoveWidget( bar,
+ 			  (Position)(w->viewport.useright
+@@ -790,7 +752,7 @@ int *clip_width, *clip_height;
+  */
+ 
+     XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+-    if (sw) pad = 2;
++    if (sw) pad = 2 * sw;
+ 
+     if (w->viewport.allowvert) {
+ 	if (w->viewport.vert_bar == NULL) 
+@@ -944,7 +906,7 @@ GeometryRequestPlusScrollbar(w, horizontal, request, reply_return)
+   Dimension pad = 0, sw = 0;
+ 
+   XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+-  if (sw) pad = 2;
++  if (sw) pad = 2 * sw;
+ 
+   plusScrollbars = *request;
+   if ((bar = w->viewport.horiz_bar) == (Widget)NULL)
+@@ -1017,7 +979,7 @@ static XtGeometryResult GeometryManager(child, request, reply)
+ 	return XtGeometryNo;
+ 
+     XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+-    if (sw) pad = 2;
++    if (sw) pad = 2 * sw;
+ 
+     allowed = *request;
+ 
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-null.patch b/Xaw3d-1.5E-null.patch
new file mode 100644
index 0000000..3c029bf
--- /dev/null
+++ b/Xaw3d-1.5E-null.patch
@@ -0,0 +1,88 @@
+From 3993a874007d8b99c4d9e55f10e556b2f90dc6a5 Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:54:55 +0200
+Subject: [PATCH] Xaw3d-1.5E-null.patch
+
+---
+ xc/lib/Xaw3d/XawIm.c |   16 ++++++++--------
+ 1 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/XawIm.c b/xc/lib/Xaw3d/XawIm.c
+index 0aeb9ac..2d6cf8d 100644
+--- a/xc/lib/Xaw3d/XawIm.c
++++ b/xc/lib/Xaw3d/XawIm.c
+@@ -674,7 +674,7 @@ static void SizeNegotiation(p, width, height)
+     SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
+ 
+     if (ic_cnt > 0) {
+-	XGetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]);
++	XGetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], NULL);
+ 	if (pe_attr) XFree(pe_attr);
+ 	if (st_attr) XFree(st_attr);
+ 	if (p->xic == NULL) {
+@@ -714,7 +714,7 @@ static void SizeNegotiation(p, width, height)
+ 	    SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
+ 	}
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
+-	XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]);
++	XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], NULL);
+ 	if (pe_attr) XFree(pe_attr);
+ 	if (st_attr) XFree(st_attr);
+ 	if (p->xic == NULL) {
+@@ -833,7 +833,7 @@ static void CreateIC( w, ve )
+ 				   pe_a[4], pe_a[5], pe_a[6], pe_a[7], pe_a[8],
+ 				   pe_a[9], pe_a[10], pe_a[11], pe_a[12],
+ 				   pe_a[13], pe_a[14], pe_a[15], pe_a[16],
+-				   pe_a[17], pe_a[18],  pe_a[19]);
++				   pe_a[17], pe_a[18],  NULL);
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
+     }
+@@ -844,7 +844,7 @@ static void CreateIC( w, ve )
+ 				   st_a[4], st_a[5], st_a[6], st_a[7], st_a[8],
+ 				   st_a[9], st_a[10], st_a[11], st_a[12],
+ 				   st_a[13], st_a[14], st_a[15], st_a[16],
+-				   st_a[17], st_a[18],  st_a[19]);
++				   st_a[17], st_a[18],  NULL);
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
+     }
+@@ -853,7 +853,7 @@ static void CreateIC( w, ve )
+     p->xic = XCreateIC(ve->im.xim, ic_a[0], ic_a[1], ic_a[2], ic_a[3],
+ 		       ic_a[4], ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9],
+ 		       ic_a[10], ic_a[11], ic_a[12], ic_a[13], ic_a[14],
+-		       ic_a[15], ic_a[16], ic_a[17], ic_a[18], ic_a[19]);
++		       ic_a[15], ic_a[16], ic_a[17], ic_a[18], NULL);
+     if (pe_attr) XtFree(pe_attr);
+     if (st_attr) XtFree(st_attr);
+ 
+@@ -973,7 +973,7 @@ static void SetICValues( w, ve, focus )
+ 				      pe_a[4], pe_a[5], pe_a[6], pe_a[7],
+ 				      pe_a[8], pe_a[9], pe_a[10], pe_a[11],
+ 				      pe_a[12], pe_a[13], pe_a[14], pe_a[15],
+-				      pe_a[16], pe_a[17], pe_a[18],  pe_a[19]);
++				      pe_a[16], pe_a[17], pe_a[18],  NULL);
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
+     }
+@@ -983,7 +983,7 @@ static void SetICValues( w, ve, focus )
+ 				      st_a[4], st_a[5], st_a[6], st_a[7],
+ 				      st_a[8], st_a[9], st_a[10], st_a[11],
+ 				      st_a[12], st_a[13], st_a[14], st_a[15],
+-				      st_a[16], st_a[17], st_a[18],  st_a[19]);
++				      st_a[16], st_a[17], st_a[18],  NULL);
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
+ 	SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
+     }
+@@ -996,7 +996,7 @@ static void SetICValues( w, ve, focus )
+ 	XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4],
+ 		     ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], ic_a[10],
+ 		     ic_a[11], ic_a[12], ic_a[13], ic_a[14], ic_a[15],
+-		     ic_a[16], ic_a[17], ic_a[18], ic_a[19]);
++		     ic_a[16], ic_a[17], ic_a[18], NULL);
+ 	if (pe_attr) XtFree(pe_attr);
+ 	if (st_attr) XtFree(st_attr);
+     }
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-secure.patch b/Xaw3d-1.5E-secure.patch
new file mode 100644
index 0000000..aa72c2c
--- /dev/null
+++ b/Xaw3d-1.5E-secure.patch
@@ -0,0 +1,557 @@
+From 2094de170afa65b057bca4a1e9d38ca7ae656265 Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 17:02:15 +0200
+Subject: [PATCH] Xaw3d-1.5E-secure.patch
+
+---
+ xc/lib/Xaw3d/AsciiSrcP.h  |    6 +++-
+ xc/lib/Xaw3d/Layout.c     |   18 +++++++++--
+ xc/lib/Xaw3d/MenuButton.c |   15 +++++++--
+ xc/lib/Xaw3d/MultiSrcP.h  |    6 +++-
+ xc/lib/Xaw3d/Simple.c     |   18 ++++++++---
+ xc/lib/Xaw3d/SimpleMenu.c |   16 ++++++++--
+ xc/lib/Xaw3d/SmeBSB.c     |   51 +++++++++++++++++++++-----------
+ xc/lib/Xaw3d/Text.c       |   50 +++++++++++++++++++++++--------
+ xc/lib/Xaw3d/TextPop.c    |   71 ++++++++++++++++++++++++++++++++++++++-------
+ xc/lib/Xaw3d/XawAlloc.h   |   10 ++++++
+ xc/lib/Xaw3d/XawI18n.h    |    2 +
+ xc/lib/Xaw3d/XawIm.c      |    4 +-
+ 12 files changed, 206 insertions(+), 61 deletions(-)
+ create mode 100644 xc/lib/Xaw3d/XawAlloc.h
+
+diff --git a/xc/lib/Xaw3d/AsciiSrcP.h b/xc/lib/Xaw3d/AsciiSrcP.h
+index dcb33ff..30ba992 100644
+--- a/xc/lib/Xaw3d/AsciiSrcP.h
++++ b/xc/lib/Xaw3d/AsciiSrcP.h
+@@ -85,7 +85,11 @@ SOFTWARE.
+ #ifdef L_tmpnam
+ #define TMPSIZ L_tmpnam
+ #else
+-#define TMPSIZ 32		/* bytes to allocate for tmpnam */
++#ifdef PATH_MAX
++#define TMPSIZ PATH_MAX
++#else
++#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
++#endif
+ #endif
+ 
+ #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */
+diff --git a/xc/lib/Xaw3d/Layout.c b/xc/lib/Xaw3d/Layout.c
+index 44d391a..dd4b253 100644
+--- a/xc/lib/Xaw3d/Layout.c
++++ b/xc/lib/Xaw3d/Layout.c
+@@ -39,6 +39,8 @@
+ # include <X11/Xaw3d/LayoutP.h>
+ #endif
+ 
++#include "XawAlloc.h"
++
+ #include <ctype.h>
+ #include <stdio.h>
+ 
+@@ -595,10 +597,18 @@ Evaluate (l, box, expr, natural)
+ 	nexpr = LookupVariable (box, expr->u.variable);
+ 	if (!nexpr)
+ 	    {
+-	    char    buf[256];
+-	    (void) sprintf (buf, "Layout: undefined variable %s\n",
+-			    XrmQuarkToString (expr->u.variable));
+-	    XtError (buf);
++	    char *pvar = XrmQuarkToString (expr->u.variable);
++	    char *msg = "Layout: undefined variable ";
++	    int len = strlen(msg) + strlen(pvar) + 2;
++	    char *pbuf, buf[256];
++
++	    pbuf = XtStackAlloc(len, buf);
++	    if (pbuf != NULL)
++		{
++		sprintf(pbuf, "%s%s\n", msg, pvar);
++		XtError (buf);
++		XtStackFree(pbuf, buf);
++		}
+ 	    return 0.0;
+ 	    }
+ 	return Evaluate (l, box, nexpr, natural);
+diff --git a/xc/lib/Xaw3d/MenuButton.c b/xc/lib/Xaw3d/MenuButton.c
+index b96a027..493ff76 100644
+--- a/xc/lib/Xaw3d/MenuButton.c
++++ b/xc/lib/Xaw3d/MenuButton.c
+@@ -53,6 +53,8 @@ in this Software without prior written authorization from the X Consortium.
+ #include <X11/Xaw3d/XawInit.h>
+ #include <X11/Xaw3d/MenuButtoP.h>
+ 
++#include "XawAlloc.h"
++
+ static void ClassInitialize();
+ static void PopupMenu();
+ 
+@@ -179,9 +181,16 @@ Cardinal * num_params;
+ 
+   if (menu == NULL) {
+     char error_buf[BUFSIZ];
+-    (void) sprintf(error_buf, "MenuButton: %s %s.",
+-	    "Could not find menu widget named", mbw->menu_button.menu_name);
+-    XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
++    char *err1 = "MenuButton: Could not find menu widget named ";
++    char *perr;
++    int len;
++
++    len = strlen(err1) + strlen(mbw->menu_button.menu_name) + 1 + 1;
++    perr = XtStackAlloc(len, error_buf);
++    if (perr == NULL) return;
++    sprintf(perr, "%s%s.", err1, mbw->menu_button.menu_name);
++    XtAppWarning(XtWidgetToApplicationContext(w), perr);
++    XtStackFree(perr, error_buf);
+     return;
+   }
+   if (!XtIsRealized(menu))
+diff --git a/xc/lib/Xaw3d/MultiSrcP.h b/xc/lib/Xaw3d/MultiSrcP.h
+index 6996361..9c98a1d 100644
+--- a/xc/lib/Xaw3d/MultiSrcP.h
++++ b/xc/lib/Xaw3d/MultiSrcP.h
+@@ -113,7 +113,11 @@ SOFTWARE.
+ #ifdef L_tmpnam
+ #define TMPSIZ L_tmpnam
+ #else
+-#define TMPSIZ 32		/* bytes to allocate for tmpnam */
++#ifdef PATH_MAX
++#define TMPSIZ PATH_MAX
++#else
++#define TMPSIZ 1024		/* bytes to allocate for tmpnam */
++#endif
+ #endif
+ 
+ #define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */
+diff --git a/xc/lib/Xaw3d/Simple.c b/xc/lib/Xaw3d/Simple.c
+index 29cbbc8..8051030 100644
+--- a/xc/lib/Xaw3d/Simple.c
++++ b/xc/lib/Xaw3d/Simple.c
+@@ -56,6 +56,8 @@ SOFTWARE.
+ #include <X11/Xaw3d/SimpleP.h>
+ #include <X11/Xmu/Drawing.h>
+ 
++#include "XawAlloc.h"
++
+ #define offset(field) XtOffsetOf(SimpleRec, simple.field)
+ 
+ static XtResource resources[] = {
+@@ -148,11 +150,17 @@ static void ClassPartInitialize(class)
+ 
+     if (c->simple_class.change_sensitive == NULL) {
+ 	char buf[BUFSIZ];
+-
+-	(void) sprintf(buf,
+-		"%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.",
+-		c->core_class.class_name);
+-	XtWarning(buf);
++	char *pbuf;
++	char *msg1 = " Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.";
++	int len;
++
++	len = strlen(msg1) + strlen(c->core_class.class_name) + 1;
++	pbuf = XtStackAlloc(len, buf);
++	if (pbuf != NULL) {
++	    sprintf(pbuf, "%s%s", c->core_class.class_name, msg1);
++	    XtWarning(pbuf);
++	    XtStackFree(pbuf, buf);
++	}
+ 	c->simple_class.change_sensitive = ChangeSensitive;
+     }
+ 
+diff --git a/xc/lib/Xaw3d/SimpleMenu.c b/xc/lib/Xaw3d/SimpleMenu.c
+index 87a3170..2bf439d 100644
+--- a/xc/lib/Xaw3d/SimpleMenu.c
++++ b/xc/lib/Xaw3d/SimpleMenu.c
+@@ -51,6 +51,8 @@ in this Software without prior written authorization from the X Consortium.
+ #include <X11/Xmu/Initer.h>
+ #include <X11/Xmu/CharSet.h>
+ 
++#include "XawAlloc.h"
++
+ #define streq(a, b)        ( strcmp((a), (b)) == 0 )
+ 
+ #define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field)
+@@ -755,9 +757,17 @@ Cardinal * num_params;
+ 
+   if ( (menu = FindMenu(w, params[0])) == NULL) {
+     char error_buf[BUFSIZ];
+-    (void) sprintf(error_buf, "%s '%s'",
+-	    "Xaw - SimpleMenuWidget: could not find menu named: ", params[0]);
+-    XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
++    char *err1 = "Xaw - SimpleMenuWidget: could not find menu named: ";
++    char *perr;
++    int len;
++
++    len = strlen(err1) + strlen(params[0]) + 2 + 1;
++    perr = XtStackAlloc(len, error_buf);
++    if (perr == NULL)
++	return;
++    sprintf(perr, "%s'%s'", err1, params[0]);
++    XtAppWarning(XtWidgetToApplicationContext(w), perr);
++    XtStackFree(perr, error_buf);
+     return;
+   }
+   
+diff --git a/xc/lib/Xaw3d/SmeBSB.c b/xc/lib/Xaw3d/SmeBSB.c
+index 64251e4..abf811f 100644
+--- a/xc/lib/Xaw3d/SmeBSB.c
++++ b/xc/lib/Xaw3d/SmeBSB.c
+@@ -51,6 +51,7 @@ in this Software without prior written authorization from the X Consortium.
+ #include <X11/Xaw3d/SmeBSBP.h>
+ #include <X11/Xaw3d/Cardinals.h>
+ #include <stdio.h>
++#include "XawAlloc.h"
+ 
+ /* needed for abs() */
+ #ifndef X_NOT_STDC_ENV
+@@ -712,6 +713,8 @@ Boolean is_left;
+     int x, y;
+     unsigned int width, height, bw;
+     char buf[BUFSIZ];
++    char *pbuf;
++    int len;
+     
+     if (is_left) {
+ 	width = height = 0;
+@@ -720,18 +723,24 @@ Boolean is_left;
+ 	    if (!XGetGeometry(XtDisplayOfObject(w), 
+ 			    entry->sme_bsb.left_bitmap, &root, &x, &y,
+ 			    &width, &height, &bw, &entry->sme_bsb.left_depth)) {
+-		(void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".",
+-			"Could not get Left Bitmap",
+-			"geometry information for menu entry",
+-			XtName(w));
+-		XtAppError(XtWidgetToApplicationContext(w), buf);
++		char *err1 = "Xaw SmeBSB Object: Could not get Left Bitmap geometry information for menu entry ";
++		len = strlen(err1) + strlen(XtName(w)) + 3 + 1;
++		pbuf = XtStackAlloc(len, buf);
++		if (pbuf == NULL) return;
++		sprintf(pbuf, "%s\"%s\".", err1, XtName(w));
++		XtAppError(XtWidgetToApplicationContext(w), pbuf);
++		XtStackFree(pbuf, buf);
+ 	    }
+ #ifdef NEVER
+ 	    if (entry->sme_bsb.left_depth != 1) {
+-		(void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", 
+-			"Left Bitmap of entry",  XtName(w),
+-			"is not one bit deep");
+-		XtAppError(XtWidgetToApplicationContext(w), buf);
++		char *err1 = "Xaw SmeBSB Object: Left Bitmap of entry ";
++		char *err2 = " is not one bit deep.";
++		len = strlen(err1) + strlen(err2) + strlen(XtName(w)) + 2 + 1;
++		pbuf = XtStackAlloc(len, buf);
++		if (pbuf == NULL) return;
++		sprintf(pbuf, "%s\"%s\"%s", err1, XtName(w), err2);
++		XtAppError(XtWidgetToApplicationContext(w), pbuf);
++		XtStackFree(pbuf, buf);
+ 	    }
+ #endif
+ 	}
+@@ -745,18 +754,24 @@ Boolean is_left;
+ 	    if (!XGetGeometry(XtDisplayOfObject(w),
+ 			    entry->sme_bsb.right_bitmap, &root, &x, &y,
+ 			    &width, &height, &bw, &entry->sme_bsb.right_depth)) {
+-		(void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".",
+-			"Could not get Right Bitmap",
+-			"geometry information for menu entry",
+-			XtName(w));
+-		XtAppError(XtWidgetToApplicationContext(w), buf);
++		char *err1 = "Xaw SmeBSB Object: Could not get Right Bitmap geometry information for menu entry ";
++		len = strlen(err1) + strlen(XtName(w)) + 3 + 1;
++		pbuf = XtStackAlloc(len, buf);
++		if (pbuf == NULL) return;
++		sprintf(pbuf, "%s\"%s\".", err1, XtName(w));
++		XtAppError(XtWidgetToApplicationContext(w), pbuf);
++		XtStackFree(pbuf, buf);
+ 	    }
+ #ifdef NEVER
+ 	    if (entry->sme_bsb.right_depth != 1) {
+-		(void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", 
+-			"Right Bitmap of entry", XtName(w),
+-			"is not one bit deep");
+-		XtAppError(XtWidgetToApplicationContext(w), buf);
++		char *err1 = "Xaw SmeBSB Object: Right Bitmap of entry ";
++		char *err2 = " is not one bit deep.";
++		len = strlen(err1) + strlen(err2) + strlen(XtName(w)) + 2 + 1;
++		pbuf = XtStackAlloc(len, buf);
++		if (pbuf == NULL) return;
++		sprintf(pbuf, "%s\"%s\"%s", err1, XtName(w), err2);
++		XtAppError(XtWidgetToApplicationContext(w), pbuf);
++		XtStackFree(pbuf, buf);
+ 	    }
+ #endif
+ 	}
+diff --git a/xc/lib/Xaw3d/Text.c b/xc/lib/Xaw3d/Text.c
+index 3c48a4c..32a3f8d 100644
+--- a/xc/lib/Xaw3d/Text.c
++++ b/xc/lib/Xaw3d/Text.c
+@@ -76,6 +76,8 @@ SOFTWARE.
+ #include <ctype.h>		/* for isprint() */
+ #include <stdlib.h>		/* for abs() */
+ 
++#include "XawAlloc.h"
++
+ #ifndef MAX_LEN_CT
+ #define MAX_LEN_CT 6		/* for sequence: ESC $ ( A \xx \xx */
+ #endif
+@@ -520,7 +522,8 @@ Cardinal *num_args;		/* unused */
+ {
+   TextWidget ctx = (TextWidget) new;
+   char error_buf[BUFSIZ];
+-  int s;
++  char *perr;
++  int s, len;
+ 
+   ctx->text.threeD = XtVaCreateWidget("threeD", threeDWidgetClass, new,
+                                  XtNx, 0, XtNy, 0,
+@@ -569,10 +572,17 @@ Cardinal *num_args;		/* unused */
+   if (ctx->text.scroll_vert != XawtextScrollNever) 
+     if ( (ctx->text.resize == XawtextResizeHeight) ||
+      	 (ctx->text.resize == XawtextResizeBoth) ) {
+-      (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
+-	      "Vertical scrolling not allowed with height resize.\n",
+-	      "Vertical scrolling has been DEACTIVATED.");
+-      XtAppWarning(XtWidgetToApplicationContext(new), error_buf);
++      char *err1 = "Xaw Text Widget ";
++      char *err2 = ":\nVertical scrolling not allowed with height resize.\n";
++      char *err3 = "Vertical scrolling has been DEACTIVATED.";
++      len = strlen(err1) + strlen(err2) + strlen(err3) +
++		strlen(ctx->core.name) + 1;
++      perr = XtStackAlloc(len, error_buf);
++      if (perr != NULL) {
++	(void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3);
++	XtAppWarning(XtWidgetToApplicationContext(new), perr);
++	XtStackFree(perr, error_buf);
++      }
+       ctx->text.scroll_vert = XawtextScrollNever;
+     }
+     else if (ctx->text.scroll_vert == XawtextScrollAlways)
+@@ -580,18 +590,32 @@ Cardinal *num_args;		/* unused */
+ 
+   if (ctx->text.scroll_horiz != XawtextScrollNever) 
+     if (ctx->text.wrap != XawtextWrapNever) {
+-      (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
+-	      "Horizontal scrolling not allowed with wrapping active.\n",
+-	      "Horizontal scrolling has been DEACTIVATED.");
+-      XtAppWarning(XtWidgetToApplicationContext(new), error_buf);
++      char *err1 = "Xaw Text Widget ";
++      char *err2 = ":\nHorizontal scrolling not allowed with wrapping active.";
++      char *err3 = "\nHorizontal scrolling has been DEACTIVATED.";
++      len = strlen(err1) + strlen(err2) + strlen(err3) +
++		strlen(ctx->core.name) + 1;
++      perr = XtStackAlloc(len, error_buf);
++      if (perr != NULL) {
++	(void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3);
++	XtAppWarning(XtWidgetToApplicationContext(new), perr);
++	XtStackFree(perr, error_buf);
++      }
+       ctx->text.scroll_horiz = XawtextScrollNever;
+     }
+     else if ( (ctx->text.resize == XawtextResizeWidth) ||
+ 	      (ctx->text.resize == XawtextResizeBoth) ) {
+-      (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
+-	      "Horizontal scrolling not allowed with width resize.\n",
+-	      "Horizontal scrolling has been DEACTIVATED.");
+-      XtAppWarning(XtWidgetToApplicationContext(new), error_buf);
++      char *err1 = "Xaw Text Widget ";
++      char *err2 = ":\nHorizontal scrolling not allowed with width resize.\n";
++      char *err3 = "Horizontal scrolling has been DEACTIVATED.";
++      len = strlen(err1) + strlen(err2) + strlen(err3) +
++		strlen(ctx->core.name) + 1;
++      perr = XtStackAlloc(len, error_buf);
++      if (perr != NULL) {
++	(void) sprintf(perr, "%s%s%s%s", err1, ctx->core.name, err2, err3);
++	XtAppWarning(XtWidgetToApplicationContext(new), perr);
++	XtStackFree(perr, error_buf);
++      }
+       ctx->text.scroll_horiz = XawtextScrollNever;
+     }
+     else if (ctx->text.scroll_horiz == XawtextScrollAlways)
+diff --git a/xc/lib/Xaw3d/TextPop.c b/xc/lib/Xaw3d/TextPop.c
+index 260b4dc..cf01b4f 100644
+--- a/xc/lib/Xaw3d/TextPop.c
++++ b/xc/lib/Xaw3d/TextPop.c
+@@ -66,6 +66,8 @@ in this Software without prior written authorization from the X Consortium.
+ #include <X11/Xos.h>		/* for O_RDONLY */
+ #include <errno.h>
+ 
++#include "XawAlloc.h"
++
+ #ifdef X_NOT_STDC_ENV
+ extern int errno;
+ #endif
+@@ -809,6 +811,8 @@ DoSearch(search)
+ struct SearchAndReplace * search;
+ {
+   char msg[BUFSIZ];
++  char *pmsg;
++  int len;
+   Widget tw = XtParent(search->search_popup);
+   XawTextPosition pos;
+   XawTextScanDirection dir;
+@@ -835,9 +839,20 @@ struct SearchAndReplace * search;
+    /* The Raw string in find.ptr may be WC I can't use here, so I re - call 
+    GetString to get a tame version. */
+ 
+-  if (pos == XawTextSearchError) 
+-    (void) sprintf( msg, "Could not find string ``%s''.", GetString( search->search_text ) );
+-  else {
++  if (pos == XawTextSearchError) {
++    char *msg1 = "Could not find string ``";
++    char *msg2 = "''.";
++    len = strlen(msg1) + strlen(msg2) +
++		strlen(GetString( search->search_text )) + 1;
++    pmsg = XtStackAlloc(len, msg);
++    if (pmsg != NULL) {
++      (void) sprintf( pmsg, "%s%s%s", msg1, GetString( search->search_text ),
++			msg2);
++    } else {
++      pmsg = msg;
++      (void) sprintf( pmsg, "Could not find string");
++    }
++  } else {
+     if (dir == XawsdRight)
+       XawTextSetInsertionPoint( tw, pos + text.length);
+     else
+@@ -849,7 +864,8 @@ struct SearchAndReplace * search;
+   }
+   
+   XawTextUnsetSelection(tw);
+-  SetSearchLabels(search, msg, "", TRUE);
++  SetSearchLabels(search, pmsg, "", TRUE);
++  XtStackFree(pmsg, msg);
+   return(FALSE);
+ }
+ 
+@@ -982,13 +998,26 @@ Boolean once_only, show_current;
+       if ( (new_pos == XawTextSearchError) ) {
+ 	if (count == 0) {
+ 	  char msg[BUFSIZ];
++	  char *pmsg;
++	  int len;
++	  char *msg1 = "*** Error: Could not find string ``";
++	  char *msg2 = "''. ***";
+ 
+              /* The Raw string in find.ptr may be WC I can't use here, 
+ 		so I call GetString to get a tame version.*/
+ 
+-	  (void) sprintf( msg, "%s %s %s", "*** Error: Could not find string ``",
+-		  GetString( search->search_text ), "''. ***");
+-	  SetSearchLabels(search, msg, "", TRUE);
++	  len = strlen(msg1) + strlen(msg2) +
++		strlen(GetString( search->search_text )) + 1;
++	  pmsg = XtStackAlloc(len, msg);
++	  if (pmsg != NULL) {
++	    (void) sprintf( pmsg, "%s%s%s", msg1,
++				GetString( search->search_text ), msg2);
++	  } else {
++	    pmsg = msg;
++	    (void) sprintf(pmsg, "*** Error: Could not find string ***");
++	  }
++	  SetSearchLabels(search, pmsg, "", TRUE);
++	  XtStackFree(pmsg, msg);
+ 	  return(FALSE);
+ 	}
+ 	else
+@@ -1011,9 +1040,22 @@ Boolean once_only, show_current;
+ 
+     if (XawTextReplace(tw, pos, end_pos, &replace) != XawEditDone) {
+       char msg[BUFSIZ];
+-      
+-      (void) sprintf( msg, "'%s' with '%s'. ***", find.ptr, replace.ptr);
++      char *pmsg;
++      int len;
++      char *msg1 = "' with '";
++      char *msg2 = "'. ***";
++
++      len = 1 + strlen(msg1) + strlen(msg2) + strlen(find.ptr) +
++		strlen(replace.ptr) + 1;
++      pmsg = XtStackAlloc(len, msg);
++      if (pmsg != NULL) {
++	(void) sprintf( pmsg, "`%s%s%s%s", find.ptr, msg1, replace.ptr, msg2);
++      } else {
++	pmsg = msg;
++	(void) sprintf(pmsg, "string ***");
++      }
+       SetSearchLabels(search, "*** Error while replacing", msg, TRUE);
++      XtStackFree(pmsg, msg);
+       return(FALSE);
+     }      
+ 
+@@ -1164,13 +1206,20 @@ XtArgVal value;
+ {
+   Widget temp_widget;
+   char buf[BUFSIZ];
++  char *pbuf;
++  int len;
+ 
+-  (void) sprintf(buf, "%s.%s", FORM_NAME, name);
++  len = strlen(FORM_NAME) + strlen(name) + 2;
++  pbuf = XtStackAlloc(len, buf);
++  if (pbuf == NULL) return FALSE;
++  (void) sprintf(pbuf, "%s.%s", FORM_NAME, name);
+ 
+-  if ( (temp_widget = XtNameToWidget(shell, buf)) != NULL) {
++  if ( (temp_widget = XtNameToWidget(shell, pbuf)) != NULL) {
+     SetResource(temp_widget, res_name, value);
++    XtStackFree(pbuf, buf);
+     return(TRUE);
+   }
++  XtStackFree(pbuf, buf);
+   return(FALSE);
+ }
+ 
+diff --git a/xc/lib/Xaw3d/XawAlloc.h b/xc/lib/Xaw3d/XawAlloc.h
+new file mode 100644
+index 0000000..ed0fe90
+--- /dev/null
++++ b/xc/lib/Xaw3d/XawAlloc.h
+@@ -0,0 +1,10 @@
++/* $XFree86: xc/lib/Xaw/XawAlloc.h,v 1.1.2.1 1998/05/16 09:05:23 dawes Exp $ */
++
++#define XtStackAlloc(size, stack_cache_array)     \
++    ((size) <= sizeof(stack_cache_array)          \
++    ?  (XtPointer)(stack_cache_array)             \
++    :  XtMalloc((unsigned)(size)))
++     
++#define XtStackFree(pointer, stack_cache_array) \
++    if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); else
++
+diff --git a/xc/lib/Xaw3d/XawI18n.h b/xc/lib/Xaw3d/XawI18n.h
+index 1b0ee5d..b0176bf 100644
+--- a/xc/lib/Xaw3d/XawI18n.h
++++ b/xc/lib/Xaw3d/XawI18n.h
+@@ -29,11 +29,13 @@ in this Software without prior written authorization from the X Consortium.
+ 
+ #ifdef HAS_WCTYPE_H
+ #include <wctype.h>
++#ifndef NO_WIDEC_H
+ #include <widec.h>
+ #define wcslen(c) wslen(c)
+ #define wcscpy(d,s) wscpy(d,s)
+ #define wcsncpy(d,s,l) wsncpy(d,s,l)
+ #endif
++#endif
+ 
+ #ifdef HAS_WCHAR_H
+ #include <wchar.h>
+diff --git a/xc/lib/Xaw3d/XawIm.c b/xc/lib/Xaw3d/XawIm.c
+index 730c393..a5d0032 100644
+--- a/xc/lib/Xaw3d/XawIm.c
++++ b/xc/lib/Xaw3d/XawIm.c
+@@ -1644,10 +1644,10 @@ _XawImWcLookupString( inwidg, event, buffer_return, bytes_buffer,
+ 
+     if ((vw = SearchVendorShell(inwidg)) && (ve = GetExtPart(vw)) &&
+ 	ve->im.xim && (p = GetIcTableShared(inwidg, ve)) && p->xic) {
+-	  return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer,
++	  return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer/sizeof(wchar_t),
+ 				 keysym_return, status_return));
+     }
+-    ret = XLookupString( event, tmp_buf, 64, keysym_return,
++    ret = XLookupString( event, tmp_buf, sizeof(tmp_buf), keysym_return,
+ 		         (XComposeStatus*) status_return );
+     for ( i = 0, tmp_p = tmp_buf, buf_p = buffer_return; i < ret; i++ ) {
+ 	*buf_p++ = _Xaw_atowc(*tmp_p++);
+-- 
+1.6.1
+
diff --git a/Xaw3d-1.5E-thumb.patch b/Xaw3d-1.5E-thumb.patch
new file mode 100644
index 0000000..9027384
--- /dev/null
+++ b/Xaw3d-1.5E-thumb.patch
@@ -0,0 +1,1747 @@
+From 56c87e83f85e1c850702557936421f8181a30481 Mon Sep 17 00:00:00 2001
+From: Markus Steinborn <gnugv_maintainer at yahoo.de>
+Date: Sat, 24 Apr 2010 16:53:10 +0200
+Subject: [PATCH] Xaw3d-1.5E-thumb.patch
+
+---
+ xc/lib/Xaw3d/AsciiSink.c  |    6 +-
+ xc/lib/Xaw3d/Form.c       |    2 +-
+ xc/lib/Xaw3d/Layout.c     |    2 +-
+ xc/lib/Xaw3d/MultiSink.c  |    6 +-
+ xc/lib/Xaw3d/Paned.c      |   27 ++-
+ xc/lib/Xaw3d/Panner.c     |    2 +-
+ xc/lib/Xaw3d/Scrollbar.c  |  627 +++++++++++++++++++++++++++++++-------------
+ xc/lib/Xaw3d/Scrollbar.h  |    6 +
+ xc/lib/Xaw3d/ScrollbarP.h |    7 +-
+ xc/lib/Xaw3d/SimpleMenu.c |    3 +-
+ xc/lib/Xaw3d/SmeThreeD.c  |   20 +-
+ xc/lib/Xaw3d/SmeThreeD.h  |    3 +
+ xc/lib/Xaw3d/SmeThreeDP.h |    1 +
+ xc/lib/Xaw3d/StripChart.c |   43 ++--
+ xc/lib/Xaw3d/Text.c       |    6 +-
+ xc/lib/Xaw3d/TextAction.c |    1 +
+ xc/lib/Xaw3d/TextPop.c    |    3 +-
+ xc/lib/Xaw3d/ThreeD.c     |   19 +-
+ xc/lib/Xaw3d/ThreeD.h     |    3 +
+ xc/lib/Xaw3d/ThreeDP.h    |    1 +
+ xc/lib/Xaw3d/Toggle.c     |    3 +-
+ xc/lib/Xaw3d/Viewport.c   |    6 +-
+ xc/lib/Xaw3d/XawI18n.c    |    3 +
+ xc/lib/Xaw3d/XawI18n.h    |    2 +
+ xc/lib/Xaw3d/XawIm.c      |    5 +-
+ 25 files changed, 565 insertions(+), 242 deletions(-)
+
+diff --git a/xc/lib/Xaw3d/AsciiSink.c b/xc/lib/Xaw3d/AsciiSink.c
+index b427c80..2ebd952 100644
+--- a/xc/lib/Xaw3d/AsciiSink.c
++++ b/xc/lib/Xaw3d/AsciiSink.c
+@@ -174,13 +174,14 @@ unsigned char c;
+ 	return 0;
+     }
+ 
+-    if ( (nonPrinting = (c < (unsigned char) XawSP)) )
++    if ( (nonPrinting = (c < (unsigned char) XawSP)) ) {
+ 	if (sink->ascii_sink.display_nonprinting)
+ 	    c += '@';
+ 	else {
+ 	    c = XawSP;
+ 	    nonPrinting = False;
+ 	}
++    }
+ 
+     if (font->per_char &&
+ 	    (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
+@@ -661,12 +662,13 @@ short *tabs;
+   XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE);
+   if ( (XA_FIGURE_WIDTH != None) && 
+        ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) ||
+-	 (figure_width == 0)) ) 
++	 (figure_width == 0)) ) {
+     if (font->per_char && font->min_char_or_byte2 <= '$' &&
+ 	font->max_char_or_byte2 >= '$')
+       figure_width = font->per_char['$' - font->min_char_or_byte2].width;
+     else
+       figure_width = font->max_bounds.width;
++  }
+ 
+   if (tab_count > sink->text_sink.tab_count) {
+     sink->text_sink.tabs = (Position *)
+diff --git a/xc/lib/Xaw3d/Form.c b/xc/lib/Xaw3d/Form.c
+index c4eae4b..d628618 100644
+--- a/xc/lib/Xaw3d/Form.c
++++ b/xc/lib/Xaw3d/Form.c
+@@ -780,7 +780,7 @@ static XtGeometryResult PreferredGeometry( widget, request, reply  )
+     reply->width = w->form.preferred_width;
+     reply->height = w->form.preferred_height;
+     reply->request_mode = CWWidth | CWHeight;
+-    if (  request->request_mode & (CWWidth | CWHeight) ==
++    if ( (request->request_mode & (CWWidth | CWHeight)) ==
+ 	    (CWWidth | CWHeight)
+ 	  && request->width == reply->width
+ 	  && request->height == reply->height)
+diff --git a/xc/lib/Xaw3d/Layout.c b/xc/lib/Xaw3d/Layout.c
+index dd4b253..497b9c2 100644
+--- a/xc/lib/Xaw3d/Layout.c
++++ b/xc/lib/Xaw3d/Layout.c
+@@ -539,7 +539,7 @@ Evaluate (l, box, expr, natural)
+     ExprPtr	    expr;
+     double	    natural;
+ {
+-    double	left, right, down;
++    double	left = 0.0, right = 0.0, down = 0.0;
+     Widget	widget;
+     SubInfoPtr	info;
+ 
+diff --git a/xc/lib/Xaw3d/MultiSink.c b/xc/lib/Xaw3d/MultiSink.c
+index 204470f..d8aac3f 100644
+--- a/xc/lib/Xaw3d/MultiSink.c
++++ b/xc/lib/Xaw3d/MultiSink.c
+@@ -204,12 +204,13 @@ CharWidth (w, x, c)
+ 	return 0;
+     }
+ 
+-    if (XwcTextEscapement (fontset, &c, 1) == 0)
++    if (XwcTextEscapement (fontset, &c, 1) == 0) {
+ 	if (sink->multi_sink.display_nonprinting)
+ 	    c = _Xaw_atowc('@');
+ 	else {
+ 	    c = _Xaw_atowc(XawSP);
+ 	}
++    }
+ 
+     /*
+      * if more efficiency(suppose one column is one ASCII char)
+@@ -731,12 +732,13 @@ SetTabs( w, tab_count, tabs )
+   XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE);
+   if ( (XA_FIGURE_WIDTH != None) && 
+        ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) ||
+-	 (figure_width == 0)) ) 
++	 (figure_width == 0)) ) {
+     if (font->per_char && font->min_char_or_byte2 <= '$' &&
+ 	font->max_char_or_byte2 >= '$')
+       figure_width = font->per_char['$' - font->min_char_or_byte2].width;
+     else
+       figure_width = font->max_bounds.width;
++  }
+ 
+   if (tab_count > sink->text_sink.tab_count) {
+     sink->text_sink.tabs = (Position *)
+diff --git a/xc/lib/Xaw3d/Paned.c b/xc/lib/Xaw3d/Paned.c
+index babd492..adbbc77 100644
+--- a/xc/lib/Xaw3d/Paned.c
++++ b/xc/lib/Xaw3d/Paned.c
+@@ -1157,12 +1157,14 @@ PanedWidget pw;
+    managedP = managed_grips = (WidgetList) XtMalloc(alloc_size);
+    unmanagedP = unmanaged_grips = (WidgetList) XtMalloc(alloc_size);
+ 
+-   ForAllChildren(pw, childP) 
+-       if (IsPane(*childP) && HasGrip(*childP))
++   ForAllChildren(pw, childP) {
++       if (IsPane(*childP) && HasGrip(*childP)) {
+ 	   if ( XtIsManaged(*childP) ) 
+ 	       *managedP++ = PaneInfo(*childP)->grip;
+ 	   else
+ 	       *unmanagedP++ = PaneInfo(*childP)->grip;
++       }
++   }
+    
+    if (managedP != managed_grips) {
+        *unmanagedP++ = *--managedP;   /* Last grip is never managed */
+@@ -1194,11 +1196,12 @@ Widget child;
+      
+     XtSetArg(arglist[num_args], XtNtranslations, pw->paned.grip_translations);
+     num_args++;
+-    if ( (cursor = pw->paned.grip_cursor) == None )
++    if ( (cursor = pw->paned.grip_cursor) == None ) {
+         if (IsVert(pw))
+ 	    cursor = pw->paned.v_grip_cursor;
+ 	else
+ 	    cursor = pw->paned.h_grip_cursor;
++    }
+ 
+     XtSetArg(arglist[num_args], XtNcursor, cursor);
+     num_args++;
+@@ -1310,11 +1313,12 @@ PanedWidget pw;
+ 	Arg arglist[1];
+ 	Cursor cursor;
+       
+-	if ( (cursor = pw->paned.grip_cursor) == None )
++	if ( (cursor = pw->paned.grip_cursor) == None ) {
+ 	    if ( IsVert(pw) )
+ 	        cursor = pw->paned.v_grip_cursor;
+ 	    else
+ 	        cursor = pw->paned.h_grip_cursor;
++	}
+ 
+ 	if (HasGrip (*childP)) {
+ 	    XtSetArg(arglist[0], XtNcursor, cursor);
+@@ -1489,11 +1493,12 @@ XtWidgetGeometry *request, *reply;
+  * a different on_size;
+  */
+ 
+-    if (result != XtGeometryNo) 
++    if (result != XtGeometryNo) {
+ 	if (vert) 
+ 	    pw->core.height = on_size;
+ 	else 
+ 	    pw->core.width = on_size;
++    }
+     
+     RefigureLocations(pw, PaneIndex(w), AnyPane);
+ 
+@@ -1524,11 +1529,12 @@ XtWidgetGeometry *request, *reply;
+  * THEN: set almost
+  */
+ 
+-    if ( !((vert ? CWWidth : CWHeight) & mask))
++    if ( !((vert ? CWWidth : CWHeight) & mask)) {
+         if (vert) 
+ 	    request->width = w->core.width;
+ 	else
+ 	    request->height = w->core.height;
++    }
+ 
+     almost = GetRequestInfo(request, !vert) != GetRequestInfo(reply, !vert);
+     almost |= (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert));
+@@ -1673,8 +1679,8 @@ static void ChangeManaged(w)
+    ResortChildren(pw);		
+ 
+    pw->paned.num_panes = 0;
+-   ForAllChildren(pw, childP) 
+-       if ( IsPane(*childP) )
++   ForAllChildren(pw, childP) {
++       if ( IsPane(*childP) ) {
+ 	   if ( XtIsManaged(*childP) ) {
+ 	       Pane pane = PaneInfo(*childP);
+ 	       if (HasGrip(*childP))
+@@ -1684,6 +1690,8 @@ static void ChangeManaged(w)
+ 	   }
+ 	   else
+ 	       break;		/* This list is already sorted. */
++       }
++   }
+ 
+    SetChildrenPrefSizes( (PanedWidget) w, size);
+ 
+@@ -1806,7 +1814,7 @@ Cardinal *num_args;
+ 
+     /* Check for change in XtNshowGrip. */
+ 
+-    if (old_pane->show_grip != new_pane->show_grip)
++    if (old_pane->show_grip != new_pane->show_grip) {
+         if (new_pane->show_grip == TRUE) {
+ 	    CreateGrip(new);
+ 	    if (XtIsRealized(XtParent(new))) {
+@@ -1822,6 +1830,7 @@ Cardinal *num_args;
+ 	    new_pane->grip = NULL;
+ 	    redisplay = TRUE;
+ 	}
++    }
+ 
+   /* ||| need to look at position changes */
+ 
+diff --git a/xc/lib/Xaw3d/Panner.c b/xc/lib/Xaw3d/Panner.c
+index 2d2f482..f0d9ed8 100644
+--- a/xc/lib/Xaw3d/Panner.c
++++ b/xc/lib/Xaw3d/Panner.c
+@@ -36,7 +36,7 @@ in this Software without prior written authorization from the X Consortium.
+ #include <X11/Xmu/Misc.h>		/* for Min */
+ #include <X11/Xmu/Drawing.h>
+ #include <ctype.h>			/* for isascii() etc. */
+-#include <math.h>			/* for atof() */
++#include <stdlib.h>			/* for atof() */
+ 
+ extern Bool XmuDistinguishablePixels(); /* not defined in any Xmu headers */
+ 
+diff --git a/xc/lib/Xaw3d/Scrollbar.c b/xc/lib/Xaw3d/Scrollbar.c
+index c105688..0566733 100644
+--- a/xc/lib/Xaw3d/Scrollbar.c
++++ b/xc/lib/Xaw3d/Scrollbar.c
+@@ -130,14 +130,18 @@ static XtResource resources[] = {
+        Offset(scrollbar.thumb), XtRImmediate, (XtPointer) XtUnspecifiedPixmap},
+   {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
+        Offset(scrollbar.foreground), XtRString, XtDefaultForeground},
++  {XtNscrollbarBackground, XtCScrollbarBackground, XtRPixel, sizeof(Pixel),
++       Offset(scrollbar.background), XtRString, XtDefaultForeground},
+   {XtNshown, XtCShown, XtRFloat, sizeof(float),
+        Offset(scrollbar.shown), XtRFloat, (XtPointer)&floatZero},
+   {XtNtopOfThumb, XtCTopOfThumb, XtRFloat, sizeof(float),
+        Offset(scrollbar.top), XtRFloat, (XtPointer)&floatZero},
+   {XtNpickTop, XtCPickTop, XtRBoolean, sizeof(Boolean),
+-       Offset(scrollbar.pick_top), XtRBoolean, (XtPointer) False},
++       Offset(scrollbar.pick_top), XtRImmediate, (XtPointer) False},
+   {XtNminimumThumb, XtCMinimumThumb, XtRDimension, sizeof(Dimension),
+-       Offset(scrollbar.min_thumb), XtRImmediate, (XtPointer) 7}
++       Offset(scrollbar.min_thumb), XtRImmediate, (XtPointer) 7},
++  {XtNpushThumb, XtCPushThumb, XtRBoolean, sizeof(Boolean),
++       Offset(scrollbar.push_thumb), XtRImmediate, (XtPointer) True}
+ };
+ #undef Offset
+ 
+@@ -211,8 +215,7 @@ ScrollbarClassRec scrollbarClassRec = {
+     /* change_sensitive	*/	XtInheritChangeSensitive
+   },
+   { /* threeD fields */
+-    /* shadowdraw	*/	XtInheritXaw3dShadowDraw /*,*/
+-    /* shadowboxdraw	*/	/*XtInheritXaw3dShadowBoxDraw*/
++    /* shadowdraw	*/	XtInheritXaw3dShadowDraw
+   },
+   { /* scrollbar fields */
+     /* ignore		*/	0
+@@ -224,7 +227,7 @@ WidgetClass scrollbarWidgetClass = (WidgetClass)&scrollbarClassRec;
+ 
+ #define NoButton -1
+ #define PICKLENGTH(widget, x, y) \
+-    ((widget->scrollbar.orientation == XtorientHorizontal) ? x : y)
++    ((widget->scrollbar.orientation == XtorientHorizontal) ? (x) : (y))
+ #define MIN(x,y)	((x) < (y) ? (x) : (y))
+ #define MAX(x,y)	((x) > (y) ? (x) : (y))
+ 
+@@ -242,6 +245,18 @@ static void ClassInitialize()
+ #define MARGIN(sbw) (sbw)->threeD.shadow_width
+ #endif
+ 
++/*
++   Used to swap X and Y coordinates when the scrollbar is horizontal.
++ */
++static void swap(a, b)
++    Dimension *a, *b;
++{
++    Dimension tmp = *a;
++    *a = *b;
++    *b = tmp;
++}
++
++
+ /* 
+  The original Xaw Scrollbar's FillArea *really* relied on the fact that the 
+  server was going to clip at the window boundaries; so the logic was really
+@@ -280,11 +295,11 @@ static void FillArea (sbw, top, bottom, fill)
+     if (lh <= 0 || lw <= 0) return;
+     if (fill) {
+ 	XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), 
+-			sbw->scrollbar.gc, 
++			sbw->scrollbar.gc,
+ 			lx, ly, (unsigned int) lw, (unsigned int) lh);
+     } else {
+ 	XClearArea (XtDisplay((Widget) sbw), XtWindow((Widget) sbw), 
+-			lx, ly, (unsigned int) lw, (unsigned int) lh, 
++			lx, ly, (unsigned int) lw, (unsigned int) lh,
+ 			FALSE);
+     }
+ }
+@@ -293,163 +308,375 @@ static void FillArea (sbw, top, bottom, fill)
+    sbw->shown.  The old area is erased.  The painting and
+    erasing is done cleverly so that no flickering will occur. */
+ 
+-static void PaintThumb (sbw, event)
++static void PaintThumb (sbw, pressed, shadow)
+     ScrollbarWidget sbw;
+-    XEvent *event; 
++    int pressed, shadow;
+ {
+-    Dimension s                   = sbw->threeD.shadow_width;
+-    Position  oldtop              = sbw->scrollbar.topLoc;
+-    Position  oldbot              = oldtop + sbw->scrollbar.shownLength;
+-    Dimension margin              = MARGIN (sbw);
+-    Dimension tzl                 = sbw->scrollbar.length - margin - margin;
+-    Position newtop, newbot;    
+-    Position  floor               = sbw->scrollbar.length - margin;
++    Dimension margin, tzl;
++    Position  floor;
++    Position  oldtop = sbw->scrollbar.topLoc;
++    Position  oldbot = oldtop + sbw->scrollbar.shownLength;
++    Position  newtop, newbot;
++    Dimension x, y;				/* upper-left corner of rectangle */
++    Dimension w, h;				/* size of rectangle */
++    Dimension sw = sbw->threeD.shadow_width;
++    Dimension th = sbw->scrollbar.thickness;
++    XPoint    ipt[4],opt[4];			/* inner and outer points of thumb */
++    XPoint    pt[4];				/* points used for drawing */
++    Display  *dpy = XtDisplay (sbw);
++    Window    win = XtWindow (sbw);
++    double    thumb_len;
++
++    margin = MARGIN (sbw);
++    tzl    = sbw->scrollbar.length - 2*margin;
++    floor  = sbw->scrollbar.length - margin;
+ 
+     newtop = margin + (int)(tzl * sbw->scrollbar.top);
+-    newbot = newtop + (int)(tzl * sbw->scrollbar.shown);
+-    if (sbw->scrollbar.shown < 1.) newbot++;
+-    if (newbot < newtop + (int)sbw->scrollbar.min_thumb +
+-                        2 * (int)sbw->threeD.shadow_width) 
+-      newbot = newtop + sbw->scrollbar.min_thumb +
+-                        2 * sbw->threeD.shadow_width;
+-    if ( newbot >= floor ) {
+-	newtop = floor-(newbot-newtop)+1;
++    thumb_len = tzl * sbw->scrollbar.shown;
++    newbot = newtop + (int)thumb_len;
++    if ((thumb_len - (int)thumb_len) > 0.5) ++newbot;
++
++    if (newbot < newtop + (int)sbw->scrollbar.min_thumb + 2 * (int)sw)
++	newbot = newtop + sbw->scrollbar.min_thumb + 2 * sw;
++
++    if (newbot >= floor) {
++	newtop = floor - (newbot-newtop) + 1;
+ 	newbot = floor;
+     }
+ 
+     sbw->scrollbar.topLoc = newtop;
+     sbw->scrollbar.shownLength = newbot - newtop;
++
+     if (XtIsRealized ((Widget) sbw)) {
+-      /*  3D thumb wanted ?
+-       */
+-      if (s) 
+-	  {
+-          if (newtop < oldtop) FillArea(sbw, oldtop, oldtop + s, 0);
+-          if (newtop > oldtop) FillArea(sbw, oldtop, MIN(newtop, oldbot), 0);
+-          if (newbot < oldbot) FillArea(sbw, MAX(newbot, oldtop), oldbot, 0);
+-          if (newbot > oldbot) FillArea(sbw, oldbot - s, oldbot, 0);
+-
+-          if (sbw->scrollbar.orientation == XtorientHorizontal) 
+-	      {
+-	      _ShadowSurroundedBox((Widget)sbw, (ThreeDWidget)sbw,
+-		  newtop, s, newbot, sbw->core.height - s,
+-		  sbw->threeD.relief, TRUE);
+-	      }
+-	  else 
+-	      {
+-	      _ShadowSurroundedBox((Widget)sbw, (ThreeDWidget)sbw,
+-		  s, newtop, sbw->core.width - s, newbot,
+-		  sbw->threeD.relief, TRUE);
+-	      }
+-	  }
+-      else 
+-	  {
+-	  /* 
+-	    Note to Mitch: FillArea is (now) correctly implemented to 
+-	    not draw over shadows or the arrows. Therefore setting clipmasks 
+-	    doesn't seem to be necessary.  Correct me if I'm wrong!
+-	  */
+-          if (newtop < oldtop) FillArea(sbw, newtop, MIN(newbot, oldtop), 1);
+-          if (newtop > oldtop) FillArea(sbw, oldtop, MIN(newtop, oldbot), 0);
+-          if (newbot < oldbot) FillArea(sbw, MAX(newbot, oldtop), oldbot, 0);
+-          if (newbot > oldbot) FillArea(sbw, MAX(newtop, oldbot), newbot, 1);
+-	  }
++	/* 3D? */
++	if (sw) {
++	    GC top, bot;
++	    GC back = sbw->scrollbar.bgc;
++	    GC fore = sbw->scrollbar.gc;
++
++	    if ((pressed && sbw->scrollbar.push_thumb) ^ sbw->threeD.invert_border) {
++		top = sbw->threeD.bot_shadow_GC;
++		bot = sbw->threeD.top_shadow_GC;
++	    } else {
++		top = sbw->threeD.top_shadow_GC;
++		bot = sbw->threeD.bot_shadow_GC;
++	    }
++
++	    /* the space above the thumb */
++	    x = sw;
++	    y = margin;
++	    w = th - sw * 2;
++	    h = newtop - y;
++	    if (sbw->scrollbar.orientation == XtorientHorizontal) {
++		swap(&x, &y);
++		swap(&w, &h);
++	    }
++	    XFillRectangle(dpy, win, back, x, y, (unsigned int)w, (unsigned int)h);
++
++	    /* the space below the thumb */
++	    x = sw;
++	    y = newbot;
++	    w = th - sw * 2;
++	    h = tzl + margin - newbot;
++	    if (sbw->scrollbar.orientation == XtorientHorizontal) {
++		swap(&x, &y);
++		swap(&w, &h);
++	    }
++	    XFillRectangle(dpy, win, back, x, y, (unsigned int)w, (unsigned int)h);
++
++	    /* Return here if only the shadows should be repainted */
++	    if (shadow) return;
++
++	    /* the thumb itself */
++	    x = sw * 2;
++	    y = newtop + sw;
++	    w = th - sw * 4;
++	    h = newbot - newtop - 2 * sw;
++	    if (sbw->scrollbar.orientation == XtorientHorizontal) {
++		swap(&x, &y);
++		swap(&w, &h);
++	    }
++	    /* we can't use "w > 0" and "h > 0" because they are
++	    usually unsigned quantities */
++	    if (th - sw * 4 > 0 && newbot - newtop - 2 * sw > 0)
++            XFillRectangle(dpy, win, fore, x, y, (unsigned int)w, (unsigned int)h);
++
++	    /* the shades around the thumb
++
++	       o0 +--------------+ o3
++		  |\ i0      i3 /|
++   		  | +----------+ |
++  		  | |          | |
++		  | |          | |
++		  | |          | |
++		  | +----------+ |
++		  |/ i1      i2 \|
++	       o1 +--------------+ o2
++
++	     */
++	    opt[0].x = opt[1].x = sw;
++	    opt[0].y = opt[3].y = newtop;
++	    opt[2].x = opt[3].x = th - sw;
++	    opt[2].y = opt[1].y = newbot;
++
++	    ipt[0].x = ipt[1].x = opt[0].x + sw;
++	    ipt[0].y = ipt[3].y = opt[0].y + sw;
++	    ipt[2].x = ipt[3].x = opt[2].x - sw;
++	    ipt[2].y = ipt[1].y = opt[2].y - sw;
++
++	    /* make sure shades don't overlap */
++	    if (ipt[0].x > ipt[3].x)
++		ipt[3].x = ipt[2].x = ipt[1].x = ipt[0].x = (ipt[0].x + ipt[3].x) / 2;
++	    if (ipt[0].y > ipt[1].y)
++		ipt[3].y = ipt[2].y = ipt[1].y = ipt[0].y = (ipt[0].y + ipt[1].y) / 2;
++	    if (sbw->scrollbar.orientation == XtorientHorizontal) {
++		int n;
++		for (n = 0; n < 4; n++) {
++		    swap(&ipt[n].x, &ipt[n].y);
++		    swap(&opt[n].x, &opt[n].y);
++		}
++	    }
++
++	    /* left */
++	    pt[0] = opt[0];
++	    pt[1] = opt[1];
++	    pt[2] = ipt[1];
++	    pt[3] = ipt[0];
++	    XFillPolygon (dpy, win, top, pt, 4, Convex, CoordModeOrigin);
++
++	    /* top */
++ 	    pt[0] = opt[0];
++	    pt[1] = opt[3];
++	    pt[2] = ipt[3];
++ 	    pt[3] = ipt[0];
++ 	    XFillPolygon (dpy, win, top, pt, 4, Convex, CoordModeOrigin);
++
++	    /* bottom */
++	    pt[0] = opt[1];
++	    pt[1] = opt[2];
++	    pt[2] = ipt[2];
++	    pt[3] = ipt[1];
++	    XFillPolygon (dpy, win, bot, pt, 4, Convex, CoordModeOrigin);
++
++	    /* right */
++	    pt[0] = opt[3];
++	    pt[1] = opt[2];
++	    pt[2] = ipt[2];
++	    pt[3] = ipt[3];
++	    XFillPolygon (dpy, win, bot, pt, 4, Convex, CoordModeOrigin);
++
++
++	} else {
++	    /* Return here if only the shadows should be repainted */
++	    if (shadow) return;
++
++	    /* 
++	     * Note to Mitch: FillArea is (now) correctly implemented to 
++	     * not draw over shadows or the arrows. Therefore setting clipmasks 
++	     * doesn't seem to be necessary.  Correct me if I'm wrong!
++	     */
++            if (newtop < oldtop) FillArea(sbw, newtop, MIN(newbot, oldtop), 1);
++            if (newtop > oldtop) FillArea(sbw, oldtop, MIN(newtop, oldbot), 0);
++            if (newbot < oldbot) FillArea(sbw, MAX(newbot, oldtop), oldbot, 0);
++            if (newbot > oldbot) FillArea(sbw, MAX(newtop, oldbot), newbot, 1);
++	}
+     }
+ }
+ 
+ #ifdef XAW_ARROW_SCROLLBARS
+-static void PaintArrows (sbw)
++static void PaintArrows (sbw, toppressed, botpressed)
+     ScrollbarWidget sbw;
++    int toppressed, botpressed;
+ {
+-    XPoint    pt[20];
+-    Dimension s   = sbw->threeD.shadow_width;
+-    Dimension t   = sbw->scrollbar.thickness;
+-    Dimension l   = sbw->scrollbar.length;
+-    Dimension tms = t - s, lms = l - s;
+-    Dimension tm1 = t - 1;
+-    Dimension lmt = l - t;
+-    Dimension lp1 = lmt + 1;
+-    Dimension sm1 = s - 1;
+-    Dimension t2  = t / 2;
+-    Dimension sa30 = (Dimension)(1.732 * s );  /* cotangent of 30 deg */
+-    Display   *dpy = XtDisplay (sbw);
+-    Window    win = XtWindow (sbw);
+-    GC        top = sbw->threeD.top_shadow_GC;
+-    GC        bot = sbw->threeD.bot_shadow_GC;
+-  
++    XPoint	ipt[6], opt[6];	/* inner and outer points */
++    XPoint	rpt[4];		/* the rectangle around arrows */
++    XPoint	tpt[6];		/* temporary for args to XFillPolygon */
++    Dimension	sw = sbw->threeD.shadow_width;
++    Dimension	th = sbw->scrollbar.thickness;
++    Dimension	len = sbw->scrollbar.length;
++    Display    *dpy = XtDisplay (sbw);
++    Window	win = XtWindow (sbw);
++    GC		top, bot;
++    GC		back = sbw->scrollbar.bgc;
++    GC		fore = sbw->scrollbar.gc;
+ 
+     if (XtIsRealized ((Widget) sbw)) {
+ 	/* 3D arrows?
+          */
+-	if (s) {
+-	    /* upper/right arrow */
+-	    pt[0].x = sm1;         pt[0].y = tm1;
+-	    pt[1].x = t2;          pt[1].y = sm1;
+-	    pt[2].x = t2;          pt[2].y = s + sa30;
+-	    pt[3].x = sm1 + sa30;  pt[3].y = tms - 1;
+-
+-	    pt[4].x = sm1;         pt[4].y = tm1;
+-	    pt[5].x = tms;         pt[5].y = tm1;
+-	    pt[6].x = t2;          pt[6].y = sm1;
+-	    pt[7].x = t2;          pt[7].y = s + sa30;
+-	    pt[8].x = tms - sa30;  pt[8].y = tms - 1;
+-	    pt[9].x = sm1 + sa30;  pt[9].y = tms - 1;
+-
+-	    /* lower/left arrow */
+-	    pt[10].x = tms;        pt[10].y = lp1;
+-	    pt[11].x = s;          pt[11].y = lp1;
+-	    pt[12].x = t2;         pt[12].y = lms;
+-	    pt[13].x = t2;         pt[13].y = lms - sa30;
+-	    pt[14].x = s + sa30;   pt[14].y = lmt + s + 1;
+-	    pt[15].x = tms - sa30; pt[15].y = lmt + s + 1;
+-
+-	    pt[16].x = tms;        pt[16].y = lp1;
+-	    pt[17].x = t2;         pt[17].y = lms;
+-	    pt[18].x = t2;         pt[18].y = lms - sa30;
+-	    pt[19].x = tms - sa30; pt[19].y = lmt + s + 1;
++	if (sw) {
++	    /*
++		The points are numbered like this:
++
++		r0 +---------+ r3
++		   |    ^ o2 |
++		   |   /|\   |   a = i0
++		   |  /c^ \  |   b = i1
++		   | / / \ \ |   c = i2
++		   |/a<--->b\|
++		o0 +---------+ o1
++		   |         |
++		   |         |
++		o3 +---------+ o4
++		   |\d<--->e/|
++		   | \ \ / / |   d = i3
++		   |  \fv /  |   e = i4
++		   |   \|/   |   f = i5
++		   |    v o5 |
++		r1 +---------+ r2
++	     */
++
++	    rpt[0].x = rpt[1].x = opt[0].x = opt[3].x = sw;
++	    ipt[0].x = ipt[3].x = sw * 2.5;
++	    opt[2].x = opt[5].x = ipt[2].x = ipt[5].x = th / 2;
++	    ipt[1].x = ipt[4].x = th - (int)(sw * 2.5);
++	    rpt[2].x = rpt[3].x = opt[1].x = opt[4].x = th - sw;
++
++	    rpt[0].y = rpt[3].y = opt[2].y = sw;
++	    ipt[2].y = sw * 3.2;
++	    ipt[0].y = ipt[1].y = th - sw;
++	    opt[0].y = opt[1].y = th;
++	    opt[3].y = opt[4].y = len - th;
++	    ipt[3].y = ipt[4].y = len - th + sw;
++	    ipt[5].y = len - (int)(sw * 3.2);
++	    rpt[1].y = rpt[2].y = opt[5].y = len - sw;
++
++            /* some ugly kludges to make them look right */
++	    opt[2].y--;
++	    opt[0].x--;
++	    ipt[2].y--;
++	    ipt[0].x--;
++
++            /* make sure shades don't overlap */
++	    if (ipt[0].x > ipt[1].x) {
++		Dimension tmp = (ipt[0].x + ipt[1].x) / 2;
++		ipt[4].x = ipt[3].x = ipt[1].x = ipt[0].x = tmp;
++	    }
++            if (ipt[0].y < ipt[2].y) {
++		ipt[2].y = ipt[1].y = ipt[0].y = (ipt[0].y + ipt[2].y) / 2;
++		ipt[5].y = ipt[4].y = ipt[3].y = (ipt[3].y + ipt[5].y) / 2;
++            }
+ 
+-	    /* horizontal arrows require that x and y coordinates be swapped */
++            /* horizontal arrows require that x and y coordinates be swapped */
+ 	    if (sbw->scrollbar.orientation == XtorientHorizontal) {
+ 		int n;
+-		int swap;
+-		for (n = 0; n < 20; n++) {
+-		    swap = pt[n].x;
+-		    pt[n].x = pt[n].y;
+-		    pt[n].y = swap;
++		for (n = 0; n < 6; n++) {
++		    swap(&ipt[n].x, &ipt[n].y);
++		    swap(&opt[n].x, &opt[n].y);
+ 		}
++		for (n = 0; n < 4; n++)
++		swap(&rpt[n].x, &rpt[n].y);
++	    }
++
++	    if (toppressed ^ sbw->threeD.invert_border) {
++		top = sbw->threeD.bot_shadow_GC;
++		bot = sbw->threeD.top_shadow_GC;
++	    } else {
++		top = sbw->threeD.top_shadow_GC;
++		bot = sbw->threeD.bot_shadow_GC;
++	    }
++
++	    /* top-left background */
++	    tpt[0] = rpt[0];
++	    tpt[1] = opt[0];
++	    tpt[2] = opt[2];
++	    XFillPolygon (dpy, win, back, tpt, 3, Convex, CoordModeOrigin);
++
++	    /* top-right background */
++	    tpt[0] = rpt[3];
++	    tpt[1] = opt[2];
++	    tpt[2] = opt[1];
++	    XFillPolygon (dpy, win, back, tpt, 3, Convex, CoordModeOrigin);
++
++	    /* the right shade */
++	    tpt[0] = opt[1];
++	    tpt[1] = opt[2];
++	    tpt[2] = ipt[2];
++	    tpt[3] = ipt[1];
++	    XFillPolygon (dpy, win, bot, tpt, 4, Convex, CoordModeOrigin);
++
++	    /* the left shade */
++	    tpt[0] = opt[2];
++	    tpt[1] = opt[0];
++	    tpt[2] = ipt[0];
++	    tpt[3] = ipt[2];
++	    XFillPolygon (dpy, win, top, tpt, 4, Convex, CoordModeOrigin);
++
++	    /* the bottom shade */
++	    tpt[0] = opt[0];
++	    tpt[1] = opt[1];
++	    tpt[2] = ipt[1];
++	    tpt[3] = ipt[0];
++	    XFillPolygon (dpy, win, bot, tpt, 4, Convex, CoordModeOrigin);
++
++	    /* the arrow itself */
++	    XFillPolygon (dpy, win, fore, ipt, 3, Convex, CoordModeOrigin);
++
++	    if (botpressed ^ sbw->threeD.invert_border) {
++		top = sbw->threeD.bot_shadow_GC;
++		bot = sbw->threeD.top_shadow_GC;
++	    } else {
++		top = sbw->threeD.top_shadow_GC;
++		bot = sbw->threeD.bot_shadow_GC;
+ 	    }
+-	    XFillPolygon (dpy, win, top, pt, 4, Complex, CoordModeOrigin);
+-	    XFillPolygon (dpy, win, bot, pt + 4, 6, Complex, CoordModeOrigin);
+-	    XFillPolygon (dpy, win, top, pt + 10, 6, Complex, CoordModeOrigin);
+-	    XFillPolygon (dpy, win, bot, pt + 16, 4, Complex, CoordModeOrigin);
++
++	    /* bottom-left background */
++	    tpt[0] = rpt[1];
++	    tpt[1] = opt[5];
++	    tpt[2] = opt[3];
++	    XFillPolygon (dpy, win, back, tpt, 3, Convex, CoordModeOrigin);
++
++	    /* bottom-right background */
++	    tpt[0] = rpt[2];
++	    tpt[1] = opt[4];
++	    tpt[2] = opt[5];
++	    XFillPolygon (dpy, win, back, tpt, 3, Convex, CoordModeOrigin);
++
++	    /* the left shade */
++	    tpt[0] = opt[3];
++	    tpt[1] = opt[5];
++	    tpt[2] = ipt[5];
++	    tpt[3] = ipt[3];
++	    XFillPolygon (dpy, win, top, tpt, 4, Convex, CoordModeOrigin);
++
++	    /* the right shade */
++	    tpt[0] = opt[5];
++	    tpt[1] = opt[4];
++	    tpt[2] = ipt[4];
++	    tpt[3] = ipt[5];
++	    XFillPolygon (dpy, win, bot, tpt, 4, Convex, CoordModeOrigin);
++
++	    /* the top shade */
++	    tpt[0] = opt[4];
++	    tpt[1] = opt[3];
++	    tpt[2] = ipt[3];
++	    tpt[3] = ipt[4];
++	    XFillPolygon (dpy, win, top, tpt, 4, Convex, CoordModeOrigin);
++
++	    /* the arrow itself */
++	    XFillPolygon (dpy, win, fore, ipt+3, 3, Convex, CoordModeOrigin);
+ 
+ 	} else {
+-	    pt[0].x = 0;      pt[0].y = tm1;
+-	    pt[1].x = t;      pt[1].y = tm1;
+-	    pt[2].x = t2;     pt[2].y = 0;
+-      
+-	    pt[3].x = 0;      pt[3].y = lp1;
+-	    pt[4].x = t;      pt[4].y = lp1;
+-	    pt[5].x = t2;     pt[5].y = l;
++
++	    tpt[0] = opt[0];
++	    tpt[1] = opt[1];
++	    tpt[2] = opt[2];
++	    tpt[3] = opt[3];
++	    tpt[4] = opt[4];
++	    tpt[5] = opt[5];
+ 
+ 	    /* horizontal arrows require that x and y coordinates be swapped */
+ 	    if (sbw->scrollbar.orientation == XtorientHorizontal) {
+ 		int n;
+-		int swap;
+-		for (n = 0; n < 6; n++) {
+-		    swap = pt[n].x;
+-		    pt[n].x = pt[n].y;
+-		    pt[n].y = swap;
+-		}
++		for (n = 0; n < 6; n++)
++		    swap(&tpt[n].x, &tpt[n].y);
+ 	    }
++
+ 	    /* draw the up/left arrow */
+-	    XFillPolygon (dpy, win, sbw->scrollbar.gc, 
+-			  pt, 3, 
+-			  Convex, CoordModeOrigin);
++	    XFillPolygon (dpy, win, fore, tpt, 3, Convex, CoordModeOrigin);
++
+ 	    /* draw the down/right arrow */
+-	    XFillPolygon (dpy, win, sbw->scrollbar.gc, 
+-			  pt+3, 3, 
+-			  Convex, CoordModeOrigin);
++	    XFillPolygon (dpy, win, fore, tpt+3, 3, Convex, CoordModeOrigin);
++
+ 	}
+     }
+ }
+@@ -469,12 +696,13 @@ static void Destroy (w)
+ 	XtRemoveTimeOut (sbw->scrollbar.timer_id);
+ #endif
+     XtReleaseGC (w, sbw->scrollbar.gc);
++    XtReleaseGC (w, sbw->scrollbar.bgc);
+ }
+ 
+ /*	Function Name: CreateGC
+  *	Description: Creates the GC.
+  *	Arguments: w - the scrollbar widget.
+- *	Returns: none. 
++ *	Returns: none.
+  */
+ 
+ static void CreateGC (w)
+@@ -485,9 +713,22 @@ static void CreateGC (w)
+     XtGCMask mask;
+     unsigned int depth = 1;
+ 
++    /* make GC for scrollbar background */
++    if (sbw->threeD.be_nice_to_cmap ||
++	DefaultDepthOfScreen (XtScreen(w)) == 1) {
++	mask = GCTile | GCFillStyle;
++	gcValues.tile = sbw->threeD.bot_shadow_pxmap;
++	gcValues.fill_style = FillTiled;
++    } else {
++	mask = GCForeground;
++	gcValues.foreground = sbw->scrollbar.background;
++    }
++    sbw->scrollbar.bgc = XtGetGC(w, mask, &gcValues);
++
++    /* make GC for scrollbar foreground */
+     if (sbw->scrollbar.thumb == XtUnspecifiedPixmap) {
+-        sbw->scrollbar.thumb = XmuCreateStippledPixmap (XtScreen(w), 
+-					(Pixel) 1, (Pixel) 0, depth);
++        sbw->scrollbar.thumb = XmuCreateStippledPixmap (XtScreen(w),
++					(Pixel) 0, (Pixel) 0, depth);
+     } else if (sbw->scrollbar.thumb != None) {
+ 	Window root;
+ 	int x, y;
+@@ -518,6 +759,9 @@ static void CreateGC (w)
+     /* the creation should be non-caching, because */
+     /* we now set and clear clip masks on the gc returned */
+     sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues);
++    gcValues.foreground = sbw->scrollbar.foreground;
++    gcValues.background = sbw->core.background_pixel;
++    mask = GCForeground | GCBackground;
+ }
+ 
+ static void SetDimensions (sbw)
+@@ -581,10 +825,10 @@ static void Realize (w, valueMask, attributes)
+ 
+     XtVaSetValues (w, XtNcursor, sbw->scrollbar.inactiveCursor, NULL);
+ #endif
+-    /* 
+-     * The Simple widget actually stuffs the value in the valuemask. 
++    /*
++     * The Simple widget actually stuffs the value in the valuemask.
+      */
+-    
++
+     (*scrollbarWidgetClass->core_class.superclass->core_class.realize)
+ 	(w, valueMask, attributes);
+ }
+@@ -617,8 +861,10 @@ static Boolean SetValues (current, request, desired, args, num_args)
+     if (XtIsRealized (desired)) {
+ 	if (sbw->scrollbar.foreground != dsbw->scrollbar.foreground ||
+ 	    sbw->core.background_pixel != dsbw->core.background_pixel ||
+-	    sbw->scrollbar.thumb != dsbw->scrollbar.thumb) {
++	    sbw->scrollbar.thumb != dsbw->scrollbar.thumb ||
++	    sbw->scrollbar.background != dsbw->scrollbar.background) {
+ 	    XtReleaseGC (desired, sbw->scrollbar.gc);
++	    XtReleaseGC (desired, sbw->scrollbar.bgc);
+ 	    CreateGC (desired);
+ 	    redraw = TRUE;
+ 	}
+@@ -667,11 +913,15 @@ static void Redisplay (w, event, region)
+ 	XRectInRegion (region, x, y, width, height) != RectangleOut) {
+ 	/* Forces entire thumb to be painted. */
+ 	sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1);
+-	PaintThumb (sbw, event); 
++	PaintThumb (sbw, 0, 0); 
++    } else {
++	/* Redraw the surounding shadows of the thumb */
++	PaintThumb (sbw, 0, 1); 
+     }
++
+ #ifdef XAW_ARROW_SCROLLBARS
+     /* we'd like to be region aware here!!!! */
+-    PaintArrows (sbw);
++    PaintArrows (sbw, 0, 0);
+ #endif
+ 
+ }
+@@ -688,23 +938,23 @@ static Boolean CompareEvents (oldEvent, newEvent)
+ 
+     switch (newEvent->type) {
+     case MotionNotify:
+-	Check(xmotion.state); 
++	Check(xmotion.state);
+ 	break;
+     case ButtonPress:
+     case ButtonRelease:
+ 	Check(xbutton.state);
+-	Check(xbutton.button); 
++	Check(xbutton.button);
+ 	break;
+     case KeyPress:
+     case KeyRelease:
+ 	Check(xkey.state);
+-	Check(xkey.keycode); 
++	Check(xkey.keycode);
+ 	break;
+     case EnterNotify:
+     case LeaveNotify:
+ 	Check(xcrossing.mode);
+ 	Check(xcrossing.detail);
+-	Check(xcrossing.state); 
++	Check(xcrossing.state);
+ 	break;
+     }
+ #undef Check
+@@ -753,23 +1003,23 @@ static void ExtractPosition (event, x, y)
+ {
+     switch( event->type ) {
+     case MotionNotify:
+-	*x = event->xmotion.x;	 
+-	*y = event->xmotion.y;	  
++	*x = event->xmotion.x;
++	*y = event->xmotion.y;
+ 	break;
+     case ButtonPress:
+     case ButtonRelease:
+-	*x = event->xbutton.x;   
+-	*y = event->xbutton.y;   
++	*x = event->xbutton.x;
++	*y = event->xbutton.y;
+ 	break;
+     case KeyPress:
+     case KeyRelease:
+-	*x = event->xkey.x;      
+-	*y = event->xkey.y;	  
++	*x = event->xkey.x;
++	*y = event->xkey.y;
+ 	break;
+     case EnterNotify:
+     case LeaveNotify:
+-	*x = event->xcrossing.x; 
+-	*y = event->xcrossing.y; 
++	*x = event->xcrossing.x;
++	*y = event->xcrossing.y;
+ 	break;
+     default:
+ 	*x = 0; *y = 0;
+@@ -792,7 +1042,8 @@ static void HandleThumb (w, event, params, num_params)
+     /* also call Move and Notify if we're already in continuous scroll mode */
+     if (sbw->scrollbar.scroll_mode == 2 ||
+ 	(PICKLENGTH (sbw,x,y) >= sbw->scrollbar.topLoc &&
+-	PICKLENGTH (sbw,x,y) <= sbw->scrollbar.topLoc + sbw->scrollbar.shownLength)){
++	 PICKLENGTH (sbw,x,y) <= (sbw->scrollbar.topLoc +
++				  sbw->scrollbar.shownLength))){
+ 	XtCallActionProc(w, "MoveThumb", event, params, *num_params);
+ 	XtCallActionProc(w, "NotifyThumb", event, params, *num_params);
+     }
+@@ -812,8 +1063,8 @@ static void RepeatNotify (client_data, idp)
+     call_data = MAX (A_FEW_PIXELS, sbw->scrollbar.length / 20);
+     if (sbw->scrollbar.scroll_mode == 1)
+ 	call_data = -call_data;
+-    XtCallCallbacks((Widget)sbw, XtNscrollProc, (XtPointer) call_data);
+-    sbw->scrollbar.timer_id = 
++    XtCallCallbacks((Widget)sbw, XtNscrollProc, (XtPointer)(long)call_data);
++    sbw->scrollbar.timer_id =
+     XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)sbw),
+ 		    (unsigned long) 150,
+ 		    RepeatNotify,
+@@ -833,7 +1084,7 @@ static void StartScroll (w, event, params, num_params )
+     char direction;
+ 
+     if (sbw->scrollbar.direction != 0) return; /* if we're already scrolling */
+-    if (*num_params > 0) 
++    if (*num_params > 0)
+ 	direction = *params[0];
+     else
+ 	direction = 'C';
+@@ -842,24 +1093,24 @@ static void StartScroll (w, event, params, num_params )
+ 
+     switch (direction) {
+     case 'B':
+-    case 'b':	
++    case 'b':
+ 	cursor = (sbw->scrollbar.orientation == XtorientVertical)
+ 			? sbw->scrollbar.downCursor
+-			: sbw->scrollbar.rightCursor; 
++			: sbw->scrollbar.rightCursor;
+ 	break;
+     case 'F':
+     case 'f':
+ 	cursor = (sbw->scrollbar.orientation == XtorientVertical)
+ 			? sbw->scrollbar.upCursor
+-			: sbw->scrollbar.leftCursor; 
++			: sbw->scrollbar.leftCursor;
+ 	break;
+     case 'C':
+     case 'c':
+ 	cursor = (sbw->scrollbar.orientation == XtorientVertical)
+ 			? sbw->scrollbar.rightCursor
+-			: sbw->scrollbar.upCursor; 
++			: sbw->scrollbar.upCursor;
+ 	break;
+-    default:	
++    default:
+ 	return; /* invalid invocation */
+     }
+     XtVaSetValues (w, XtNcursor, cursor, NULL);
+@@ -881,7 +1132,7 @@ static int InRange(num, small, big)
+ #endif
+ 
+ /*
+- * Same as above, but for floating numbers. 
++ * Same as above, but for floating numbers.
+  */
+ 
+ static float FloatInRange(num, small, big)
+@@ -895,15 +1146,15 @@ static float FloatInRange(num, small, big)
+ static void NotifyScroll (w, event, params, num_params)
+     Widget w;
+     XEvent *event;
+-    String *params;		
+-    Cardinal *num_params;	
++    String *params;
++    Cardinal *num_params;
+ {
+     ScrollbarWidget sbw = (ScrollbarWidget) w;
+     int call_data;
+     Position x, y;
+ 
+     if (sbw->scrollbar.scroll_mode == 2  /* if scroll continuous */
+-	|| LookAhead (w, event)) 
++	|| LookAhead (w, event))
+ 	return;
+ 
+     ExtractPosition (event, &x, &y);
+@@ -911,33 +1162,36 @@ static void NotifyScroll (w, event, params, num_params)
+     if (PICKLENGTH (sbw,x,y) < sbw->scrollbar.thickness) {
+ 	/* handle first arrow zone */
+ 	call_data = -MAX (A_FEW_PIXELS, sbw->scrollbar.length / 20);
+-	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data));
++	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(long)call_data);
+ 	/* establish autoscroll */
+-	sbw->scrollbar.timer_id = 
++	sbw->scrollbar.timer_id =
+ 	    XtAppAddTimeOut (XtWidgetToApplicationContext (w),
+ 				(unsigned long) 300, RepeatNotify, (XtPointer)w);
+ 	sbw->scrollbar.scroll_mode = 1;
++	PaintArrows (sbw, 1, 0);
+     } else if (PICKLENGTH (sbw,x,y) > sbw->scrollbar.length - sbw->scrollbar.thickness) {
+ 	/* handle last arrow zone */
+ 	call_data = MAX (A_FEW_PIXELS, sbw->scrollbar.length / 20);
+-	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data));
++	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(long)call_data);
+ 	/* establish autoscroll */
+ 	sbw->scrollbar.timer_id =
+-	    XtAppAddTimeOut (XtWidgetToApplicationContext (w), 
++	    XtAppAddTimeOut (XtWidgetToApplicationContext (w),
+ 				(unsigned long) 300, RepeatNotify, (XtPointer)w);
+ 	sbw->scrollbar.scroll_mode = 3;
++	PaintArrows (sbw, 0, 1);
+     } else if (PICKLENGTH (sbw, x, y) < sbw->scrollbar.topLoc) {
+ 	/* handle zone "above" the thumb */
+-	call_data = - sbw->scrollbar.length;
+-	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data));
++	call_data = - (sbw->scrollbar.length);
++	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(long)call_data);
+     } else if (PICKLENGTH (sbw, x, y) > sbw->scrollbar.topLoc + sbw->scrollbar.shownLength) {
+ 	/* handle zone "below" the thumb */
+ 	call_data = sbw->scrollbar.length;
+-	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data));
+-    } else 
+-	{
++	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(long)call_data);
++    } else {
+ 	/* handle the thumb in the motion notify action */
+-	}
++	/* but we need to re-paint it "pressed in" here */
++	PaintThumb (sbw, 1, 0);
++    }
+     return;
+ }
+ #else /* XAW_ARROW_SCROLLBARS */
+@@ -954,7 +1208,7 @@ static void NotifyScroll (w, event, params, num_params)
+ 
+     if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */
+     if (LookAhead (w, event)) return;
+-    if (*num_params > 0) 
++    if (*num_params > 0)
+ 	style = *params[0];
+     else
+ 	style = 'P';
+@@ -963,24 +1217,24 @@ static void NotifyScroll (w, event, params, num_params)
+     case 'P':    /* Proportional */
+     case 'p':
+ 	ExtractPosition (event, &x, &y);
+-	call_data = 
+-	    InRange (PICKLENGTH (sbw, x, y), 0, (int) sbw->scrollbar.length); 
++	call_data =
++	    InRange (PICKLENGTH (sbw, x, y), 0, (int) sbw->scrollbar.length);
+ 	break;
+ 
+     case 'F':    /* FullLength */
+-    case 'f':    
+-	call_data = sbw->scrollbar.length; 
++    case 'f':
++	call_data = sbw->scrollbar.length;
+ 	break;
+     }
+     switch (sbw->scrollbar.direction) {
+     case 'B':
+-    case 'b':    
++    case 'b':
+ 	call_data = -call_data;
+ 	/* fall through */
+ 
+     case 'F':
+-    case 'f':    
+-	XtCallCallbacks (w, XtNscrollProc, (XtPointer)call_data);
++    case 'f':
++	XtCallCallbacks (w, XtNscrollProc, (XtPointer)(long)call_data);
+ 	break;
+ 
+     case 'C':
+@@ -1005,6 +1259,9 @@ static void EndScroll(w, event, params, num_params )
+     /* no need to remove any autoscroll timeout; it will no-op */
+     /* because the scroll_mode is 0 */
+     /* but be sure to remove timeout in destroy proc */
++    /* release all buttons */
++    PaintArrows (sbw, 0, 0);
++    PaintThumb (sbw, 0, 0);
+ #else
+     XtVaSetValues (w, XtNcursor, sbw->scrollbar.inactiveCursor, NULL);
+     XFlush (XtDisplay (w));
+@@ -1055,7 +1312,7 @@ static void MoveThumb (w, event, params, num_params)
+ #ifdef XAW_ARROW_SCROLLBARS
+     if (sbw->scrollbar.scroll_mode != 2 )
+       /* initialize picked position */
+-      sbw->scrollbar.picked = (FloatInRange( loc, t, t + s ) - t);
++      sbw->scrollbar.picked = (FloatInRange(loc, t, t+s) - t);
+ #else
+     sbw->scrollbar.picked = 0.5 * s;
+ #endif
+@@ -1074,7 +1331,7 @@ static void MoveThumb (w, event, params, num_params)
+ #ifdef XAW_ARROW_SCROLLBARS
+     sbw->scrollbar.scroll_mode = 2; /* indicate continuous scroll */
+ #endif
+-    PaintThumb (sbw, event);
++    PaintThumb (sbw, 1, 0);
+     XFlush (XtDisplay (w));	/* re-draw it before Notifying */
+ }
+ 
+@@ -1164,6 +1421,6 @@ void XawScrollbarSetThumb (w, top, shown)
+     sbw->scrollbar.shown = (shown > 1.0) ? 1.0 :
+ 				(shown >= 0.0) ? shown : sbw->scrollbar.shown;
+ 
+-    PaintThumb (sbw, NULL);
++    PaintThumb (sbw, 0, 0);
+ }
+ 
+diff --git a/xc/lib/Xaw3d/Scrollbar.h b/xc/lib/Xaw3d/Scrollbar.h
+index 2821018..0c84582 100644
+--- a/xc/lib/Xaw3d/Scrollbar.h
++++ b/xc/lib/Xaw3d/Scrollbar.h
+@@ -94,6 +94,7 @@ SOFTWARE.
+  scrollRCursor	     Cursor		Cursor		XC_sb_right_arrow
+  scrollUCursor	     Cursor		Cursor		XC_sb_up_arrow
+  scrollVCursor	     Cursor		Cursor		XC_sb_v_double_arrow
++ scrollbarBackground ScrollbarBackground Pixel		XtDefaultForeground
+  sensitive	     Sensitive		Boolean		True
+  shown		     Shown		Float		0.0
+  thickness	     Thickness		Dimension	14
+@@ -101,6 +102,7 @@ SOFTWARE.
+  thumbProc	     Callback		XtCallbackList	NULL
+  topOfThumb	     TopOfThumb		Float		0.0
+  pickTop	     PickTop		Boolean		False
++ pushThumb	     PushThumb		Boolean		True
+  translations	     Translations	TranslationTable see source or doc
+  width		     Width		Dimension	thickness or length
+  x		     Position		Position	0
+@@ -115,11 +117,15 @@ SOFTWARE.
+ #define XtCMinimumThumb "MinimumThumb"
+ #define XtCShown "Shown"
+ #define XtCTopOfThumb "TopOfThumb"
++#define XtCScrollbarBackground "ScrollbarBackground"
+ #define XtCPickTop "PickTop"
++#define XtCPushThumb "PushThumb"
+ 
+ #define XtNminimumThumb "minimumThumb"
+ #define XtNtopOfThumb "topOfThumb"
++#define XtNscrollbarBackground "scrollbarBackground"
+ #define XtNpickTop "pickTop"
++#define XtNpushThumb "pushThumb"
+ 
+ typedef struct _ScrollbarRec	  *ScrollbarWidget;
+ typedef struct _ScrollbarClassRec *ScrollbarWidgetClass;
+diff --git a/xc/lib/Xaw3d/ScrollbarP.h b/xc/lib/Xaw3d/ScrollbarP.h
+index d4c8b72..5573e1d 100644
+--- a/xc/lib/Xaw3d/ScrollbarP.h
++++ b/xc/lib/Xaw3d/ScrollbarP.h
+@@ -70,6 +70,7 @@ typedef struct {
+     XtCallbackList thumbProc;	/* jump (to position) scroll */
+     XtCallbackList jumpProc;	/* same as thumbProc but pass data by ref */
+     Pixmap	  thumb;	/* thumb color */
++    Pixel 	  background;	/* background color */
+ #ifndef XAW_ARROW_SCROLLBARS
+     Cursor        upCursor;	/* scroll up cursor */
+     Cursor        downCursor;	/* scroll down cursor */
+@@ -94,10 +95,12 @@ typedef struct {
+     Cursor        inactiveCursor; /* the normal cursor for scrollbar */
+     char          direction;	/* a scroll has started; which direction */
+ #endif
+-    GC		  gc;		/* a (shared) gc */
++    GC		  gc;		/* a (shared) gc for foreground */
++    GC		  bgc;		/* a (shared) gc for background */
+     Position	  topLoc;	/* Pixel that corresponds to top */
+     Dimension	  shownLength;	/* Num pixels corresponding to shown */
+-    Boolean       pick_top;     /* pick thumb at top or anywhere*/
++    Boolean       pick_top;     /* pick thumb at top or anywhere */
++    Boolean       push_thumb;   /* push thumb in or not */
+ 
+ } ScrollbarPart;
+ 
+diff --git a/xc/lib/Xaw3d/SimpleMenu.c b/xc/lib/Xaw3d/SimpleMenu.c
+index 2bf439d..96a1a61 100644
+--- a/xc/lib/Xaw3d/SimpleMenu.c
++++ b/xc/lib/Xaw3d/SimpleMenu.c
+@@ -547,7 +547,7 @@ Cardinal *num_args;
+ 	XDefineCursor(XtDisplay(new),
+ 		      XtWindow(new), smw_new->simple_menu.cursor);
+     
+-    if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) 
++    if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) {
+ 	if (smw_new->simple_menu.label_string == NULL)         /* Destroy. */
+ 	    XtDestroyWidget((Widget) smw_old->simple_menu.label);
+ 	else if (smw_old->simple_menu.label_string == NULL)    /* Create. */
+@@ -558,6 +558,7 @@ Cardinal *num_args;
+ 	    XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string);
+ 	    XtSetValues((Widget) smw_new->simple_menu.label, arglist, ONE);
+ 	}
++    }
+     
+     if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class)
+ 	XtAppWarning(XtWidgetToApplicationContext(new),
+diff --git a/xc/lib/Xaw3d/SmeThreeD.c b/xc/lib/Xaw3d/SmeThreeD.c
+index a01023c..ee4374c 100644
+--- a/xc/lib/Xaw3d/SmeThreeD.c
++++ b/xc/lib/Xaw3d/SmeThreeD.c
+@@ -71,7 +71,9 @@ static XtResource resources[] = {
+ 	offset(sme_threeD.shadowed), XtRImmediate, (XtPointer) False},
+     {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
+ 	XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
+-	(XtPointer)0}
++	(XtPointer)0},
++    {XtNinvertBorder, XtCInvertBorder, XtRBoolean, sizeof(Boolean),
++	offset(sme_threeD.invert_border), XtRImmediate, (XtPointer) False},
+ };
+ 
+ #undef offset
+@@ -209,7 +211,7 @@ static void AllocTopShadowPixmap (new)
+     Display		*dpy = XtDisplayOfObject (new);
+     Screen		*scn = XtScreenOfObject (new);
+     unsigned long	top_fg_pixel = 0, top_bg_pixel = 0;
+-    char		*pm_data;
++    char		*pm_data = NULL;
+     Boolean		create_pixmap = FALSE;
+ 
+     /*
+@@ -265,7 +267,7 @@ static void AllocBotShadowPixmap (new)
+     Display		*dpy = XtDisplayOfObject (new);
+     Screen		*scn = XtScreenOfObject (new);
+     unsigned long	bot_fg_pixel = 0, bot_bg_pixel = 0;
+-    char		*pm_data;
++    char		*pm_data  = NULL;
+     Boolean		create_pixmap = FALSE;
+ 
+     if (DefaultDepthOfScreen (scn) == 1) {
+@@ -568,8 +570,16 @@ _XawSme3dDrawShadows(gw)
+ 
+ 	if (tdo->sme_threeD.shadowed)
+ 	{
+-	    top = tdo->sme_threeD.top_shadow_GC;
+-	    bot = tdo->sme_threeD.bot_shadow_GC;
++	    if (tdo->sme_threeD.invert_border)
++	    {
++		bot = tdo->sme_threeD.top_shadow_GC;
++		top = tdo->sme_threeD.bot_shadow_GC;
++	    }
++	    else
++	    {
++		top = tdo->sme_threeD.top_shadow_GC;
++		bot = tdo->sme_threeD.bot_shadow_GC;
++	    }
+ 	}
+ 	else
+ 	    top = bot = tdo->sme_threeD.erase_GC;
+diff --git a/xc/lib/Xaw3d/SmeThreeD.h b/xc/lib/Xaw3d/SmeThreeD.h
+index b4d458f..bcffb8f 100644
+--- a/xc/lib/Xaw3d/SmeThreeD.h
++++ b/xc/lib/Xaw3d/SmeThreeD.h
+@@ -50,6 +50,7 @@ SOFTWARE.
+  bottomShadowContrast BottomShadowContrast Int           40
+  userData             UserData             XtPointer     NULL
+  beNiceToColormap     BeNiceToColormap     Boolean       False
++ invertBorder         InvertBorder         Boolean       False
+ 
+ */
+ 
+@@ -67,6 +68,8 @@ SOFTWARE.
+ #define XtCBeNiceToColormap "BeNiceToColormap"
+ #define XtNbeNiceToColourmap "beNiceToColormap"
+ #define XtCBeNiceToColourmap "BeNiceToColormap"
++#define XtNinvertBorder "invertBorder"
++#define XtCInvertBorder "InvertBorder"
+ #define XtNuserData "userData"
+ #define XtCUserData "UserData"
+ 
+diff --git a/xc/lib/Xaw3d/SmeThreeDP.h b/xc/lib/Xaw3d/SmeThreeDP.h
+index a07dd40..15e222a 100644
+--- a/xc/lib/Xaw3d/SmeThreeDP.h
++++ b/xc/lib/Xaw3d/SmeThreeDP.h
+@@ -47,6 +47,7 @@ typedef struct {
+     XtPointer	    user_data;
+     Boolean	    be_nice_to_cmap;
+     Boolean	    shadowed;
++    Boolean	    invert_border;
+   } SmeThreeDPart;
+ 
+ /* Full instance record declaration */
+diff --git a/xc/lib/Xaw3d/StripChart.c b/xc/lib/Xaw3d/StripChart.c
+index 5344f97..14e808d 100644
+--- a/xc/lib/Xaw3d/StripChart.c
++++ b/xc/lib/Xaw3d/StripChart.c
+@@ -292,7 +292,7 @@ XtIntervalId *id;		/* unused */
+        if (XtIsRealized((Widget)w) && 
+ 	   w->strip_chart.max_value > w->strip_chart.scale) {
+ 	   XClearWindow(XtDisplay ((Widget) w), XtWindow ((Widget) w));
+-	   w->strip_chart.interval = repaint_window((Widget)w, 0, (int) w->core.width - 2 * s);
++	   w->strip_chart.interval = repaint_window((Widget)w, 0, (int) w->core.width);
+ 	   (*swclass->threeD_class.shadowdraw) ((Widget) w, 
+ 						(XEvent *)0, (Region)0, 
+ 						w->threeD.relief, FALSE);
+@@ -315,7 +315,7 @@ XtIntervalId *id;		/* unused */
+        if (w->strip_chart.points != NULL) {
+ 	   w->strip_chart.points[0].x = w->strip_chart.interval + s;
+ 	   XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC,
+-		       w->strip_chart.points, w->strip_chart.scale,
++		       w->strip_chart.points, (w->strip_chart.scale - 1),
+ 		       CoordModePrevious);
+        }
+ 
+@@ -346,6 +346,7 @@ int left, width;
+     int next = w->strip_chart.interval;
+     int scale = w->strip_chart.scale;
+     int scalewidth = 0;
++    int margin = w->core.width - s;
+ 
+     /* Compute the minimum scale required to graph the data, but don't go
+        lower than min_scale. */
+@@ -358,7 +359,7 @@ int left, width;
+       w->strip_chart.scale = scale;
+       left = 0;
+       width = next;				/* check this */
+-      scalewidth = w->core.width - 2 * s;
++      scalewidth = w->core.width - 2 * s - 1;
+ 
+       SetPoints(gw);
+ 
+@@ -373,10 +374,18 @@ int left, width;
+ 	Display *dpy = XtDisplay(gw);
+ 	Window win = XtWindow(gw);
+ 
+-	width += left - 1;
+-	if (!scalewidth) scalewidth = width;
++	if (left < s) left = 0;
++	else left -= s;
++	if (left >= margin) left = margin - 1;
+ 
+-	if (next < (++width - s)) width = next + s;
++	width += (left - 1);
++
++	if (!scalewidth) {
++	    scalewidth = w->core.width - 2 * s - 1;
++	    if (width < scalewidth) scalewidth = width;
++	}
++
++	if (next < ++width) width = next;
+ 
+ 	/* Draw data point lines. */
+ 	for (i = left; i < width; i++) {
+@@ -390,7 +399,7 @@ int left, width;
+ 	}
+ 
+ 	/* Draw graph reference lines */
+-	for (i = 1; i < w->strip_chart.scale; i++) {
++	if (left <= scalewidth) for (i = 1; i < w->strip_chart.scale; i++) {
+             j = i * ((w->core.height - 2 * s) / w->strip_chart.scale);
+ 	    XDrawLine(dpy, win, w->strip_chart.hiGC, 
+ 		left + s, j + s, scalewidth + s, j + s);
+@@ -415,6 +424,7 @@ Boolean blit;
+     double old_max;
+     int left, i, j;
+     int next = w->strip_chart.interval;
++    int margin = w->core.width - s;
+ 
+     if (!XtIsRealized((Widget) w)) return;
+ 
+@@ -447,7 +457,7 @@ Boolean blit;
+ 
+     if ( ((int) old_max) != ( (int) w->strip_chart.max_value) ) {
+       XClearWindow(XtDisplay(w), XtWindow(w));
+-      repaint_window((Widget)w, 0, w->core.width - 2 * s);
++      repaint_window((Widget)w, 0, w->core.width);
+       return;
+     }
+ 
+@@ -466,12 +476,13 @@ Boolean blit;
+ 	       FALSE);
+ 
+     /* Draw graph reference lines */
+-    left = j;
+-    for (i = 1; i < w->strip_chart.scale; i++) {
+-	j = i * ((w->core.height - 2 * s) / w->strip_chart.scale);
+-	XDrawLine(XtDisplay((Widget) w), XtWindow( (Widget) w),
+-	    w->strip_chart.hiGC, 
+-	    left, j + s, ((int)w->core.width - s - 1), j + s);
++    if ((left = j) < margin) {
++	for (i = 1; i < w->strip_chart.scale; i++) {
++	    j = i * ((w->core.height - 2 * s) / w->strip_chart.scale);
++	    XDrawLine(XtDisplay((Widget) w), XtWindow( (Widget) w),
++		w->strip_chart.hiGC, 
++		left, j + s, margin - 1, j + s);
++	}
+     }
+     return;
+ }
+@@ -523,7 +534,7 @@ static Boolean SetValues (current, request, new, args, num_args)
+  *	Returns: none.
+  */
+ 
+-#define HEIGHT ( (unsigned int) w->core.height)
++#define HEIGHT ( (double)w->core.height - 2.0 * (double)s )
+ 
+ static void
+ SetPoints(widget)
+@@ -550,7 +561,7 @@ Widget widget;
+ 
+     for (i = 1; i < w->strip_chart.scale; i++) {
+ 	points[i - 1].x = 0;
+-	points[i - 1].y = ( short)(((double)w->core.height - 2.0 * (double) s) / (double) w->strip_chart.scale );
++	points[i - 1].y = (short)(HEIGHT / (double) w->strip_chart.scale);
+     }
+     points[0].y += (short)s;
+ }
+diff --git a/xc/lib/Xaw3d/Text.c b/xc/lib/Xaw3d/Text.c
+index 32a3f8d..1716890 100644
+--- a/xc/lib/Xaw3d/Text.c
++++ b/xc/lib/Xaw3d/Text.c
+@@ -1150,11 +1150,12 @@ TextWidget ctx;
+ 	_XawTextBuildLineTable (ctx, zeroPosition, FALSE);
+     }
+   }
+-  else if (ctx->text.vbar != NULL)
++  else if (ctx->text.vbar != NULL) {
+     if (ctx->text.scroll_vert == XawtextScrollWhenNeeded)
+       DestroyVScrollBar(ctx);
+     else if (ctx->text.scroll_vert == XawtextScrollAlways)
+       XawScrollbarSetThumb(ctx->text.vbar, 0.0, 1.0);
++  }
+ }
+ 
+ /*
+@@ -1182,11 +1183,12 @@ TextWidget ctx;
+   else
+     widest = ctx->core.width - 2 * s;
+   widest /= (last = GetWidestLine(ctx));
+-  if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded) 
++  if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded) {
+     if (widest < 1.0)
+       CreateHScrollBar(ctx);
+     else
+       DestroyHScrollBar(ctx);
++  }
+ 
+   if ( (ctx->text.hbar == NULL) != temp ) {
+     _XawTextBuildLineTable (ctx, ctx->text.lt.top, TRUE);
+diff --git a/xc/lib/Xaw3d/TextAction.c b/xc/lib/Xaw3d/TextAction.c
+index 65b8539..32c8e51 100644
+--- a/xc/lib/Xaw3d/TextAction.c
++++ b/xc/lib/Xaw3d/TextAction.c
+@@ -1852,6 +1852,7 @@ Cardinal* num_params;
+ {
+   TextWidget ctx = (TextWidget) w;
+   int mult;
++  int atoi();
+ 
+   if (*num_params != 1) {
+       XtAppError( XtWidgetToApplicationContext( w ), 
+diff --git a/xc/lib/Xaw3d/TextPop.c b/xc/lib/Xaw3d/TextPop.c
+index cf01b4f..ee3e595 100644
+--- a/xc/lib/Xaw3d/TextPop.c
++++ b/xc/lib/Xaw3d/TextPop.c
+@@ -1064,13 +1064,14 @@ Boolean once_only, show_current;
+     else
+       XawTextSetInsertionPoint( tw, pos);
+ 
+-    if (once_only) 
++    if (once_only) {
+       if (show_current)
+ 	break;
+       else {
+ 	DoSearch(search);
+ 	return(TRUE);
+       }
++    }
+     count++;
+   }
+ 
+diff --git a/xc/lib/Xaw3d/ThreeD.c b/xc/lib/Xaw3d/ThreeD.c
+index 8166a7c..65251f8 100644
+--- a/xc/lib/Xaw3d/ThreeD.c
++++ b/xc/lib/Xaw3d/ThreeD.c
+@@ -73,6 +73,8 @@ static XtResource resources[] = {
+     {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
+ 	XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
+ 	(XtPointer)0},
++    {XtNinvertBorder, XtCInvertBorder, XtRBoolean, sizeof(Boolean),
++	offset(threeD.invert_border), XtRImmediate, (XtPointer) False},
+     {XtNrelief, XtCRelief, XtRRelief, sizeof(XtRelief),
+ 	offset(threeD.relief), XtRString, (XtPointer) defRelief}
+ };
+@@ -222,14 +224,13 @@ static void AllocTopShadowPixmap (new)
+ 	if (tdw->core.background_pixel == WhitePixelOfScreen (scn) ||
+ 	    tdw->core.background_pixel == BlackPixelOfScreen (scn)) {
+ 	    pm_data = mtshadowpm_bits;
+-       	    pm_size = mtshadowpm_size;
+-       } else 
++	    pm_size = mtshadowpm_size;
++	} else 
+ #endif
+-       {
+-       	    pm_data = shadowpm_bits;
+-            pm_size = shadowpm_size;
+-       }
+-	
++	{
++	    pm_data = shadowpm_bits;
++	    pm_size = shadowpm_size;
++	}
+ 	create_pixmap = TRUE;
+     } else {
+ 	pm_size = 0; /* keep gcc happy */
+@@ -651,7 +652,7 @@ _Xaw3dDrawShadows (gw, event, region, relief, out)
+ 	GC		realbot = tdw->threeD.bot_shadow_GC;
+ 	GC		top, bot;
+ 
+-	if (out) {
++	if ((out ^ tdw->threeD.invert_border)) {
+ 	    top = tdw->threeD.top_shadow_GC;
+ 	    bot = tdw->threeD.bot_shadow_GC;
+ 	} else {
+@@ -792,7 +793,7 @@ Boolean out;
+ 	Window win = XtWindow(gw);
+ 	GC top, bot;
+ 
+-	if (out)
++	if ((out ^ tdw->threeD.invert_border))
+ 	{
+ 	    top = tdw->threeD.top_shadow_GC;
+ 	    bot = tdw->threeD.bot_shadow_GC;
+diff --git a/xc/lib/Xaw3d/ThreeD.h b/xc/lib/Xaw3d/ThreeD.h
+index d7cf8e2..a2f6570 100644
+--- a/xc/lib/Xaw3d/ThreeD.h
++++ b/xc/lib/Xaw3d/ThreeD.h
+@@ -49,6 +49,7 @@ SOFTWARE.
+  bottomShadowContrast BottomShadowContrast Int           40
+  userData             UserData             XtPointer     NULL
+  beNiceToColormap     BeNiceToColormap     Boolean       False
++ invertBorder	      InvertBorder	   Boolean	 False
+  relief               Relief               XtRelief      XtReliefRaised
+ 
+ */
+@@ -67,6 +68,8 @@ SOFTWARE.
+ #define XtCBeNiceToColormap "BeNiceToColormap"
+ #define XtNbeNiceToColourmap "beNiceToColormap"
+ #define XtCBeNiceToColourmap "BeNiceToColormap"
++#define XtNinvertBorder "invertBorder"
++#define XtCInvertBorder "InvertBorder"
+ #define XtNuserData "userData"
+ #define XtCUserData "UserData"
+ #define XtNrelief "relief"
+diff --git a/xc/lib/Xaw3d/ThreeDP.h b/xc/lib/Xaw3d/ThreeDP.h
+index 44ccb97..c61bf78 100644
+--- a/xc/lib/Xaw3d/ThreeDP.h
++++ b/xc/lib/Xaw3d/ThreeDP.h
+@@ -47,6 +47,7 @@ typedef struct {
+     GC		bot_shadow_GC;
+     XtPointer	user_data;
+     Boolean	be_nice_to_cmap;
++    Boolean	invert_border;
+     XtRelief	relief;
+   } ThreeDPart;
+ 
+diff --git a/xc/lib/Xaw3d/Toggle.c b/xc/lib/Xaw3d/Toggle.c
+index 66902c4..bd97876 100644
+--- a/xc/lib/Xaw3d/Toggle.c
++++ b/xc/lib/Xaw3d/Toggle.c
+@@ -499,10 +499,11 @@ Widget w, radio_group;
+   if ( tw->command.set && radio_group != NULL )
+     XawToggleUnsetCurrent(radio_group);
+ 
+-  if (radio_group != NULL)
++  if (radio_group != NULL) {
+       if ((group = GetRadioGroup(radio_group)) == NULL)
+ 	  CreateRadioGroup(w, radio_group);
+       else AddToRadioGroup(group, w);
++  }
+ }
+ 
+ /*	Function Name: XawToggleGetCurrent
+diff --git a/xc/lib/Xaw3d/Viewport.c b/xc/lib/Xaw3d/Viewport.c
+index b257cd3..813cea6 100644
+--- a/xc/lib/Xaw3d/Viewport.c
++++ b/xc/lib/Xaw3d/Viewport.c
+@@ -824,17 +824,19 @@ int *clip_width, *clip_height;
+         if ( (w->viewport.allowvert || w->viewport.allowhoriz) ) { 
+ 	    XtQueryGeometry( child, intended, &preferred );
+ 	  
+-	    if ( !(intended->request_mode & CWWidth) )
++	    if ( !(intended->request_mode & CWWidth) ) {
+ 	        if ( preferred.request_mode & CWWidth )
+ 		    intended->width = preferred.width;
+ 		else
+ 		    intended->width = child->core.width;
++	    }
+ 
+-	    if ( !(intended->request_mode & CWHeight) )
++	    if ( !(intended->request_mode & CWHeight) ) {
+ 	        if ( preferred.request_mode & CWHeight )
+ 		    intended->height = preferred.height;
+ 		else
+ 		    intended->height = child->core.height;
++	    }
+ 	}
+     }
+     else {
+diff --git a/xc/lib/Xaw3d/XawI18n.c b/xc/lib/Xaw3d/XawI18n.c
+index c911057..9204ff4 100644
+--- a/xc/lib/Xaw3d/XawI18n.c
++++ b/xc/lib/Xaw3d/XawI18n.c
+@@ -68,6 +68,9 @@ wchar_t _Xaw_atowc(c)
+ {
+     wchar_t  wc;
+     char str[2];
++#ifndef USE_XMBTOWC
++    int mbtowc();
++#endif
+ 
+     str[0] = c;
+     str[1] = '\0';
+diff --git a/xc/lib/Xaw3d/XawI18n.h b/xc/lib/Xaw3d/XawI18n.h
+index b0176bf..9c02c76 100644
+--- a/xc/lib/Xaw3d/XawI18n.h
++++ b/xc/lib/Xaw3d/XawI18n.h
+@@ -58,10 +58,12 @@ extern int _Xaw_iswspace(wchar_t);
+ #endif
+ 
+ #ifdef USE_XWCHAR_STRING
++int _Xwcsncpy(), _Xwcscpy(), _Xwcslen();
+ #define wcslen(c) _Xwcslen(c)
+ #define wcscpy(d,s) _Xwcscpy(d,s)
+ #define wcsncpy(d,s,l) _Xwcsncpy(d,s,l)
+ #ifdef USE_XMBTOWC
++int _Xmbtowc();
+ #define mbtowc(wc,s,l) _Xmbtowc(wc,s,l)
+ #endif
+ #endif
+diff --git a/xc/lib/Xaw3d/XawIm.c b/xc/lib/Xaw3d/XawIm.c
+index a5d0032..2cf2113 100644
+--- a/xc/lib/Xaw3d/XawIm.c
++++ b/xc/lib/Xaw3d/XawIm.c
+@@ -1080,6 +1080,7 @@ static void SetValues( w, ve, args, num_args )
+     XrmResourceList	xrmres;
+     int	i;
+     XawIcTablePart	*p, save_tbl;
++    void	_XtCopyFromArg();
+ 
+     if ((p = GetIcTable(w, ve)) == NULL) return;
+ 
+@@ -1331,8 +1332,6 @@ static Boolean Initialize( vw, ve )
+     VendorShellWidget vw;
+     XawVendorShellExtPart* ve;
+ {
+-    int 	i;
+-
+     if (!XtIsVendorShell((Widget)vw)) return(FALSE);
+     ve->parent = (Widget)vw;
+     ve->im.xim = NULL;
+@@ -1531,6 +1530,8 @@ _XawImSetValues( inwidg, args, num_args )
+     SetFocusValues( inwidg, args, num_args, FALSE );
+ }
+ 
++void _XtCountVaList(), _XtVaToArgList();
++
+ void
+ #if NeedVarargsPrototypes
+ _XawImVASetValues( Widget inwidg, ... )
+-- 
+1.6.1
+


More information about the scm-commits mailing list