Blame SOURCES/Xaw3d-1.6.1-hsbar.patch

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