summaryrefslogtreecommitdiff
path: root/packages/gtk+/gtk+-2.6.3/spinbutton.patch
blob: 8ad7507af04403d75bb3299b8fdcd2d2f5b8abd2 (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
--- gtk+-2.4.3/gtk/gtkspinbutton.c.old	2004-04-22 14:49:27.000000000 +0100
+++ gtk+-2.4.3/gtk/gtkspinbutton.c	2004-06-30 21:48:18.000000000 +0100
@@ -733,7 +733,7 @@
 
   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;
   
@@ -866,19 +866,16 @@
     {
       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))
@@ -908,32 +905,17 @@
 	      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 */
@@ -1108,7 +1090,7 @@
 	  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);
@@ -1143,44 +1125,11 @@
 
   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 (parent_class)->button_release_event (widget, event);
+  return TRUE;
 }
 
 static gint