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