Blame SOURCES/Xaw3d-1.6.1-hsbar.patch

7ed9bc
diff -up libXaw3d-1.6.1/src/Text.c.hsbar libXaw3d-1.6.1/src/Text.c
7ed9bc
--- libXaw3d-1.6.1/src/Text.c.hsbar	2011-10-06 13:17:19.000000000 -0600
7ed9bc
+++ libXaw3d-1.6.1/src/Text.c	2012-02-25 14:54:41.996656624 -0700
7ed9bc
@@ -495,8 +495,10 @@ CreateHScrollBar(TextWidget ctx)
7ed9bc
 		    (XtPointer) NULL);
7ed9bc
 
7ed9bc
 /**/
7ed9bc
-  ctx->text.r_margin.bottom += hbar->core.height + hbar->core.border_width;
7ed9bc
-  ctx->text.margin.bottom = ctx->text.r_margin.bottom;
7ed9bc
+  if (ctx->text.scroll_vert == XawtextScrollAlways) {
7ed9bc
+    ctx->text.r_margin.bottom += hbar->core.height + hbar->core.border_width;
7ed9bc
+    ctx->text.margin.bottom = ctx->text.r_margin.bottom;
7ed9bc
+  }
7ed9bc
 /**/
7ed9bc
   PositionHScrollBar(ctx);
7ed9bc
   if (XtIsRealized((Widget)ctx)) {
7ed9bc
@@ -519,8 +521,10 @@ DestroyHScrollBar(TextWidget ctx)
7ed9bc
   if (hbar == NULL) return;
7ed9bc
 
7ed9bc
 /**/
7ed9bc
-  ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
7ed9bc
-  ctx->text.margin.bottom = ctx->text.r_margin.bottom;
7ed9bc
+  if (ctx->text.scroll_vert == XawtextScrollAlways) {
7ed9bc
+    ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
7ed9bc
+    ctx->text.margin.bottom = ctx->text.r_margin.bottom;
7ed9bc
+  }
7ed9bc
 /**/
7ed9bc
   if (ctx->text.vbar == NULL)
7ed9bc
       XtRemoveCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars,
7ed9bc
diff -up libXaw3d-1.6.1/src/Viewport.c.hsbar libXaw3d-1.6.1/src/Viewport.c
7ed9bc
--- libXaw3d-1.6.1/src/Viewport.c.hsbar	2012-01-24 14:56:03.000000000 -0700
7ed9bc
+++ libXaw3d-1.6.1/src/Viewport.c	2012-02-25 14:58:18.474098582 -0700
7ed9bc
@@ -244,7 +244,7 @@ Initialize(Widget request, Widget new, A
7ed9bc
     XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
7ed9bc
     if (sw)
7ed9bc
     {
7ed9bc
-	pad = 2;
7ed9bc
+	pad = 2 * sw;
7ed9bc
 
7ed9bc
 	arg_cnt = 0;
7ed9bc
 	XtSetArg(threeD_args[arg_cnt], XtNborderWidth, 0); arg_cnt++;
7ed9bc
@@ -262,8 +262,8 @@ Initialize(Widget request, Widget new, A
7ed9bc
     XtSetArg(clip_args[arg_cnt], XtNright, XtChainRight); arg_cnt++;
7ed9bc
     XtSetArg(clip_args[arg_cnt], XtNtop, XtChainTop); arg_cnt++;
7ed9bc
     XtSetArg(clip_args[arg_cnt], XtNbottom, XtChainBottom); arg_cnt++;
7ed9bc
-    XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width - 2 * sw); arg_cnt++;
7ed9bc
-    XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height - 2 * sw); arg_cnt++;
7ed9bc
+    XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width - pad); arg_cnt++;
7ed9bc
+    XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height - pad); arg_cnt++;
7ed9bc
 
7ed9bc
     w->viewport.clip = XtCreateManagedWidget("clip", widgetClass, new,
7ed9bc
 					     clip_args, arg_cnt);
