spinbutton.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. Index: gtk+-2.10.6/gtk/gtkspinbutton.c
  2. ===================================================================
  3. --- gtk+-2.10.6.orig/gtk/gtkspinbutton.c
  4. +++ gtk+-2.10.6/gtk/gtkspinbutton.c
  5. @@ -682,7 +682,7 @@ gtk_spin_button_size_allocate (GtkWidget
  6. spin = GTK_SPIN_BUTTON (widget);
  7. arrow_size = spin_button_get_arrow_size (spin);
  8. - panel_width = arrow_size + 2 * widget->style->xthickness;
  9. + panel_width = (2 * arrow_size) + 4 * widget->style->xthickness;
  10. widget->allocation = *allocation;
  11. @@ -815,19 +815,16 @@ gtk_spin_button_draw_arrow (GtkSpinButto
  12. {
  13. width = spin_button_get_arrow_size (spin_button) + 2 * widget->style->xthickness;
  14. + y = widget->style->ythickness;
  15. + height = widget->requisition.height - (2 * y);
  16. +
  17. if (arrow_type == GTK_ARROW_UP)
  18. {
  19. x = 0;
  20. - y = 0;
  21. -
  22. - height = widget->requisition.height / 2;
  23. }
  24. else
  25. {
  26. - x = 0;
  27. - y = widget->requisition.height / 2;
  28. -
  29. - height = (widget->requisition.height + 1) / 2;
  30. + x = width;
  31. }
  32. if (spin_button_at_limit (spin_button, arrow_type))
  33. @@ -857,32 +854,17 @@ gtk_spin_button_draw_arrow (GtkSpinButto
  34. shadow_type = GTK_SHADOW_OUT;
  35. }
  36. }
  37. -
  38. +
  39. gtk_paint_box (widget->style, spin_button->panel,
  40. state_type, shadow_type,
  41. NULL, widget,
  42. - (arrow_type == GTK_ARROW_UP)? "spinbutton_up" : "spinbutton_down",
  43. + NULL,
  44. x, y, width, height);
  45. height = widget->requisition.height;
  46. - if (arrow_type == GTK_ARROW_DOWN)
  47. - {
  48. - y = height / 2;
  49. - height = height - y - 2;
  50. - }
  51. - else
  52. - {
  53. - y = 2;
  54. - height = height / 2 - 2;
  55. - }
  56. -
  57. width -= 3;
  58. -
  59. - if (widget && gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
  60. - x = 2;
  61. - else
  62. - x = 1;
  63. + height -= 3;
  64. w = width / 2;
  65. w -= w % 2 - 1; /* force odd */
  66. @@ -1062,7 +1044,7 @@ gtk_spin_button_button_press (GtkWidget
  67. if (GTK_ENTRY (widget)->editable)
  68. gtk_spin_button_update (spin);
  69. - if (event->y <= widget->requisition.height / 2)
  70. + if (event->x <= (spin_button_get_arrow_size (spin) + widget->style->xthickness))
  71. {
  72. if (event->button == 1)
  73. start_spinning (spin, GTK_ARROW_UP, spin->adjustment->step_increment);
  74. @@ -1097,44 +1079,11 @@ gtk_spin_button_button_release (GtkWidge
  75. arrow_size = spin_button_get_arrow_size (spin);
  76. - if (event->button == spin->button)
  77. - {
  78. - int click_child = spin->click_child;
  79. + gtk_spin_button_stop_spinning (spin);
  80. - gtk_spin_button_stop_spinning (spin);
  81. -
  82. - if (event->button == 3)
  83. - {
  84. - if (event->y >= 0 && event->x >= 0 &&
  85. - event->y <= widget->requisition.height &&
  86. - event->x <= arrow_size + 2 * widget->style->xthickness)
  87. - {
  88. - if (click_child == GTK_ARROW_UP &&
  89. - event->y <= widget->requisition.height / 2)
  90. - {
  91. - gdouble diff;
  92. -
  93. - diff = spin->adjustment->upper - spin->adjustment->value;
  94. - if (diff > EPSILON)
  95. - gtk_spin_button_real_spin (spin, diff);
  96. - }
  97. - else if (click_child == GTK_ARROW_DOWN &&
  98. - event->y > widget->requisition.height / 2)
  99. - {
  100. - gdouble diff;
  101. -
  102. - diff = spin->adjustment->value - spin->adjustment->lower;
  103. - if (diff > EPSILON)
  104. - gtk_spin_button_real_spin (spin, -diff);
  105. - }
  106. - }
  107. - }
  108. - spin_button_redraw (spin);
  109. + spin_button_redraw (spin);
  110. - return TRUE;
  111. - }
  112. - else
  113. - return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->button_release_event (widget, event);
  114. + return TRUE;
  115. }
  116. static gint