Xaw3d-1.6.1-hsbar.patch 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. diff -up libXaw3d-1.6.1/src/Text.c.hsbar libXaw3d-1.6.1/src/Text.c
  2. --- libXaw3d-1.6.1/src/Text.c.hsbar 2011-10-06 13:17:19.000000000 -0600
  3. +++ libXaw3d-1.6.1/src/Text.c 2012-02-25 14:54:41.996656624 -0700
  4. @@ -495,8 +495,10 @@ CreateHScrollBar(TextWidget ctx)
  5. (XtPointer) NULL);
  6. /**/
  7. - ctx->text.r_margin.bottom += hbar->core.height + hbar->core.border_width;
  8. - ctx->text.margin.bottom = ctx->text.r_margin.bottom;
  9. + if (ctx->text.scroll_vert == XawtextScrollAlways) {
  10. + ctx->text.r_margin.bottom += hbar->core.height + hbar->core.border_width;
  11. + ctx->text.margin.bottom = ctx->text.r_margin.bottom;
  12. + }
  13. /**/
  14. PositionHScrollBar(ctx);
  15. if (XtIsRealized((Widget)ctx)) {
  16. @@ -519,8 +521,10 @@ DestroyHScrollBar(TextWidget ctx)
  17. if (hbar == NULL) return;
  18. /**/
  19. - ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
  20. - ctx->text.margin.bottom = ctx->text.r_margin.bottom;
  21. + if (ctx->text.scroll_vert == XawtextScrollAlways) {
  22. + ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
  23. + ctx->text.margin.bottom = ctx->text.r_margin.bottom;
  24. + }
  25. /**/
  26. if (ctx->text.vbar == NULL)
  27. XtRemoveCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars,
  28. diff -up libXaw3d-1.6.1/src/Viewport.c.hsbar libXaw3d-1.6.1/src/Viewport.c
  29. --- libXaw3d-1.6.1/src/Viewport.c.hsbar 2012-01-24 14:56:03.000000000 -0700
  30. +++ libXaw3d-1.6.1/src/Viewport.c 2012-02-25 14:58:18.474098582 -0700
  31. @@ -244,7 +244,7 @@ Initialize(Widget request, Widget new, A
  32. XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
  33. if (sw)
  34. {
  35. - pad = 2;
  36. + pad = 2 * sw;
  37. arg_cnt = 0;
  38. XtSetArg(threeD_args[arg_cnt], XtNborderWidth, 0); arg_cnt++;
  39. @@ -262,8 +262,8 @@ Initialize(Widget request, Widget new, A
  40. XtSetArg(clip_args[arg_cnt], XtNright, XtChainRight); arg_cnt++;
  41. XtSetArg(clip_args[arg_cnt], XtNtop, XtChainTop); arg_cnt++;
  42. XtSetArg(clip_args[arg_cnt], XtNbottom, XtChainBottom); arg_cnt++;
  43. - XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width - 2 * sw); arg_cnt++;
  44. - XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height - 2 * sw); arg_cnt++;
  45. + XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width - pad); arg_cnt++;
  46. + XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height - pad); arg_cnt++;
  47. w->viewport.clip = XtCreateManagedWidget("clip", widgetClass, new,
  48. clip_args, arg_cnt);
  49. @@ -283,8 +283,8 @@ Initialize(Widget request, Widget new, A
  50. * Set the clip widget to the correct height.
  51. */
  52. - clip_width = w->core.width - 2 * sw;
  53. - clip_height = w->core.height - 2 * sw;
  54. + clip_width = w->core.width - pad;
  55. + clip_height = w->core.height - pad;
  56. if ( (h_bar != NULL) &&
  57. ((int)w->core.width >
  58. @@ -509,23 +509,13 @@ ComputeLayout(Widget widget, Boolean que
  59. XtWidgetGeometry intended;
  60. Dimension pad = 0, sw = 0;
  61. - /*
  62. - * I've made two optimizations here. The first does away with the
  63. - * loop, and the second defers setting the child dimensions to the
  64. - * clip if smaller until after adjusting for possible scrollbars.
  65. - * If you find that these go too far, define the identifiers here
  66. - * as required. -- djhjr
  67. - */
  68. -#define NEED_LAYOUT_LOOP
  69. -#undef PREP_CHILD_TO_CLIP
  70. -
  71. if (child == (Widget) NULL) return;
  72. XtVaGetValues(threeD, XtNshadowWidth, &sw, NULL);
  73. - if (sw) pad = 2;
  74. + if (sw) pad = 2 * sw;
  75. - clip_width = w->core.width - 2 * sw;
  76. - clip_height = w->core.height - 2 * sw;
  77. + clip_width = w->core.width - pad;
  78. + clip_height = w->core.height - pad;
  79. intended.request_mode = CWBorderWidth;
  80. intended.border_width = 0;
  81. @@ -536,10 +526,8 @@ ComputeLayout(Widget widget, Boolean que
  82. &clip_width, &clip_height);
  83. }
  84. else {
  85. -#ifdef NEED_LAYOUT_LOOP
  86. Dimension prev_width, prev_height;
  87. XtGeometryMask prev_mode;
  88. -#endif
  89. XtWidgetGeometry preferred;
  90. needshoriz = needsvert = False;
  91. @@ -553,31 +541,25 @@ ComputeLayout(Widget widget, Boolean que
  92. if (!w->viewport.allowhoriz)
  93. intended.request_mode |= CWWidth;
  94. -#ifdef PREP_CHILD_TO_CLIP
  95. - if ((int)child->core.width < clip_width)
  96. - intended.width = clip_width;
  97. + if ((int)child->core.width < clip_width + pad)
  98. + intended.width = clip_width + pad;
  99. else
  100. -#endif
  101. intended.width = child->core.width;
  102. - if (!w->viewport.allowvert)
  103. - intended.request_mode |= CWHeight;
  104. -
  105. -#ifdef PREP_CHILD_TO_CLIP
  106. - if ((int)child->core.height < clip_height)
  107. - intended.height = clip_height;
  108. + if ((int)child->core.height < clip_height + pad)
  109. + intended.height = clip_height + pad;
  110. else
  111. -#endif
  112. intended.height = child->core.height;
  113. + if (!w->viewport.allowvert)
  114. + intended.request_mode |= CWHeight;
  115. +
  116. if (!query) {
  117. preferred.width = child->core.width;
  118. preferred.height = child->core.height;
  119. }
  120. -#ifdef NEED_LAYOUT_LOOP
  121. do { /* while intended != prev */
  122. -#endif
  123. if (query) {
  124. (void) XtQueryGeometry( child, &intended, &preferred );
  125. if ( !(preferred.request_mode & CWWidth) )
  126. @@ -585,12 +567,9 @@ ComputeLayout(Widget widget, Boolean que
  127. if ( !(preferred.request_mode & CWHeight) )
  128. preferred.height = intended.height;
  129. }
  130. -
  131. -#ifdef NEED_LAYOUT_LOOP
  132. prev_width = intended.width;
  133. prev_height = intended.height;
  134. prev_mode = intended.request_mode;
  135. -#endif
  136. /*
  137. * Note that having once decided to turn on either bar
  138. @@ -600,7 +579,7 @@ ComputeLayout(Widget widget, Boolean que
  139. #define CheckHoriz() \
  140. if (w->viewport.allowhoriz && \
  141. - (int)preferred.width > clip_width + 2 * sw) { \
  142. ++ (int)preferred.width > clip_width + pad) { \
  143. if (!needshoriz) { \
  144. Widget horiz_bar = w->viewport.horiz_bar; \
  145. needshoriz = True; \
  146. @@ -615,7 +594,7 @@ ComputeLayout(Widget widget, Boolean que
  147. /* enddef */
  148. CheckHoriz();
  149. if (w->viewport.allowvert &&
  150. - (int)preferred.height > clip_height + 2 * sw) {
  151. + (int)preferred.height > clip_height + pad) {
  152. if (!needsvert) {
  153. Widget vert_bar = w->viewport.vert_bar;
  154. needsvert = True;
  155. @@ -629,38 +608,22 @@ ComputeLayout(Widget widget, Boolean que
  156. intended.height = preferred.height;
  157. }
  158. -#ifdef PREP_CHILD_TO_CLIP
  159. if (!w->viewport.allowhoriz ||
  160. - (int)preferred.width < clip_width) {
  161. - intended.width = clip_width;
  162. + (int)preferred.width < clip_width + pad) {
  163. + intended.width = clip_width + pad;
  164. intended.request_mode |= CWWidth;
  165. }
  166. if (!w->viewport.allowvert ||
  167. - (int)preferred.height < clip_height) {
  168. - intended.height = clip_height;
  169. + (int)preferred.height < clip_height + pad) {
  170. + intended.height = clip_height + pad;
  171. intended.request_mode |= CWHeight;
  172. }
  173. -#endif
  174. -#ifdef NEED_LAYOUT_LOOP
  175. +
  176. } while ( intended.request_mode != prev_mode ||
  177. (intended.request_mode & CWWidth &&
  178. intended.width != prev_width) ||
  179. (intended.request_mode & CWHeight &&
  180. intended.height != prev_height) );
  181. -#endif
  182. -
  183. -#ifndef PREP_CHILD_TO_CLIP
  184. - if (!w->viewport.allowhoriz ||
  185. - (int)preferred.width < clip_width) {
  186. - intended.width = clip_width;
  187. - intended.request_mode |= CWWidth;
  188. - }
  189. - if (!w->viewport.allowvert ||
  190. - (int)preferred.height < clip_height) {
  191. - intended.height = clip_height;
  192. - intended.request_mode |= CWHeight;
  193. - }
  194. -#endif
  195. }
  196. bar_width = bar_height = 0;
  197. @@ -705,7 +668,7 @@ ComputeLayout(Widget widget, Boolean que
  198. else {
  199. int bw = bar->core.border_width;
  200. XtResizeWidget( bar,
  201. - (Dimension)(clip_width + 2 * sw), bar->core.height,
  202. + (Dimension)(clip_width + pad), bar->core.height,
  203. (Dimension)bw );
  204. XtMoveWidget( bar,
  205. (Position)((needsvert && !w->viewport.useright)
  206. @@ -730,7 +693,7 @@ ComputeLayout(Widget widget, Boolean que
  207. else {
  208. int bw = bar->core.border_width;
  209. XtResizeWidget( bar,
  210. - bar->core.width, (Dimension)(clip_height + 2 * sw),
  211. + bar->core.width, (Dimension)(clip_height + pad),
  212. (Dimension)bw );
  213. XtMoveWidget( bar,
  214. (Position)(w->viewport.useright
  215. @@ -780,7 +743,7 @@ ComputeWithForceBars(Widget widget, Bool
  216. */
  217. XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
  218. - if (sw) pad = 2;
  219. + if (sw) pad = 2 * sw;
  220. if (w->viewport.allowvert) {
  221. if (w->viewport.vert_bar == NULL)
  222. @@ -926,7 +889,7 @@ GeometryRequestPlusScrollbar(ViewportWid
  223. Dimension pad = 0, sw = 0;
  224. XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
  225. - if (sw) pad = 2;
  226. + if (sw) pad = 2 * sw;
  227. plusScrollbars = *request;
  228. if ((bar = w->viewport.horiz_bar) == (Widget)NULL)
  229. @@ -997,7 +960,7 @@ GeometryManager(Widget child, XtWidgetGe
  230. return XtGeometryNo;
  231. XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
  232. - if (sw) pad = 2;
  233. + if (sw) pad = 2 * sw;
  234. allowed = *request;