7ed9bc
@@ -283,8 +283,8 @@ Initialize(Widget request, Widget new, A
7ed9bc
  * Set the clip widget to the correct height.
7ed9bc
  */
7ed9bc
 
7ed9bc
-    clip_width = w->core.width - 2 * sw;
7ed9bc
-    clip_height = w->core.height - 2 * sw;
7ed9bc
+    clip_width = w->core.width - pad;
7ed9bc
+    clip_height = w->core.height - pad;
7ed9bc
 
7ed9bc
     if ( (h_bar != NULL) &&
7ed9bc
 	 ((int)w->core.width >
7ed9bc
@@ -509,23 +509,13 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
     XtWidgetGeometry intended;
7ed9bc
     Dimension pad = 0, sw = 0;
7ed9bc
 
7ed9bc
-    /*
7ed9bc
-     * I've made two optimizations here. The first does away with the
7ed9bc
-     * loop, and the second defers setting the child dimensions to the
7ed9bc
-     * clip if smaller until after adjusting for possible scrollbars.
7ed9bc
-     * If you find that these go too far, define the identifiers here
7ed9bc
-     * as required.  -- djhjr
7ed9bc
-     */
7ed9bc
-#define NEED_LAYOUT_LOOP
7ed9bc
-#undef PREP_CHILD_TO_CLIP
7ed9bc
-
7ed9bc
     if (child == (Widget) NULL) return;
7ed9bc
 
7ed9bc
     XtVaGetValues(threeD, XtNshadowWidth, &sw, NULL);
7ed9bc
-    if (sw) pad = 2;
7ed9bc
+    if (sw) pad = 2 * sw;
7ed9bc
 
7ed9bc
-    clip_width = w->core.width - 2 * sw;
7ed9bc
-    clip_height = w->core.height - 2 * sw;
7ed9bc
+    clip_width = w->core.width - pad;
7ed9bc
+    clip_height = w->core.height - pad;
7ed9bc
     intended.request_mode = CWBorderWidth;
7ed9bc
     intended.border_width = 0;
7ed9bc
 
7ed9bc
@@ -536,10 +526,8 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 			     &clip_width, &clip_height);
7ed9bc
     }
7ed9bc
     else {
7ed9bc
-#ifdef NEED_LAYOUT_LOOP
7ed9bc
         Dimension prev_width, prev_height;
7ed9bc
 	XtGeometryMask prev_mode;
7ed9bc
-#endif
7ed9bc
 	XtWidgetGeometry preferred;
7ed9bc
 
7ed9bc
 	needshoriz = needsvert = False;
7ed9bc
@@ -553,31 +541,25 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 	if (!w->viewport.allowhoriz)
7ed9bc
 	    intended.request_mode |= CWWidth;
7ed9bc
 
7ed9bc
-#ifdef PREP_CHILD_TO_CLIP
7ed9bc
-	if ((int)child->core.width < clip_width)
7ed9bc
-	    intended.width = clip_width;
7ed9bc
+	if ((int)child->core.width < clip_width + pad)
7ed9bc
+	    intended.width = clip_width + pad;
7ed9bc
 	else
7ed9bc
-#endif
7ed9bc
 	    intended.width = child->core.width;
7ed9bc
 
7ed9bc
-	if (!w->viewport.allowvert)
7ed9bc
-	    intended.request_mode |= CWHeight;
7ed9bc
-
7ed9bc
-#ifdef PREP_CHILD_TO_CLIP
7ed9bc
-	if ((int)child->core.height < clip_height)
7ed9bc
-	    intended.height = clip_height;
7ed9bc
+	if ((int)child->core.height < clip_height + pad)
7ed9bc
+	    intended.height = clip_height + pad;
7ed9bc
 	else
7ed9bc
-#endif
7ed9bc
 	    intended.height = child->core.height;
7ed9bc
 
7ed9bc
+	if (!w->viewport.allowvert) 
7ed9bc
+	    intended.request_mode |= CWHeight;
7ed9bc
+
7ed9bc
 	if (!query) {
7ed9bc
 	    preferred.width = child->core.width;
7ed9bc
 	    preferred.height = child->core.height;
7ed9bc
 	}
7ed9bc
 
7ed9bc
-#ifdef NEED_LAYOUT_LOOP
7ed9bc
 	do { /* while intended != prev */
7ed9bc
-#endif
7ed9bc
 	    if (query) {
7ed9bc
 	        (void) XtQueryGeometry( child, &intended, &preferred );
7ed9bc
 		if ( !(preferred.request_mode & CWWidth) )
7ed9bc
@@ -585,12 +567,9 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 		if ( !(preferred.request_mode & CWHeight) )
7ed9bc
 		    preferred.height = intended.height;
7ed9bc
 	    }
7ed9bc
-
7ed9bc
-#ifdef NEED_LAYOUT_LOOP
7ed9bc
 	    prev_width = intended.width;
7ed9bc
 	    prev_height = intended.height;
7ed9bc
 	    prev_mode = intended.request_mode;
7ed9bc
-#endif
7ed9bc
 
7ed9bc
 	    /*
7ed9bc
 	     * Note that having once decided to turn on either bar
7ed9bc
@@ -600,7 +579,7 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 
7ed9bc
 #define CheckHoriz()							\
7ed9bc
 	    if (w->viewport.allowhoriz &&				\
7ed9bc
-		    (int)preferred.width > clip_width + 2 * sw) {	\
7ed9bc
++		    (int)preferred.width > clip_width + pad) {		\
7ed9bc
 		if (!needshoriz) {					\
7ed9bc
 		    Widget horiz_bar = w->viewport.horiz_bar;		\
7ed9bc
 		    needshoriz = True;					\
7ed9bc
@@ -615,7 +594,7 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 /* enddef */
7ed9bc
 	    CheckHoriz();
7ed9bc
 	    if (w->viewport.allowvert &&
7ed9bc
-		    (int)preferred.height > clip_height + 2 * sw) {
7ed9bc
+		    (int)preferred.height > clip_height + pad) {
7ed9bc
 		if (!needsvert) {
7ed9bc
 		    Widget vert_bar = w->viewport.vert_bar;
7ed9bc
 		    needsvert = True;
7ed9bc
@@ -629,38 +608,22 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 		intended.height = preferred.height;
7ed9bc
 	    }
7ed9bc
 
7ed9bc
-#ifdef PREP_CHILD_TO_CLIP
7ed9bc
 	    if (!w->viewport.allowhoriz ||
7ed9bc
-		    (int)preferred.width < clip_width) {
7ed9bc
-	        intended.width = clip_width;
7ed9bc
+		    (int)preferred.width < clip_width + pad) {
7ed9bc
+	        intended.width = clip_width + pad;
7ed9bc
 		intended.request_mode |= CWWidth;
7ed9bc
 	    }
7ed9bc
 	    if (!w->viewport.allowvert ||
7ed9bc
-		    (int)preferred.height < clip_height) {
7ed9bc
-	        intended.height = clip_height;
7ed9bc
+		    (int)preferred.height < clip_height + pad) {
7ed9bc
+	        intended.height = clip_height + pad;
7ed9bc
 		intended.request_mode |= CWHeight;
7ed9bc
 	    }
7ed9bc
-#endif
7ed9bc
-#ifdef NEED_LAYOUT_LOOP
7ed9bc
+
7ed9bc
 	} while ( intended.request_mode != prev_mode ||
7ed9bc
 		  (intended.request_mode & CWWidth &&
7ed9bc
 			intended.width != prev_width) ||
7ed9bc
 		  (intended.request_mode & CWHeight &&
7ed9bc
 			intended.height != prev_height) );
7ed9bc
-#endif
7ed9bc
-
7ed9bc
-#ifndef PREP_CHILD_TO_CLIP
7ed9bc
-	if (!w->viewport.allowhoriz ||
7ed9bc
-		(int)preferred.width < clip_width) {
7ed9bc
-	    intended.width = clip_width;
7ed9bc
-	    intended.request_mode |= CWWidth;
7ed9bc
-	}
7ed9bc
-	if (!w->viewport.allowvert ||
7ed9bc
-		(int)preferred.height < clip_height) {
7ed9bc
-	    intended.height = clip_height;
7ed9bc
-	    intended.request_mode |= CWHeight;
7ed9bc
-	}
7ed9bc
-#endif
7ed9bc
     }
7ed9bc
 
7ed9bc
     bar_width = bar_height = 0;
7ed9bc
@@ -705,7 +668,7 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 	else {
7ed9bc
 	    int bw = bar->core.border_width;
7ed9bc
 	    XtResizeWidget( bar,
7ed9bc
-			    (Dimension)(clip_width + 2 * sw), bar->core.height,
7ed9bc
+			    (Dimension)(clip_width + pad), bar->core.height,
7ed9bc
 			    (Dimension)bw );
7ed9bc
 	    XtMoveWidget( bar,
7ed9bc
 			  (Position)((needsvert && !w->viewport.useright)
7ed9bc
@@ -730,7 +693,7 @@ ComputeLayout(Widget widget, Boolean que
7ed9bc
 	else {
7ed9bc
 	    int bw = bar->core.border_width;
7ed9bc
 	    XtResizeWidget( bar,
7ed9bc
-			    bar->core.width, (Dimension)(clip_height + 2 * sw),
7ed9bc
+			    bar->core.width, (Dimension)(clip_height + pad),
7ed9bc
 			    (Dimension)bw );
7ed9bc
 	    XtMoveWidget( bar,
7ed9bc
 			  (Position)(w->viewport.useright
7ed9bc
@@ -780,7 +743,7 @@ ComputeWithForceBars(Widget widget, Bool
7ed9bc
  */
7ed9bc
 
7ed9bc
     XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
7ed9bc
-    if (sw) pad = 2;
7ed9bc
+    if (sw) pad = 2 * sw;
7ed9bc
 
7ed9bc
     if (w->viewport.allowvert) {
7ed9bc
 	if (w->viewport.vert_bar == NULL)
7ed9bc
@@ -926,7 +889,7 @@ GeometryRequestPlusScrollbar(ViewportWid
7ed9bc
   Dimension pad = 0, sw = 0;
7ed9bc
 
7ed9bc
   XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
7ed9bc
-  if (sw) pad = 2;
7ed9bc
+  if (sw) pad = 2 * sw;
7ed9bc
 
7ed9bc
   plusScrollbars = *request;
7ed9bc
   if ((bar = w->viewport.horiz_bar) == (Widget)NULL)
7ed9bc
@@ -997,7 +960,7 @@ GeometryManager(Widget child, XtWidgetGe
7ed9bc
 	return XtGeometryNo;
7ed9bc
 
7ed9bc
     XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
7ed9bc
-    if (sw) pad = 2;
7ed9bc
+    if (sw) pad = 2 * sw;
7ed9bc
 
7ed9bc
     allowed = *request;
7ed9bc