Blame SOURCES/Xaw3d-1.6.1-hsbar.patch

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