]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gtk+/gtk+-2.6.4-1.osso7/gtkradiobutton.c.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gtk+ / gtk+-2.6.4-1.osso7 / gtkradiobutton.c.diff
1 --- gtk+-2.6.4/gtk/gtkradiobutton.c     2004-08-09 19:59:52.000000000 +0300
2 +++ gtk+-2.6.4/gtk/gtkradiobutton.c     2005-04-06 16:19:37.126894216 +0300
3 @@ -31,6 +31,7 @@
4  #include "gtkradiobutton.h"
5  #include "gtkintl.h"
6  
7 +#define TOGGLE_ON_CLICK "toggle-on-click"
8  
9  enum {
10    PROP_0,
11 @@ -506,6 +507,9 @@
12         {
13           tmp_list = tmp_list->next;
14           
15 +    if( !tmp_list )
16 +      return FALSE;
17 +    
18           while (tmp_list)
19             {
20               GtkWidget *child = tmp_list->data;
21 @@ -543,7 +547,10 @@
22        if (new_focus)
23         {
24           gtk_widget_grab_focus (new_focus);
25 -         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE);
26 +
27 +       /* arrow keys select the button ? CHECK THIS!!
28 +     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE);
29 +   */
30         }
31  
32        return TRUE;
33 @@ -579,7 +586,7 @@
34    GtkToggleButton *toggle_button;
35    GtkRadioButton *radio_button;
36    GtkToggleButton *tmp_button;
37 -  GtkStateType new_state;
38 +  GtkStateType new_state = GTK_WIDGET_STATE( button );
39    GSList *tmp_list;
40    gint toggled;
41    gboolean depressed;
42 @@ -591,52 +598,54 @@
43    g_object_ref (GTK_WIDGET (button));
44  
45    if (toggle_button->active)
46 -    {
47 -      tmp_button = NULL;
48 -      tmp_list = radio_button->group;
49 -
50 -      while (tmp_list)
51 -       {
52 -         tmp_button = tmp_list->data;
53 -         tmp_list = tmp_list->next;
54 +       {
55 +         tmp_button = NULL;
56 +         tmp_list = radio_button->group;
57  
58 -         if (tmp_button->active && tmp_button != toggle_button)
59 -           break;
60 +         while (tmp_list)
61 +           {
62 +             tmp_button = tmp_list->data;
63 +             tmp_list = tmp_list->next;
64 +             
65 +             if (tmp_button->active && tmp_button != toggle_button)
66 +               break;
67  
68 -         tmp_button = NULL;
69 -       }
70 +             tmp_button = NULL;
71 +           }
72  
73 -      if (!tmp_button)
74 -       {
75 -         new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
76 +         if (!tmp_button)
77 +           {
78 +             new_state = (button->in_button ? 
79 +                          GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
80 +           }
81 +         else
82 +           {
83 +             toggled = TRUE;
84 +             toggle_button->active = !toggle_button->active;
85 +             new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
86 +           }
87         }
88        else
89         {
90           toggled = TRUE;
91           toggle_button->active = !toggle_button->active;
92 -         new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
93 -       }
94 -    }
95 -  else
96 -    {
97 -      toggled = TRUE;
98 -      toggle_button->active = !toggle_button->active;
99  
100 -      tmp_list = radio_button->group;
101 -      while (tmp_list)
102 -       {
103 -         tmp_button = tmp_list->data;
104 -         tmp_list = tmp_list->next;
105 -
106 -         if (tmp_button->active && (tmp_button != toggle_button))
107 +         tmp_list = radio_button->group;
108 +         while (tmp_list)
109             {
110 -             gtk_button_clicked (GTK_BUTTON (tmp_button));
111 -             break;
112 +             tmp_button = tmp_list->data;
113 +             tmp_list = tmp_list->next;
114 +             
115 +             if (tmp_button->active && (tmp_button != toggle_button))
116 +               {
117 +                 gtk_button_clicked (GTK_BUTTON (tmp_button));
118 +                 break;
119 +               }
120             }
121 +
122 +         new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
123         }
124  
125 -      new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
126 -    }
127  
128    if (toggle_button->inconsistent)
129      depressed = FALSE;
130 @@ -663,7 +672,6 @@
131                                  GdkRectangle   *area)
132  {
133    GtkWidget *widget;
134 -  GtkWidget *child;
135    GtkButton *button;
136    GtkToggleButton *toggle_button;
137    GtkStateType state_type;
138 @@ -686,54 +694,80 @@
139                             "focus-padding", &focus_pad,
140                             NULL);
141  
142 -      _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
143 -
144 -      x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
145 -      y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
146 -
147 -      child = GTK_BIN (check_button)->child;
148 -      if (!interior_focus || !(child && GTK_WIDGET_VISIBLE (child)))
149 -       x += focus_width + focus_pad;      
150 +      _gtk_check_button_get_props (check_button, 
151 +                                  &indicator_size, &indicator_spacing);
152  
153 +      x = widget->allocation.x + indicator_spacing + 
154 +       GTK_CONTAINER (widget)->border_width;
155 +      y = widget->allocation.y + (widget->allocation.height - 
156 +                                 indicator_size + focus_width + 
157 +                                 focus_pad) / 2;
158 +
159 +      /* Hildon - always add space for the padding
160 +      */
161 +      x += focus_width + focus_pad;
162 +      
163        if (toggle_button->inconsistent)
164 -       shadow_type = GTK_SHADOW_ETCHED_IN;
165 +   shadow_type = GTK_SHADOW_ETCHED_IN;
166 +
167        else if (toggle_button->active)
168 -       shadow_type = GTK_SHADOW_IN;
169 +   shadow_type = GTK_SHADOW_IN;
170 +
171        else
172 -       shadow_type = GTK_SHADOW_OUT;
173 +   shadow_type = GTK_SHADOW_OUT;
174 +
175 +      if (button->activate_timeout || 
176 +         (button->button_down && button->in_button) )
177 +  state_type = GTK_STATE_ACTIVE;
178  
179 -      if (button->activate_timeout || (button->button_down && button->in_button))
180 -       state_type = GTK_STATE_ACTIVE;
181        else if (button->in_button)
182 -       state_type = GTK_STATE_PRELIGHT;
183 +   state_type = GTK_STATE_PRELIGHT;
184 +
185        else if (!GTK_WIDGET_IS_SENSITIVE (widget))
186         state_type = GTK_STATE_INSENSITIVE;
187 +
188        else
189 -       state_type = GTK_STATE_NORMAL;
190 +  state_type = GTK_STATE_NORMAL;
191  
192 +      /* Hildon change. We want to draw active image always when we have
193 +       * focus. */
194 +      if (GTK_WIDGET_HAS_FOCUS (widget))
195 +       state_type = GTK_STATE_ACTIVE;
196 +       
197        if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
198 -       x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
199 -
200 +       {
201 +         x = widget->allocation.x + widget->allocation.width - 
202 +           (indicator_size + x - widget->allocation.x);
203 +       }
204 +      /* Well, commenting this out fixes bug #280, 
205 +        without apparent side effects.
206 +       *
207        if (GTK_WIDGET_STATE (toggle_button) == GTK_STATE_PRELIGHT)
208         {
209           GdkRectangle restrict_area;
210           GdkRectangle new_area;
211               
212 -         restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
213 -         restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
214 -         restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
215 -         restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
216 +         restrict_area.x = widget->allocation.x + 
217 +         GTK_CONTAINER (widget)->border_width;
218 +         restrict_area.y = widget->allocation.y + 
219 +         GTK_CONTAINER (widget)->border_width;
220 +         restrict_area.width = widget->allocation.width - 
221 +         (2 * GTK_CONTAINER (widget)->border_width);
222 +         restrict_area.height = widget->allocation.height - 
223 +         (2 * GTK_CONTAINER (widget)->border_width);
224           
225           if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
226             {
227 -             gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
228 -                                 GTK_SHADOW_ETCHED_OUT, 
229 -                                 area, widget, "checkbutton",
230 -                                 new_area.x, new_area.y,
231 -                                 new_area.width, new_area.height);
232 +             gtk_paint_flat_box (widget->style, widget->window, 
233 +             GTK_STATE_PRELIGHT,
234 +             GTK_SHADOW_ETCHED_OUT, 
235 +             area, widget, "checkbutton",
236 +             new_area.x, new_area.y,
237 +             new_area.width, new_area.height);
238             }
239         }
240  
241 +      */
242        gtk_paint_option (widget->style, widget->window,
243                         state_type, shadow_type,
244                         area, widget, "radiobutton",