Xaw3d-1.6.1-3Dlabel.patch 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. diff -up libXaw3d-1.6.1/src/Label.c.3Dlabel libXaw3d-1.6.1/src/Label.c
  2. --- libXaw3d-1.6.1/src/Label.c.3Dlabel 2011-09-19 15:42:36.000000000 -0600
  3. +++ libXaw3d-1.6.1/src/Label.c 2012-02-25 14:44:33.766774776 -0700
  4. @@ -416,9 +416,16 @@ GetgrayGC(LabelWidget lw)
  5. static void
  6. compute_bitmap_offsets (LabelWidget lw)
  7. {
  8. - if (lw->label.lbm_height != 0)
  9. - lw->label.lbm_y = (lw->core.height - lw->label.lbm_height) / 2;
  10. - else
  11. + /*
  12. + * bitmap will be eventually be displayed at
  13. + * (internal_width, internal_height + lbm_y)
  14. + */
  15. + if (lw->label.lbm_height != 0) {
  16. + lw->label.lbm_y = (lw->core.height -
  17. + (lw->threeD.shadow_width * 2 +
  18. + lw->label.internal_height * 2 +
  19. + lw->label.lbm_height)) / 2;
  20. + } else
  21. lw->label.lbm_y = 0;
  22. }
  23. @@ -444,9 +451,11 @@ Initialize(Widget request, Widget new, A
  24. {
  25. LabelWidget lw = (LabelWidget) new;
  26. +#if 0
  27. /* disable shadows if we're not a subclass of Command */
  28. if (!XtIsSubclass(new, commandWidgetClass))
  29. lw->threeD.shadow_width = 0;
  30. +#endif
  31. if (lw->label.label == NULL)
  32. lw->label.label = XtNewString(lw->core.name);
  33. @@ -460,18 +469,20 @@ Initialize(Widget request, Widget new, A
  34. if (lw->core.height == 0)
  35. lw->core.height = lw->label.label_height +
  36. - 2 * lw->label.internal_height;
  37. + 2 * lw->label.internal_height +
  38. + 2 * lw->threeD.shadow_width;
  39. set_bitmap_info(lw); /* req's core.height, sets label.lbm_* */
  40. if (lw->label.lbm_height > lw->label.label_height)
  41. lw->core.height = lw->label.lbm_height +
  42. - 2 * lw->label.internal_height;
  43. + 2 * lw->label.internal_height;
  44. if (lw->core.width == 0)
  45. lw->core.width = lw->label.label_width +
  46. - 2 * lw->label.internal_width +
  47. - LEFT_OFFSET(lw); /* req's label.lbm_width */
  48. + 2 * lw->label.internal_width +
  49. + 2 * lw->threeD.shadow_width +
  50. + LEFT_OFFSET(lw); /* req's label.lbm_width */
  51. lw->label.label_x = lw->label.label_y = 0;
  52. (*XtClass(new)->core_class.resize) ((Widget)lw);
  53. @@ -549,14 +560,16 @@ Redisplay(Widget gw, XEvent *event, Regi
  54. if (w->label.depth == 1)
  55. XCopyPlane(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
  56. w->label.lbm_width, w->label.lbm_height,
  57. - (int) w->label.internal_width,
  58. - (int) w->label.lbm_y,
  59. + (int) w->label.internal_width + w->threeD.shadow_width,
  60. + (int) w->label.internal_height + w->threeD.shadow_width
  61. + + w->label.lbm_y,
  62. (unsigned long) 1L);
  63. else
  64. XCopyArea(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
  65. w->label.lbm_width, w->label.lbm_height,
  66. - (int) w->label.internal_width,
  67. - (int) w->label.lbm_y);
  68. + (int) w->label.internal_width + w->threeD.shadow_width,
  69. + (int) w->label.internal_height + w->threeD.shadow_width
  70. + + w->label.lbm_y);
  71. }
  72. #ifdef XAW_INTERNATIONALIZATION
  73. @@ -646,14 +659,17 @@ _Reposition(LabelWidget lw, Dimension wi
  74. Position *dx, Position *dy)
  75. {
  76. Position newPos;
  77. - Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw);
  78. + Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw) +
  79. + lw->threeD.shadow_width;
  80. +
  81. switch (lw->label.justify) {
  82. case XtJustifyLeft:
  83. newPos = leftedge;
  84. break;
  85. case XtJustifyRight:
  86. - newPos = width - lw->label.label_width - lw->label.internal_width;
  87. + newPos = width - (lw->label.label_width + lw->label.internal_width +
  88. + lw->threeD.shadow_width);
  89. break;
  90. case XtJustifyCenter:
  91. default:
  92. @@ -745,17 +761,20 @@ SetValues(Widget current, Widget request
  93. if (newlw->label.resize && was_resized) {
  94. if (curlw->core.height == reqlw->core.height && !checks[HEIGHT])
  95. newlw->core.height = newlw->label.label_height +
  96. - 2 * newlw->label.internal_height;
  97. + 2 * newlw->label.internal_height +
  98. + 2 * newlw->threeD.shadow_width;
  99. set_bitmap_info (newlw); /* req's core.height, sets label.lbm_* */
  100. if (newlw->label.lbm_height > newlw->label.label_height)
  101. newlw->core.height = newlw->label.lbm_height +
  102. - 2 * newlw->label.internal_height;
  103. + 2 * newlw->label.internal_height +
  104. + 2 * newlw->threeD.shadow_width;
  105. if (curlw->core.width == reqlw->core.width && !checks[WIDTH])
  106. newlw->core.width = newlw->label.label_width +
  107. 2 * newlw->label.internal_width +
  108. + 2 * newlw->threeD.shadow_width +
  109. LEFT_OFFSET(newlw); /* req's label.lbm_width */
  110. }
  111. @@ -764,15 +783,20 @@ SetValues(Widget current, Widget request
  112. if (checks[HEIGHT]) {
  113. if (newlw->label.label_height > newlw->label.lbm_height)
  114. i = newlw->label.label_height +
  115. - 2 * newlw->label.internal_height;
  116. + 2 * newlw->label.internal_height +
  117. + 2 * newlw->threeD.shadow_width;
  118. else
  119. - i = newlw->label.lbm_height + 2 * newlw->label.internal_height;
  120. + i = newlw->label.lbm_height +
  121. + 2 * newlw->label.internal_height +
  122. + 2 * newlw->threeD.shadow_width;
  123. if (i > newlw->core.height)
  124. newlw->core.height = i;
  125. }
  126. if (checks[WIDTH]) {
  127. - i = newlw->label.label_width + 2 * newlw->label.internal_width +
  128. - LEFT_OFFSET(newlw); /* req's label.lbm_width */
  129. + i = newlw->label.label_width +
  130. + 2 * newlw->label.internal_width +
  131. + 2 * newlw->threeD.shadow_width +
  132. + LEFT_OFFSET(newlw); /* req's label.lbm_width */
  133. if (i > newlw->core.width)
  134. newlw->core.width = i;
  135. }
  136. @@ -843,9 +867,11 @@ QueryGeometry(Widget w, XtWidgetGeometry
  137. preferred->request_mode = CWWidth | CWHeight;
  138. preferred->width = (lw->label.label_width +
  139. 2 * lw->label.internal_width +
  140. + 2 * lw->threeD.shadow_width +
  141. LEFT_OFFSET(lw));
  142. preferred->height = lw->label.label_height +
  143. - 2 * lw->label.internal_height;
  144. + 2 * lw->label.internal_height +
  145. + 2 * lw->threeD.shadow_width;
  146. if ( ((intended->request_mode & (CWWidth | CWHeight))
  147. == (CWWidth | CWHeight)) &&
  148. intended->width == preferred->width &&