diff options
author | Ross Burton <ross@openedhand.com> | 2006-12-22 09:59:20 +0000 |
---|---|---|
committer | Ross Burton <ross@openedhand.com> | 2006-12-22 09:59:20 +0000 |
commit | ea5a5e27a6dd5a6bfbba1b5bcfb13423c7c222a0 (patch) | |
tree | d8ceadb0fd62f3455813ae1649b96871be2e0305 /meta/packages/gtk+/gtk+-2.10.0/style-cairo.patch | |
parent | 32077bdb32334a34b0a364b49a00549a1c874dca (diff) | |
download | poky-ea5a5e27a6dd5a6bfbba1b5bcfb13423c7c222a0.tar.gz |
Remove GTK+ 2.10.0
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1070 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gtk+/gtk+-2.10.0/style-cairo.patch')
-rw-r--r-- | meta/packages/gtk+/gtk+-2.10.0/style-cairo.patch | 2193 |
1 files changed, 0 insertions, 2193 deletions
diff --git a/meta/packages/gtk+/gtk+-2.10.0/style-cairo.patch b/meta/packages/gtk+/gtk+-2.10.0/style-cairo.patch deleted file mode 100644 index 197b0a8f45..0000000000 --- a/meta/packages/gtk+/gtk+-2.10.0/style-cairo.patch +++ /dev/null | |||
@@ -1,2193 +0,0 @@ | |||
1 | Index: gtkstyle.c | ||
2 | =================================================================== | ||
3 | RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v | ||
4 | retrieving revision 1.193 | ||
5 | diff -u -r1.193 gtk+-2.10.0/gtk/gtkstyle.c | ||
6 | --- gtk+-2.10.0/gtk/gtkstyle.c 28 May 2006 12:56:26 -0000 1.193 | ||
7 | +++ gtk+-2.10.0/gtk/gtkstyle.c 2 Jul 2006 14:15:15 -0000 | ||
8 | @@ -37,7 +37,6 @@ | ||
9 | #include "gtkthemes.h" | ||
10 | #include "gtkiconfactory.h" | ||
11 | #include "gtksettings.h" /* _gtk_settings_parse_convert() */ | ||
12 | -#include "gtkintl.h" | ||
13 | #include "gtkalias.h" | ||
14 | |||
15 | #define LIGHTNESS_MULT 1.3 | ||
16 | @@ -59,6 +58,8 @@ | ||
17 | }; | ||
18 | |||
19 | /* --- prototypes --- */ | ||
20 | +static void gtk_style_init (GtkStyle *style); | ||
21 | +static void gtk_style_class_init (GtkStyleClass *klass); | ||
22 | static void gtk_style_finalize (GObject *object); | ||
23 | static void gtk_style_realize (GtkStyle *style, | ||
24 | GdkColormap *colormap); | ||
25 | @@ -311,6 +312,9 @@ | ||
26 | gint width, | ||
27 | gint height); | ||
28 | |||
29 | +void _gtk_style_shade (GdkColor *a, | ||
30 | + GdkColor *b, | ||
31 | + gdouble k); | ||
32 | static void rgb_to_hls (gdouble *r, | ||
33 | gdouble *g, | ||
34 | gdouble *b); | ||
35 | @@ -329,6 +333,128 @@ | ||
36 | static const GtkRequisition default_option_indicator_size = { 7, 13 }; | ||
37 | static const GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 }; | ||
38 | |||
39 | +#define INDICATOR_PART_SIZE 13 | ||
40 | + | ||
41 | +typedef enum { | ||
42 | + CHECK_AA, | ||
43 | + CHECK_BASE, | ||
44 | + CHECK_BLACK, | ||
45 | + CHECK_DARK, | ||
46 | + CHECK_LIGHT, | ||
47 | + CHECK_MID, | ||
48 | + CHECK_TEXT, | ||
49 | + CHECK_INCONSISTENT_TEXT, | ||
50 | + RADIO_BASE, | ||
51 | + RADIO_BLACK, | ||
52 | + RADIO_DARK, | ||
53 | + RADIO_LIGHT, | ||
54 | + RADIO_MID, | ||
55 | + RADIO_TEXT, | ||
56 | + RADIO_INCONSISTENT_AA, | ||
57 | + RADIO_INCONSISTENT_TEXT | ||
58 | +} IndicatorPart; | ||
59 | + | ||
60 | +/* | ||
61 | + * Extracted from check-13.png, width=13, height=13 | ||
62 | + */ | ||
63 | +static const guchar check_black_bits[] = { | ||
64 | + 0x00,0x00,0xfe,0x0f,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02, | ||
65 | + 0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00}; | ||
66 | +static const guchar check_dark_bits[] = { | ||
67 | + 0xff,0x1f,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01, | ||
68 | + 0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00}; | ||
69 | +static const guchar check_mid_bits[] = { | ||
70 | + 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00, | ||
71 | + 0x08,0x00,0x08,0x00,0x08,0x00,0x08,0xfc,0x0f,0x00,0x00,0x00,0x00}; | ||
72 | +static const guchar check_light_bits[] = { | ||
73 | + 0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00, | ||
74 | + 0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0xfe,0x1f,0x00,0x00}; | ||
75 | +static const guchar check_text_bits[] = { | ||
76 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x03,0x80,0x01,0x80,0x00,0x58, | ||
77 | + 0x00,0x60,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
78 | +static const guchar check_aa_bits[] = { | ||
79 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x58,0x00,0xa0, | ||
80 | + 0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
81 | +static const guchar check_base_bits[] = { | ||
82 | + 0x00,0x00,0x00,0x00,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc, | ||
83 | + 0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
84 | + | ||
85 | +/* | ||
86 | + * Extracted from check-13-inconsistent.png, width=13, height=13 | ||
87 | + */ | ||
88 | +static const guchar check_inconsistent_text_bits[] = { | ||
89 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x03,0xf8, | ||
90 | + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
91 | +#if 0 | ||
92 | +/* | ||
93 | + * check_inconsistent_aa_bits is currently not used, since it is all zeros. | ||
94 | + */ | ||
95 | +static const guchar check_inconsistent_aa_bits[] = { | ||
96 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
97 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
98 | +#endif | ||
99 | + | ||
100 | +/* | ||
101 | + * Extracted from radio-13.png, width=13, height=13 | ||
102 | + */ | ||
103 | +static const guchar radio_black_bits[] = { | ||
104 | + 0x00,0x00,0xf0,0x01,0x0c,0x02,0x04,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02, | ||
105 | + 0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x08}; | ||
106 | +static const guchar radio_dark_bits[] = { | ||
107 | + 0xf0,0x00,0x0c,0x02,0x02,0x04,0x02,0x04,0x01,0x08,0x01,0x08,0x01,0x08,0x01, | ||
108 | + 0x08,0x00,0x08,0x02,0x04,0x0c,0x06,0xf0,0x01,0x00,0x00,0x00,0x00}; | ||
109 | +static const guchar radio_mid_bits[] = { | ||
110 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
111 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
112 | +static const guchar radio_light_bits[] = { | ||
113 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00, | ||
114 | + 0x10,0x00,0x10,0x00,0x08,0x00,0x08,0x00,0x06,0xe0,0x01,0x00,0x00}; | ||
115 | +static const guchar radio_text_bits[] = { | ||
116 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0xf0,0x01,0xf0,0x01,0xf0, | ||
117 | + 0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
118 | +#if 0 | ||
119 | +/* | ||
120 | + * radio_aa_bits is currently not used, since it is all zeros. | ||
121 | + */ | ||
122 | +static const guchar radio_aa_bits[] = { | ||
123 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
124 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
125 | +#endif | ||
126 | +static const guchar radio_base_bits[] = { | ||
127 | + 0x00,0x00,0x00,0x00,0xf0,0x01,0xf8,0x03,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc, | ||
128 | + 0x07,0xfc,0x07,0xf8,0x03,0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
129 | + | ||
130 | +/* | ||
131 | + * Extracted from radio-13.png, width=13, height=13 | ||
132 | + */ | ||
133 | +static const guchar radio_inconsistent_text_bits[] = { | ||
134 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x03,0x00, | ||
135 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
136 | +static const guchar radio_inconsistent_aa_bits[] = { | ||
137 | + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x03,0x00,0x00,0xf8, | ||
138 | + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
139 | + | ||
140 | +static struct { | ||
141 | + const guchar *bits; | ||
142 | + GList *bmap_list; /* list of GdkBitmap */ | ||
143 | +} indicator_parts[] = { | ||
144 | + { check_aa_bits, NULL }, | ||
145 | + { check_base_bits, NULL }, | ||
146 | + { check_black_bits, NULL }, | ||
147 | + { check_dark_bits, NULL }, | ||
148 | + { check_light_bits, NULL }, | ||
149 | + { check_mid_bits, NULL }, | ||
150 | + { check_text_bits, NULL }, | ||
151 | + { check_inconsistent_text_bits, NULL }, | ||
152 | + { radio_base_bits, NULL }, | ||
153 | + { radio_black_bits, NULL }, | ||
154 | + { radio_dark_bits, NULL }, | ||
155 | + { radio_light_bits, NULL }, | ||
156 | + { radio_mid_bits, NULL }, | ||
157 | + { radio_text_bits, NULL }, | ||
158 | + { radio_inconsistent_aa_bits, NULL }, | ||
159 | + { radio_inconsistent_text_bits, NULL }, | ||
160 | +}; | ||
161 | #define GTK_GRAY 0xdcdc, 0xdada, 0xd5d5 | ||
162 | #define GTK_DARK_GRAY 0xc4c4, 0xc2c2, 0xbdbd | ||
163 | #define GTK_LIGHT_GRAY 0xeeee, 0xebeb, 0xe7e7 | ||
164 | @@ -353,13 +479,39 @@ | ||
165 | static const GdkColor gtk_default_selected_base = { 0, GTK_BLUE }; | ||
166 | static const GdkColor gtk_default_active_base = { 0, GTK_VERY_DARK_GRAY }; | ||
167 | |||
168 | +static gpointer parent_class = NULL; | ||
169 | + | ||
170 | /* --- signals --- */ | ||
171 | static guint realize_signal = 0; | ||
172 | static guint unrealize_signal = 0; | ||
173 | |||
174 | -G_DEFINE_TYPE (GtkStyle, gtk_style, G_TYPE_OBJECT) | ||
175 | - | ||
176 | /* --- functions --- */ | ||
177 | +GType | ||
178 | +gtk_style_get_type (void) | ||
179 | +{ | ||
180 | + static GType style_type = 0; | ||
181 | + | ||
182 | + if (!style_type) | ||
183 | + { | ||
184 | + static const GTypeInfo style_info = | ||
185 | + { | ||
186 | + sizeof (GtkStyleClass), | ||
187 | + (GBaseInitFunc) NULL, | ||
188 | + (GBaseFinalizeFunc) NULL, | ||
189 | + (GClassInitFunc) gtk_style_class_init, | ||
190 | + NULL, /* class_finalize */ | ||
191 | + NULL, /* class_data */ | ||
192 | + sizeof (GtkStyle), | ||
193 | + 0, /* n_preallocs */ | ||
194 | + (GInstanceInitFunc) gtk_style_init, | ||
195 | + }; | ||
196 | + | ||
197 | + style_type = g_type_register_static (G_TYPE_OBJECT, "GtkStyle", | ||
198 | + &style_info, 0); | ||
199 | + } | ||
200 | + | ||
201 | + return style_type; | ||
202 | +} | ||
203 | |||
204 | /** | ||
205 | * _gtk_style_init_for_settings: | ||
206 | @@ -477,6 +629,8 @@ | ||
207 | { | ||
208 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
209 | |||
210 | + parent_class = g_type_class_peek_parent (klass); | ||
211 | + | ||
212 | object_class->finalize = gtk_style_finalize; | ||
213 | |||
214 | klass->clone = gtk_style_real_clone; | ||
215 | @@ -511,6 +665,7 @@ | ||
216 | |||
217 | g_type_class_add_private (object_class, sizeof (GtkStylePrivate)); | ||
218 | |||
219 | + | ||
220 | /** | ||
221 | * GtkStyle::realize: | ||
222 | * @style: the object which received the signal | ||
223 | @@ -522,7 +677,7 @@ | ||
224 | * | ||
225 | * Since: 2.4 | ||
226 | */ | ||
227 | - realize_signal = g_signal_new (I_("realize"), | ||
228 | + realize_signal = g_signal_new ("realize", | ||
229 | G_TYPE_FROM_CLASS (object_class), | ||
230 | G_SIGNAL_RUN_FIRST, | ||
231 | G_STRUCT_OFFSET (GtkStyleClass, realize), | ||
232 | @@ -540,7 +695,7 @@ | ||
233 | * | ||
234 | * Since: 2.4 | ||
235 | */ | ||
236 | - unrealize_signal = g_signal_new (I_("unrealize"), | ||
237 | + unrealize_signal = g_signal_new ("unrealize", | ||
238 | G_TYPE_FROM_CLASS (object_class), | ||
239 | G_SIGNAL_RUN_FIRST, | ||
240 | G_STRUCT_OFFSET (GtkStyleClass, unrealize), | ||
241 | @@ -602,8 +757,18 @@ | ||
242 | } | ||
243 | } | ||
244 | |||
245 | - g_slist_foreach (style->icon_factories, (GFunc) g_object_unref, NULL); | ||
246 | - g_slist_free (style->icon_factories); | ||
247 | + if (style->icon_factories) | ||
248 | + { | ||
249 | + GSList *tmp_list = style->icon_factories; | ||
250 | + | ||
251 | + while (tmp_list) | ||
252 | + { | ||
253 | + g_object_unref (tmp_list->data); | ||
254 | + tmp_list = tmp_list->next; | ||
255 | + } | ||
256 | + | ||
257 | + g_slist_free (style->icon_factories); | ||
258 | + } | ||
259 | |||
260 | g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_unref, NULL); | ||
261 | g_slist_free (priv->color_hashes); | ||
262 | @@ -619,7 +784,7 @@ | ||
263 | if (style->rc_style) | ||
264 | gtk_rc_style_unref (style->rc_style); | ||
265 | |||
266 | - G_OBJECT_CLASS (gtk_style_parent_class)->finalize (object); | ||
267 | + G_OBJECT_CLASS (parent_class)->finalize (object); | ||
268 | } | ||
269 | |||
270 | |||
271 | @@ -686,10 +851,6 @@ | ||
272 | * it to a particular visual and colormap. The process may | ||
273 | * involve the creation of a new style if the style has already | ||
274 | * been attached to a window with a different style and colormap. | ||
275 | - * | ||
276 | - * Since this function may return a new object, you have to use it | ||
277 | - * in the following way: | ||
278 | - * <literal>style = gtk_style_attach (style, window)</literal> | ||
279 | **/ | ||
280 | GtkStyle* | ||
281 | gtk_style_attach (GtkStyle *style, | ||
282 | @@ -766,19 +927,10 @@ | ||
283 | return new_style; | ||
284 | } | ||
285 | |||
286 | -/** | ||
287 | - * gtk_style_detach: | ||
288 | - * @style: a #GtkStyle | ||
289 | - * | ||
290 | - * Detaches a style from a window. If the style is not attached | ||
291 | - * to any windows anymore, it is unrealized. See gtk_style_attach(). | ||
292 | - * | ||
293 | - */ | ||
294 | void | ||
295 | gtk_style_detach (GtkStyle *style) | ||
296 | { | ||
297 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
298 | - g_return_if_fail (style->attach_count > 0); | ||
299 | |||
300 | style->attach_count -= 1; | ||
301 | if (style->attach_count == 0) | ||
302 | @@ -833,6 +985,9 @@ | ||
303 | gtk_style_realize (GtkStyle *style, | ||
304 | GdkColormap *colormap) | ||
305 | { | ||
306 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
307 | + g_return_if_fail (GDK_IS_COLORMAP (colormap)); | ||
308 | + | ||
309 | style->colormap = g_object_ref (colormap); | ||
310 | style->depth = gdk_colormap_get_visual (colormap)->depth; | ||
311 | |||
312 | @@ -862,22 +1017,6 @@ | ||
313 | return gtk_icon_factory_lookup_default (stock_id); | ||
314 | } | ||
315 | |||
316 | -/** | ||
317 | - * gtk_style_lookup_color: | ||
318 | - * @style: a #GtkStyle | ||
319 | - * @color_name: the name of the logical color to look up | ||
320 | - * @color: the #GdkColor to fill in | ||
321 | - * | ||
322 | - * Looks up @color_name in the style's logical color mappings, | ||
323 | - * filling in @color and returning %TRUE if found, otherwise | ||
324 | - * returning %FALSE. Do not cache the found mapping, because | ||
325 | - * it depends on the #GtkStyle and might change when a theme | ||
326 | - * switch occurs. | ||
327 | - * | ||
328 | - * Return value: %TRUE if the mapping was found. | ||
329 | - * | ||
330 | - * Since: 2.10 | ||
331 | - **/ | ||
332 | gboolean | ||
333 | gtk_style_lookup_color (GtkStyle *style, | ||
334 | const char *color_name, | ||
335 | @@ -909,6 +1048,7 @@ | ||
336 | return FALSE; | ||
337 | } | ||
338 | |||
339 | + | ||
340 | /** | ||
341 | * gtk_draw_hline: | ||
342 | * @style: a #GtkStyle | ||
343 | @@ -1653,8 +1793,19 @@ | ||
344 | if (rc_style->ythickness >= 0) | ||
345 | style->ythickness = rc_style->ythickness; | ||
346 | |||
347 | - style->icon_factories = g_slist_copy (rc_style->icon_factories); | ||
348 | - g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL); | ||
349 | + if (rc_style->icon_factories) | ||
350 | + { | ||
351 | + GSList *iter; | ||
352 | + | ||
353 | + style->icon_factories = g_slist_copy (rc_style->icon_factories); | ||
354 | + | ||
355 | + iter = style->icon_factories; | ||
356 | + while (iter != NULL) | ||
357 | + { | ||
358 | + g_object_ref (iter->data); | ||
359 | + iter = g_slist_next (iter); | ||
360 | + } | ||
361 | + } | ||
362 | |||
363 | priv->color_hashes = g_slist_copy (_gtk_rc_style_get_color_hashes (rc_style)); | ||
364 | g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_ref, NULL); | ||
365 | @@ -1782,7 +1933,7 @@ | ||
366 | { | ||
367 | _gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT); | ||
368 | _gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT); | ||
369 | - | ||
370 | + | ||
371 | style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2; | ||
372 | style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2; | ||
373 | style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2; | ||
374 | @@ -2162,6 +2313,57 @@ | ||
375 | gdk_drawable_get_size (window, NULL, height); | ||
376 | } | ||
377 | |||
378 | +static GdkBitmap * | ||
379 | +get_indicator_for_screen (GdkDrawable *drawable, | ||
380 | + IndicatorPart part) | ||
381 | + | ||
382 | +{ | ||
383 | + GdkScreen *screen = gdk_drawable_get_screen (drawable); | ||
384 | + GdkBitmap *bitmap; | ||
385 | + GList *tmp_list; | ||
386 | + | ||
387 | + tmp_list = indicator_parts[part].bmap_list; | ||
388 | + while (tmp_list) | ||
389 | + { | ||
390 | + bitmap = tmp_list->data; | ||
391 | + | ||
392 | + if (gdk_drawable_get_screen (bitmap) == screen) | ||
393 | + return bitmap; | ||
394 | + | ||
395 | + tmp_list = tmp_list->next; | ||
396 | + } | ||
397 | + | ||
398 | + bitmap = gdk_bitmap_create_from_data (drawable, | ||
399 | + (gchar *)indicator_parts[part].bits, | ||
400 | + INDICATOR_PART_SIZE, INDICATOR_PART_SIZE); | ||
401 | + indicator_parts[part].bmap_list = g_list_prepend (indicator_parts[part].bmap_list, bitmap); | ||
402 | + | ||
403 | + return bitmap; | ||
404 | +} | ||
405 | + | ||
406 | +static void | ||
407 | +draw_part (GdkDrawable *drawable, | ||
408 | + GdkGC *gc, | ||
409 | + GdkRectangle *area, | ||
410 | + gint x, | ||
411 | + gint y, | ||
412 | + IndicatorPart part) | ||
413 | +{ | ||
414 | + if (area) | ||
415 | + gdk_gc_set_clip_rectangle (gc, area); | ||
416 | + | ||
417 | + gdk_gc_set_ts_origin (gc, x, y); | ||
418 | + gdk_gc_set_stipple (gc, get_indicator_for_screen (drawable, part)); | ||
419 | + gdk_gc_set_fill (gc, GDK_STIPPLED); | ||
420 | + | ||
421 | + gdk_draw_rectangle (drawable, gc, TRUE, x, y, INDICATOR_PART_SIZE, INDICATOR_PART_SIZE); | ||
422 | + | ||
423 | + gdk_gc_set_fill (gc, GDK_SOLID); | ||
424 | + | ||
425 | + if (area) | ||
426 | + gdk_gc_set_clip_rectangle (gc, NULL); | ||
427 | +} | ||
428 | + | ||
429 | static void | ||
430 | gtk_default_draw_hline (GtkStyle *style, | ||
431 | GdkWindow *window, | ||
432 | @@ -2177,6 +2379,9 @@ | ||
433 | gint thickness_dark; | ||
434 | gint i; | ||
435 | |||
436 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
437 | + g_return_if_fail (window != NULL); | ||
438 | + | ||
439 | thickness_light = style->ythickness / 2; | ||
440 | thickness_dark = style->ythickness - thickness_light; | ||
441 | |||
442 | @@ -2231,6 +2436,9 @@ | ||
443 | gint thickness_dark; | ||
444 | gint i; | ||
445 | |||
446 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
447 | + g_return_if_fail (window != NULL); | ||
448 | + | ||
449 | thickness_light = style->xthickness / 2; | ||
450 | thickness_dark = style->xthickness - thickness_light; | ||
451 | |||
452 | @@ -2456,6 +2664,9 @@ | ||
453 | gint thickness_dark; | ||
454 | gint i; | ||
455 | |||
456 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
457 | + g_return_if_fail (window != NULL); | ||
458 | + | ||
459 | if (shadow_type == GTK_SHADOW_IN) | ||
460 | { | ||
461 | if (detail && (strcmp (detail, "buttondefault") == 0)) | ||
462 | @@ -2791,6 +3002,10 @@ | ||
463 | gint yadjust; | ||
464 | gint i; | ||
465 | |||
466 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
467 | + g_return_if_fail (window != NULL); | ||
468 | + g_return_if_fail (points != NULL); | ||
469 | + | ||
470 | switch (shadow_type) | ||
471 | { | ||
472 | case GTK_SHADOW_IN: | ||
473 | @@ -2900,7 +3115,7 @@ | ||
474 | |||
475 | static void | ||
476 | draw_arrow (GdkWindow *window, | ||
477 | - GdkColor *color, | ||
478 | + GdkGC *gc, | ||
479 | GdkRectangle *area, | ||
480 | GtkArrowType arrow_type, | ||
481 | gint x, | ||
482 | @@ -2908,44 +3123,34 @@ | ||
483 | gint width, | ||
484 | gint height) | ||
485 | { | ||
486 | - cairo_t *cr = gdk_cairo_create (window); | ||
487 | - gdk_cairo_set_source_color (cr, color); | ||
488 | - | ||
489 | + gint i, j; | ||
490 | + | ||
491 | if (area) | ||
492 | - { | ||
493 | - gdk_cairo_rectangle (cr, area); | ||
494 | - cairo_clip (cr); | ||
495 | - } | ||
496 | - | ||
497 | + gdk_gc_set_clip_rectangle (gc, area); | ||
498 | + | ||
499 | if (arrow_type == GTK_ARROW_DOWN) | ||
500 | { | ||
501 | - cairo_move_to (cr, x, y); | ||
502 | - cairo_line_to (cr, x + width, y); | ||
503 | - cairo_line_to (cr, x + width / 2., y + height); | ||
504 | + for (i = 0, j = 0; i < height; i++, j++) | ||
505 | + gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); | ||
506 | } | ||
507 | else if (arrow_type == GTK_ARROW_UP) | ||
508 | { | ||
509 | - cairo_move_to (cr, x, y + height); | ||
510 | - cairo_line_to (cr, x + width / 2., y); | ||
511 | - cairo_line_to (cr, x + width, y + height); | ||
512 | + for (i = height - 1, j = 0; i >= 0; i--, j++) | ||
513 | + gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); | ||
514 | } | ||
515 | else if (arrow_type == GTK_ARROW_LEFT) | ||
516 | { | ||
517 | - cairo_move_to (cr, x + width, y); | ||
518 | - cairo_line_to (cr, x + width, y + height); | ||
519 | - cairo_line_to (cr, x, y + height / 2.); | ||
520 | + for (i = width - 1, j = 0; i >= 0; i--, j++) | ||
521 | + gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); | ||
522 | } | ||
523 | else if (arrow_type == GTK_ARROW_RIGHT) | ||
524 | { | ||
525 | - cairo_move_to (cr, x, y); | ||
526 | - cairo_line_to (cr, x + width, y + height / 2.); | ||
527 | - cairo_line_to (cr, x, y + height); | ||
528 | + for (i = 0, j = 0; i < width; i++, j++) | ||
529 | + gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); | ||
530 | } | ||
531 | |||
532 | - cairo_close_path (cr); | ||
533 | - cairo_fill (cr); | ||
534 | - | ||
535 | - cairo_destroy (cr); | ||
536 | + if (area) | ||
537 | + gdk_gc_set_clip_rectangle (gc, NULL); | ||
538 | } | ||
539 | |||
540 | static void | ||
541 | @@ -3032,17 +3237,22 @@ | ||
542 | gint width, | ||
543 | gint height) | ||
544 | { | ||
545 | + gint original_width, original_x; | ||
546 | + | ||
547 | sanitize_size (window, &width, &height); | ||
548 | |||
549 | + original_width = width; | ||
550 | + original_x = x; | ||
551 | + | ||
552 | calculate_arrow_geometry (arrow_type, &x, &y, &width, &height); | ||
553 | |||
554 | if (detail && strcmp (detail, "menu_scroll_arrow_up") == 0) | ||
555 | y++; | ||
556 | |||
557 | if (state == GTK_STATE_INSENSITIVE) | ||
558 | - draw_arrow (window, &style->white, area, arrow_type, | ||
559 | + draw_arrow (window, style->white_gc, area, arrow_type, | ||
560 | x + 1, y + 1, width, height); | ||
561 | - draw_arrow (window, &style->fg[state], area, arrow_type, | ||
562 | + draw_arrow (window, style->fg_gc[state], area, arrow_type, | ||
563 | x, y, width, height); | ||
564 | } | ||
565 | |||
566 | @@ -3074,6 +3284,9 @@ | ||
567 | GdkGC *inner_sw = NULL; | ||
568 | GdkGC *inner_se = NULL; | ||
569 | |||
570 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
571 | + g_return_if_fail (window != NULL); | ||
572 | + | ||
573 | sanitize_size (window, &width, &height); | ||
574 | |||
575 | half_width = width / 2; | ||
576 | @@ -3191,6 +3404,13 @@ | ||
577 | gint y, | ||
578 | const gchar *string) | ||
579 | { | ||
580 | + GdkDisplay *display; | ||
581 | + | ||
582 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
583 | + g_return_if_fail (window != NULL); | ||
584 | + | ||
585 | + display = gdk_drawable_get_display (window); | ||
586 | + | ||
587 | if (area) | ||
588 | { | ||
589 | gdk_gc_set_clip_rectangle (style->white_gc, area); | ||
590 | @@ -3223,8 +3443,8 @@ | ||
591 | |||
592 | if (widget) | ||
593 | gtk_widget_style_get (widget, | ||
594 | - "indicator-size", &tmp_size, | ||
595 | - "indicator-spacing", &tmp_spacing, | ||
596 | + "indicator_size", &tmp_size, | ||
597 | + "indicator_spacing", &tmp_spacing, | ||
598 | NULL); | ||
599 | |||
600 | if (tmp_size) | ||
601 | @@ -3259,6 +3479,9 @@ | ||
602 | { | ||
603 | gboolean is_spinbutton_box = FALSE; | ||
604 | |||
605 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
606 | + g_return_if_fail (window != NULL); | ||
607 | + | ||
608 | sanitize_size (window, &width, &height); | ||
609 | |||
610 | if (widget && GTK_IS_SPIN_BUTTON (widget) && detail) | ||
611 | @@ -3407,6 +3630,9 @@ | ||
612 | GdkGC *gc1; | ||
613 | GdkGC *freeme = NULL; | ||
614 | |||
615 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
616 | + g_return_if_fail (window != NULL); | ||
617 | + | ||
618 | sanitize_size (window, &width, &height); | ||
619 | |||
620 | if (detail) | ||
621 | @@ -3415,26 +3641,15 @@ | ||
622 | { | ||
623 | if (!strcmp ("text", detail)) | ||
624 | gc1 = style->bg_gc[GTK_STATE_SELECTED]; | ||
625 | - else if (!strcmp ("cell_even", detail) || | ||
626 | - !strcmp ("cell_odd", detail) || | ||
627 | - !strcmp ("cell_even_ruled", detail) || | ||
628 | - !strcmp ("cell_even_ruled_sorted", detail)) | ||
629 | + else if (!strncmp ("cell_even", detail, strlen ("cell_even")) || | ||
630 | + !strncmp ("cell_odd", detail, strlen ("cell_odd"))) | ||
631 | { | ||
632 | /* This has to be really broken; alex made me do it. -jrb */ | ||
633 | if (GTK_WIDGET_HAS_FOCUS (widget)) | ||
634 | gc1 = style->base_gc[state_type]; | ||
635 | - else | ||
636 | - gc1 = style->base_gc[GTK_STATE_ACTIVE]; | ||
637 | + else | ||
638 | + gc1 = style->base_gc[GTK_STATE_ACTIVE]; | ||
639 | } | ||
640 | - else if (!strcmp ("cell_odd_ruled", detail) || | ||
641 | - !strcmp ("cell_odd_ruled_sorted", detail)) | ||
642 | - { | ||
643 | - if (GTK_WIDGET_HAS_FOCUS (widget)) | ||
644 | - freeme = get_darkened_gc (window, &style->base[state_type], 1); | ||
645 | - else | ||
646 | - freeme = get_darkened_gc (window, &style->base[GTK_STATE_ACTIVE], 1); | ||
647 | - gc1 = freeme; | ||
648 | - } | ||
649 | else | ||
650 | { | ||
651 | gc1 = style->bg_gc[state_type]; | ||
652 | @@ -3459,7 +3674,7 @@ | ||
653 | GdkColor *color = NULL; | ||
654 | |||
655 | gtk_widget_style_get (widget, | ||
656 | - "even-row-color", &color, | ||
657 | + "even_row_color", &color, | ||
658 | NULL); | ||
659 | |||
660 | if (color) | ||
661 | @@ -3477,7 +3692,7 @@ | ||
662 | GdkColor *color; | ||
663 | |||
664 | gtk_widget_style_get (widget, | ||
665 | - "odd-row-color", &color, | ||
666 | + "odd_row_color", &color, | ||
667 | NULL); | ||
668 | |||
669 | if (color) | ||
670 | @@ -3490,7 +3705,7 @@ | ||
671 | else | ||
672 | { | ||
673 | gtk_widget_style_get (widget, | ||
674 | - "even-row-color", &color, | ||
675 | + "even_row_color", &color, | ||
676 | NULL); | ||
677 | |||
678 | if (color) | ||
679 | @@ -3511,11 +3726,11 @@ | ||
680 | |||
681 | if (!strcmp ("cell_odd_sorted", detail)) | ||
682 | gtk_widget_style_get (widget, | ||
683 | - "odd-row-color", &color, | ||
684 | + "odd_row_color", &color, | ||
685 | NULL); | ||
686 | else | ||
687 | gtk_widget_style_get (widget, | ||
688 | - "even-row-color", &color, | ||
689 | + "even_row_color", &color, | ||
690 | NULL); | ||
691 | |||
692 | if (color) | ||
693 | @@ -3536,7 +3751,7 @@ | ||
694 | GdkColor *color = NULL; | ||
695 | |||
696 | gtk_widget_style_get (widget, | ||
697 | - "odd-row-color", &color, | ||
698 | + "odd_row_color", &color, | ||
699 | NULL); | ||
700 | |||
701 | if (color) | ||
702 | @@ -3549,7 +3764,7 @@ | ||
703 | else | ||
704 | { | ||
705 | gtk_widget_style_get (widget, | ||
706 | - "even-row-color", &color, | ||
707 | + "even_row_color", &color, | ||
708 | NULL); | ||
709 | |||
710 | if (color) | ||
711 | @@ -3595,6 +3810,21 @@ | ||
712 | g_object_unref (freeme); | ||
713 | } | ||
714 | |||
715 | +static GdkGC * | ||
716 | +create_aa_gc (GdkWindow *window, GtkStyle *style, GtkStateType state_type) | ||
717 | +{ | ||
718 | + GdkColor aa_color; | ||
719 | + GdkGC *gc = gdk_gc_new (window); | ||
720 | + | ||
721 | + aa_color.red = (style->fg[state_type].red + style->bg[state_type].red) / 2; | ||
722 | + aa_color.green = (style->fg[state_type].green + style->bg[state_type].green) / 2; | ||
723 | + aa_color.blue = (style->fg[state_type].blue + style->bg[state_type].blue) / 2; | ||
724 | + | ||
725 | + gdk_gc_set_rgb_fg_color (gc, &aa_color); | ||
726 | + | ||
727 | + return gc; | ||
728 | +} | ||
729 | + | ||
730 | static void | ||
731 | gtk_default_draw_check (GtkStyle *style, | ||
732 | GdkWindow *window, | ||
733 | @@ -3608,116 +3838,92 @@ | ||
734 | gint width, | ||
735 | gint height) | ||
736 | { | ||
737 | - cairo_t *cr = gdk_cairo_create (window); | ||
738 | - enum { BUTTON, MENU, CELL } type = BUTTON; | ||
739 | - int exterior_size; | ||
740 | - int interior_size; | ||
741 | - int pad; | ||
742 | - | ||
743 | - if (detail) | ||
744 | - { | ||
745 | - if (strcmp (detail, "cellcheck") == 0) | ||
746 | - type = CELL; | ||
747 | - else if (strcmp (detail, "check") == 0) | ||
748 | - type = MENU; | ||
749 | - } | ||
750 | - | ||
751 | - if (area) | ||
752 | + if (detail && strcmp (detail, "cellcheck") == 0) | ||
753 | { | ||
754 | - gdk_cairo_rectangle (cr, area); | ||
755 | - cairo_clip (cr); | ||
756 | + if (area) | ||
757 | + gdk_gc_set_clip_rectangle (widget->style->base_gc[state_type], area); | ||
758 | + gdk_draw_rectangle (window, | ||
759 | + widget->style->base_gc[state_type], | ||
760 | + TRUE, | ||
761 | + x, y, | ||
762 | + width, height); | ||
763 | + if (area) | ||
764 | + { | ||
765 | + gdk_gc_set_clip_rectangle (widget->style->base_gc[state_type], NULL); | ||
766 | + gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], area); | ||
767 | + } | ||
768 | + gdk_draw_rectangle (window, | ||
769 | + widget->style->text_gc[state_type], | ||
770 | + FALSE, | ||
771 | + x, y, | ||
772 | + width, height); | ||
773 | + if (area) | ||
774 | + gdk_gc_set_clip_rectangle (widget->style->text_gc[state_type], NULL); | ||
775 | + | ||
776 | + x -= (1 + INDICATOR_PART_SIZE - width) / 2; | ||
777 | + y -= (((1 + INDICATOR_PART_SIZE - height) / 2) - 1); | ||
778 | + if (shadow_type == GTK_SHADOW_IN) | ||
779 | + { | ||
780 | + draw_part (window, style->text_gc[state_type], area, x, y, CHECK_TEXT); | ||
781 | + draw_part (window, style->text_aa_gc[state_type], area, x, y, CHECK_AA); | ||
782 | + } | ||
783 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
784 | + { | ||
785 | + draw_part (window, style->text_gc[state_type], area, x, y, CHECK_INCONSISTENT_TEXT); | ||
786 | + } | ||
787 | } | ||
788 | - | ||
789 | - exterior_size = MIN (width, height); | ||
790 | - if (exterior_size % 2 == 0) /* Ensure odd */ | ||
791 | - exterior_size -= -1; | ||
792 | - | ||
793 | - pad = style->xthickness + MAX (1, (exterior_size - 2 * style->xthickness) / 9); | ||
794 | - interior_size = MAX (1, exterior_size - 2 * pad); | ||
795 | - | ||
796 | - if (interior_size < 7) | ||
797 | + else | ||
798 | { | ||
799 | - interior_size = 7; | ||
800 | - pad = MAX (0, (exterior_size - interior_size) / 2); | ||
801 | - } | ||
802 | + GdkGC *free_me = NULL; | ||
803 | + | ||
804 | + GdkGC *base_gc; | ||
805 | + GdkGC *text_gc; | ||
806 | + GdkGC *aa_gc; | ||
807 | |||
808 | - x -= (1 + exterior_size - width) / 2; | ||
809 | - y -= (1 + exterior_size - height) / 2; | ||
810 | + x -= (1 + INDICATOR_PART_SIZE - width) / 2; | ||
811 | + y -= (1 + INDICATOR_PART_SIZE - height) / 2; | ||
812 | |||
813 | - switch (type) | ||
814 | - { | ||
815 | - case BUTTON: | ||
816 | - case CELL: | ||
817 | - if (type == BUTTON) | ||
818 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
819 | + if (detail && strcmp (detail, "check") == 0) /* Menu item */ | ||
820 | + { | ||
821 | + text_gc = style->fg_gc[state_type]; | ||
822 | + base_gc = style->bg_gc[state_type]; | ||
823 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
824 | + } | ||
825 | else | ||
826 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
827 | - | ||
828 | - cairo_set_line_width (cr, 1.0); | ||
829 | - cairo_rectangle (cr, x + 0.5, y + 0.5, exterior_size - 1, exterior_size - 1); | ||
830 | - cairo_stroke (cr); | ||
831 | + { | ||
832 | + if (state_type == GTK_STATE_ACTIVE) | ||
833 | + { | ||
834 | + text_gc = style->fg_gc[state_type]; | ||
835 | + base_gc = style->bg_gc[state_type]; | ||
836 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
837 | + } | ||
838 | + else | ||
839 | + { | ||
840 | + text_gc = style->text_gc[state_type]; | ||
841 | + base_gc = style->base_gc[state_type]; | ||
842 | + aa_gc = style->text_aa_gc[state_type]; | ||
843 | + } | ||
844 | |||
845 | - gdk_cairo_set_source_color (cr, &style->base[state_type]); | ||
846 | - cairo_rectangle (cr, x + 1, y + 1, exterior_size - 2, exterior_size - 2); | ||
847 | - cairo_fill (cr); | ||
848 | - break; | ||
849 | + draw_part (window, base_gc, area, x, y, CHECK_BASE); | ||
850 | + draw_part (window, style->black_gc, area, x, y, CHECK_BLACK); | ||
851 | + draw_part (window, style->dark_gc[state_type], area, x, y, CHECK_DARK); | ||
852 | + draw_part (window, style->mid_gc[state_type], area, x, y, CHECK_MID); | ||
853 | + draw_part (window, style->light_gc[state_type], area, x, y, CHECK_LIGHT); | ||
854 | + } | ||
855 | |||
856 | - case MENU: | ||
857 | - break; | ||
858 | - } | ||
859 | - | ||
860 | - switch (type) | ||
861 | - { | ||
862 | - case BUTTON: | ||
863 | - case CELL: | ||
864 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
865 | - break; | ||
866 | - case MENU: | ||
867 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
868 | - break; | ||
869 | - } | ||
870 | + if (shadow_type == GTK_SHADOW_IN) | ||
871 | + { | ||
872 | + draw_part (window, text_gc, area, x, y, CHECK_TEXT); | ||
873 | + draw_part (window, aa_gc, area, x, y, CHECK_AA); | ||
874 | + } | ||
875 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
876 | + { | ||
877 | + draw_part (window, text_gc, area, x, y, CHECK_INCONSISTENT_TEXT); | ||
878 | + } | ||
879 | |||
880 | - if (shadow_type == GTK_SHADOW_IN) | ||
881 | - { | ||
882 | - cairo_translate (cr, | ||
883 | - x + pad, y + pad); | ||
884 | - | ||
885 | - cairo_scale (cr, interior_size / 7., interior_size / 7.); | ||
886 | - | ||
887 | - cairo_move_to (cr, 7.0, 0.0); | ||
888 | - cairo_line_to (cr, 7.5, 1.0); | ||
889 | - cairo_curve_to (cr, 5.3, 2.0, | ||
890 | - 4.3, 4.0, | ||
891 | - 3.5, 7.0); | ||
892 | - cairo_curve_to (cr, 3.0, 5.7, | ||
893 | - 1.3, 4.7, | ||
894 | - 0.0, 4.7); | ||
895 | - cairo_line_to (cr, 0.2, 3.5); | ||
896 | - cairo_curve_to (cr, 1.1, 3.5, | ||
897 | - 2.3, 4.3, | ||
898 | - 3.0, 5.0); | ||
899 | - cairo_curve_to (cr, 1.0, 3.9, | ||
900 | - 2.4, 4.1, | ||
901 | - 3.2, 4.9); | ||
902 | - cairo_curve_to (cr, 3.5, 3.1, | ||
903 | - 5.2, 2.0, | ||
904 | - 7.0, 0.0); | ||
905 | - | ||
906 | - cairo_fill (cr); | ||
907 | - } | ||
908 | - else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
909 | - { | ||
910 | - int line_thickness = MAX (1, (3 + interior_size * 2) / 7); | ||
911 | - | ||
912 | - cairo_rectangle (cr, | ||
913 | - x + pad, | ||
914 | - y + pad + (1 + interior_size - line_thickness) / 2, | ||
915 | - interior_size, | ||
916 | - line_thickness); | ||
917 | - cairo_fill (cr); | ||
918 | + if (free_me) | ||
919 | + g_object_unref (free_me); | ||
920 | } | ||
921 | - | ||
922 | - cairo_destroy (cr); | ||
923 | } | ||
924 | |||
925 | static void | ||
926 | @@ -3733,111 +3939,96 @@ | ||
927 | gint width, | ||
928 | gint height) | ||
929 | { | ||
930 | - cairo_t *cr = gdk_cairo_create (window); | ||
931 | - enum { BUTTON, MENU, CELL } type = BUTTON; | ||
932 | - int exterior_size; | ||
933 | - | ||
934 | - if (detail) | ||
935 | + if (detail && strcmp (detail, "cellradio") == 0) | ||
936 | { | ||
937 | - if (strcmp (detail, "radio") == 0) | ||
938 | - type = CELL; | ||
939 | - else if (strcmp (detail, "option") == 0) | ||
940 | - type = MENU; | ||
941 | - } | ||
942 | - | ||
943 | - if (area) | ||
944 | - { | ||
945 | - gdk_cairo_rectangle (cr, area); | ||
946 | - cairo_clip (cr); | ||
947 | + if (area) | ||
948 | + gdk_gc_set_clip_rectangle (widget->style->fg_gc[state_type], area); | ||
949 | + gdk_draw_arc (window, | ||
950 | + widget->style->fg_gc[state_type], | ||
951 | + FALSE, | ||
952 | + x, y, | ||
953 | + width, | ||
954 | + height, | ||
955 | + 0, 360*64); | ||
956 | + | ||
957 | + if (shadow_type == GTK_SHADOW_IN) | ||
958 | + { | ||
959 | + gdk_draw_arc (window, | ||
960 | + widget->style->fg_gc[state_type], | ||
961 | + TRUE, | ||
962 | + x + 2, | ||
963 | + y + 2, | ||
964 | + width - 4, | ||
965 | + height - 4, | ||
966 | + 0, 360*64); | ||
967 | + } | ||
968 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
969 | + { | ||
970 | + draw_part (window, widget->style->fg_gc[state_type], | ||
971 | + area, x, y, CHECK_INCONSISTENT_TEXT); | ||
972 | + } | ||
973 | + if (area) | ||
974 | + gdk_gc_set_clip_rectangle (widget->style->fg_gc[state_type], NULL); | ||
975 | } | ||
976 | - | ||
977 | - exterior_size = MIN (width, height); | ||
978 | - if (exterior_size % 2 == 0) /* Ensure odd */ | ||
979 | - exterior_size -= -1; | ||
980 | - | ||
981 | - x -= (1 + exterior_size - width) / 2; | ||
982 | - y -= (1 + exterior_size - height) / 2; | ||
983 | - | ||
984 | - switch (type) | ||
985 | + else | ||
986 | { | ||
987 | - case BUTTON: | ||
988 | - case CELL: | ||
989 | - gdk_cairo_set_source_color (cr, &style->base[state_type]); | ||
990 | + GdkGC *free_me = NULL; | ||
991 | |||
992 | - cairo_arc (cr, | ||
993 | - x + exterior_size / 2., | ||
994 | - y + exterior_size / 2., | ||
995 | - (exterior_size - 1) / 2., | ||
996 | - 0, 2 * G_PI); | ||
997 | + GdkGC *base_gc; | ||
998 | + GdkGC *text_gc; | ||
999 | + GdkGC *aa_gc; | ||
1000 | |||
1001 | - cairo_fill_preserve (cr); | ||
1002 | + x -= (1 + INDICATOR_PART_SIZE - width) / 2; | ||
1003 | + y -= (1 + INDICATOR_PART_SIZE - height) / 2; | ||
1004 | |||
1005 | - if (type == BUTTON) | ||
1006 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
1007 | + if (detail && strcmp (detail, "option") == 0) /* Menu item */ | ||
1008 | + { | ||
1009 | + text_gc = style->fg_gc[state_type]; | ||
1010 | + base_gc = style->bg_gc[state_type]; | ||
1011 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
1012 | + } | ||
1013 | else | ||
1014 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
1015 | - | ||
1016 | - cairo_set_line_width (cr, 1.); | ||
1017 | - cairo_stroke (cr); | ||
1018 | - break; | ||
1019 | - | ||
1020 | - case MENU: | ||
1021 | - break; | ||
1022 | - } | ||
1023 | - | ||
1024 | - switch (type) | ||
1025 | - { | ||
1026 | - case BUTTON: | ||
1027 | - gdk_cairo_set_source_color (cr, &style->text[state_type]); | ||
1028 | - break; | ||
1029 | - case CELL: | ||
1030 | - break; | ||
1031 | - case MENU: | ||
1032 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
1033 | - break; | ||
1034 | - } | ||
1035 | + { | ||
1036 | + if (state_type == GTK_STATE_ACTIVE) | ||
1037 | + { | ||
1038 | + text_gc = style->fg_gc[state_type]; | ||
1039 | + base_gc = style->bg_gc[state_type]; | ||
1040 | + aa_gc = free_me = create_aa_gc (window, style, state_type); | ||
1041 | + } | ||
1042 | + else | ||
1043 | + { | ||
1044 | + text_gc = style->text_gc[state_type]; | ||
1045 | + base_gc = style->base_gc[state_type]; | ||
1046 | + aa_gc = style->text_aa_gc[state_type]; | ||
1047 | + } | ||
1048 | |||
1049 | - if (shadow_type == GTK_SHADOW_IN) | ||
1050 | - { | ||
1051 | - int pad = style->xthickness + MAX (1, 2 * (exterior_size - 2 * style->xthickness) / 9); | ||
1052 | - int interior_size = MAX (1, exterior_size - 2 * pad); | ||
1053 | + draw_part (window, base_gc, area, x, y, RADIO_BASE); | ||
1054 | + draw_part (window, style->black_gc, area, x, y, RADIO_BLACK); | ||
1055 | + draw_part (window, style->dark_gc[state_type], area, x, y, RADIO_DARK); | ||
1056 | + draw_part (window, style->mid_gc[state_type], area, x, y, RADIO_MID); | ||
1057 | + draw_part (window, style->light_gc[state_type], area, x, y, RADIO_LIGHT); | ||
1058 | + } | ||
1059 | |||
1060 | - if (interior_size < 5) | ||
1061 | + if (shadow_type == GTK_SHADOW_IN) | ||
1062 | { | ||
1063 | - interior_size = 7; | ||
1064 | - pad = MAX (0, (exterior_size - interior_size) / 2); | ||
1065 | + draw_part (window, text_gc, area, x, y, RADIO_TEXT); | ||
1066 | } | ||
1067 | - | ||
1068 | - cairo_arc (cr, | ||
1069 | - x + pad + interior_size / 2., | ||
1070 | - y + pad + interior_size / 2., | ||
1071 | - interior_size / 2., | ||
1072 | - 0, 2 * G_PI); | ||
1073 | - cairo_fill (cr); | ||
1074 | - } | ||
1075 | - else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
1076 | - { | ||
1077 | - int pad = style->xthickness + MAX (1, (exterior_size - 2 * style->xthickness) / 9); | ||
1078 | - int interior_size = MAX (1, exterior_size - 2 * pad); | ||
1079 | - int line_thickness; | ||
1080 | - | ||
1081 | - if (interior_size < 7) | ||
1082 | + else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ | ||
1083 | { | ||
1084 | - interior_size = 7; | ||
1085 | - pad = MAX (0, (exterior_size - interior_size) / 2); | ||
1086 | + if (detail && strcmp (detail, "option") == 0) /* Menu item */ | ||
1087 | + { | ||
1088 | + draw_part (window, text_gc, area, x, y, CHECK_INCONSISTENT_TEXT); | ||
1089 | + } | ||
1090 | + else | ||
1091 | + { | ||
1092 | + draw_part (window, text_gc, area, x, y, RADIO_INCONSISTENT_TEXT); | ||
1093 | + draw_part (window, aa_gc, area, x, y, RADIO_INCONSISTENT_AA); | ||
1094 | + } | ||
1095 | } | ||
1096 | |||
1097 | - line_thickness = MAX (1, (3 + interior_size * 2) / 7); | ||
1098 | - | ||
1099 | - cairo_rectangle (cr, | ||
1100 | - x + pad, | ||
1101 | - y + pad + (interior_size - line_thickness) / 2., | ||
1102 | - interior_size, | ||
1103 | - line_thickness); | ||
1104 | - cairo_fill (cr); | ||
1105 | + if (free_me) | ||
1106 | + g_object_unref (free_me); | ||
1107 | } | ||
1108 | - | ||
1109 | - cairo_destroy (cr); | ||
1110 | } | ||
1111 | |||
1112 | static void | ||
1113 | @@ -3869,21 +4060,21 @@ | ||
1114 | |||
1115 | if (state_type == GTK_STATE_INSENSITIVE) | ||
1116 | { | ||
1117 | - draw_arrow (window, &style->white, area, | ||
1118 | + draw_arrow (window, style->white_gc, area, | ||
1119 | GTK_ARROW_UP, x + 1, y + 1, | ||
1120 | indicator_size.width, arrow_height); | ||
1121 | |||
1122 | - draw_arrow (window, &style->white, area, | ||
1123 | + draw_arrow (window, style->white_gc, area, | ||
1124 | GTK_ARROW_DOWN, x + 1, y + arrow_height + ARROW_SPACE + 1, | ||
1125 | indicator_size.width, arrow_height); | ||
1126 | } | ||
1127 | |||
1128 | - draw_arrow (window, &style->fg[state_type], area, | ||
1129 | + draw_arrow (window, style->fg_gc[state_type], area, | ||
1130 | GTK_ARROW_UP, x, y, | ||
1131 | indicator_size.width, arrow_height); | ||
1132 | |||
1133 | |||
1134 | - draw_arrow (window, &style->fg[state_type], area, | ||
1135 | + draw_arrow (window, style->fg_gc[state_type], area, | ||
1136 | GTK_ARROW_DOWN, x, y + arrow_height + ARROW_SPACE, | ||
1137 | indicator_size.width, arrow_height); | ||
1138 | } | ||
1139 | @@ -3909,6 +4100,9 @@ | ||
1140 | GdkGC *gc3 = NULL; | ||
1141 | GdkGC *gc4 = NULL; | ||
1142 | |||
1143 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
1144 | + g_return_if_fail (window != NULL); | ||
1145 | + | ||
1146 | sanitize_size (window, &width, &height); | ||
1147 | |||
1148 | switch (shadow_type) | ||
1149 | @@ -4122,6 +4316,9 @@ | ||
1150 | GdkGC *gc3 = NULL; | ||
1151 | GdkGC *gc4 = NULL; | ||
1152 | |||
1153 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
1154 | + g_return_if_fail (window != NULL); | ||
1155 | + | ||
1156 | gtk_style_apply_default_background (style, window, | ||
1157 | widget && !GTK_WIDGET_NO_WINDOW (widget), | ||
1158 | state_type, area, x, y, width, height); | ||
1159 | @@ -4338,6 +4535,9 @@ | ||
1160 | GdkGC *gc3 = NULL; | ||
1161 | GdkGC *gc4 = NULL; | ||
1162 | |||
1163 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
1164 | + g_return_if_fail (window != NULL); | ||
1165 | + | ||
1166 | gtk_style_apply_default_background (style, window, | ||
1167 | widget && !GTK_WIDGET_NO_WINDOW (widget), | ||
1168 | GTK_STATE_NORMAL, area, x, y, width, height); | ||
1169 | @@ -4503,10 +4703,12 @@ | ||
1170 | gint width, | ||
1171 | gint height) | ||
1172 | { | ||
1173 | - cairo_t *cr; | ||
1174 | + GdkPoint points[5]; | ||
1175 | + GdkGC *gc; | ||
1176 | gboolean free_dash_list = FALSE; | ||
1177 | gint line_width = 1; | ||
1178 | gint8 *dash_list = "\1\1"; | ||
1179 | + gint dash_len; | ||
1180 | |||
1181 | if (widget) | ||
1182 | { | ||
1183 | @@ -4518,6 +4720,22 @@ | ||
1184 | free_dash_list = TRUE; | ||
1185 | } | ||
1186 | |||
1187 | + sanitize_size (window, &width, &height); | ||
1188 | + | ||
1189 | + if (detail && !strcmp (detail, "colorwheel_light")) | ||
1190 | + gc = style->black_gc; | ||
1191 | + else if (detail && !strcmp (detail, "colorwheel_dark")) | ||
1192 | + gc = style->white_gc; | ||
1193 | + else | ||
1194 | + gc = style->fg_gc[state_type]; | ||
1195 | + | ||
1196 | + gdk_gc_set_line_attributes (gc, line_width, | ||
1197 | + dash_list[0] ? GDK_LINE_ON_OFF_DASH : GDK_LINE_SOLID, | ||
1198 | + GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
1199 | + | ||
1200 | + if (area) | ||
1201 | + gdk_gc_set_clip_rectangle (gc, area); | ||
1202 | + | ||
1203 | if (detail && !strcmp (detail, "add-mode")) | ||
1204 | { | ||
1205 | if (free_dash_list) | ||
1206 | @@ -4527,59 +4745,88 @@ | ||
1207 | free_dash_list = FALSE; | ||
1208 | } | ||
1209 | |||
1210 | - sanitize_size (window, &width, &height); | ||
1211 | + points[0].x = x + line_width / 2; | ||
1212 | + points[0].y = y + line_width / 2; | ||
1213 | + points[1].x = x + width - line_width + line_width / 2; | ||
1214 | + points[1].y = y + line_width / 2; | ||
1215 | + points[2].x = x + width - line_width + line_width / 2; | ||
1216 | + points[2].y = y + height - line_width + line_width / 2; | ||
1217 | + points[3].x = x + line_width / 2; | ||
1218 | + points[3].y = y + height - line_width + line_width / 2; | ||
1219 | + points[4] = points[0]; | ||
1220 | |||
1221 | - cr = gdk_cairo_create (window); | ||
1222 | - | ||
1223 | - if (detail && !strcmp (detail, "colorwheel_light")) | ||
1224 | - cairo_set_source_rgb (cr, 0., 0., 0.); | ||
1225 | - else if (detail && !strcmp (detail, "colorwheel_dark")) | ||
1226 | - cairo_set_source_rgb (cr, 1., 1., 1.); | ||
1227 | + if (!dash_list[0]) | ||
1228 | + { | ||
1229 | + gdk_draw_lines (window, gc, points, 5); | ||
1230 | + } | ||
1231 | else | ||
1232 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
1233 | - | ||
1234 | - cairo_set_line_width (cr, line_width); | ||
1235 | - | ||
1236 | - if (dash_list[0]) | ||
1237 | { | ||
1238 | - gint n_dashes = strlen (dash_list); | ||
1239 | - gdouble *dashes = g_new (gdouble, n_dashes); | ||
1240 | - gdouble total_length = 0; | ||
1241 | - gdouble dash_offset; | ||
1242 | - gint i; | ||
1243 | - | ||
1244 | - for (i = 0; i < n_dashes; i++) | ||
1245 | + /* We go through all the pain below because the X rasterization | ||
1246 | + * rules don't really work right for dashed lines if you | ||
1247 | + * want continuity in segments that go between top/right | ||
1248 | + * and left/bottom. For instance, a top left corner | ||
1249 | + * with a 1-1 dash is drawn as: | ||
1250 | + * | ||
1251 | + * X X X | ||
1252 | + * X | ||
1253 | + * | ||
1254 | + * X | ||
1255 | + * | ||
1256 | + * This is because pixels on the top and left boundaries | ||
1257 | + * of polygons are drawn, but not on the bottom and right. | ||
1258 | + * So, if you have a line going up that turns the corner | ||
1259 | + * and goes right, there is a one pixel shift in the pattern. | ||
1260 | + * | ||
1261 | + * So, to fix this, we drawn the top and right in one call, | ||
1262 | + * then the left and bottom in another call, fixing up | ||
1263 | + * the dash offset for the second call ourselves to get | ||
1264 | + * continuity at the upper left. | ||
1265 | + * | ||
1266 | + * It's not perfect since we really should have a join at | ||
1267 | + * the upper left and lower right instead of two intersecting | ||
1268 | + * lines but that's only really apparent for no-dashes, | ||
1269 | + * which (for this reason) are done as one polygon and | ||
1270 | + * don't to through this code path. | ||
1271 | + */ | ||
1272 | + | ||
1273 | + dash_len = strlen (dash_list); | ||
1274 | + | ||
1275 | + if (dash_list[0]) | ||
1276 | + gdk_gc_set_dashes (gc, 0, dash_list, dash_len); | ||
1277 | + | ||
1278 | + gdk_draw_lines (window, gc, points, 3); | ||
1279 | + | ||
1280 | + /* We draw this line one farther over than it is "supposed" to | ||
1281 | + * because of another rasterization problem ... if two 1 pixel | ||
1282 | + * unjoined lines meet at the lower right, there will be a missing | ||
1283 | + * pixel. | ||
1284 | + */ | ||
1285 | + points[2].x += 1; | ||
1286 | + | ||
1287 | + if (dash_list[0]) | ||
1288 | { | ||
1289 | - dashes[i] = dash_list[i]; | ||
1290 | - total_length += dash_list[i]; | ||
1291 | + gint dash_pixels = 0; | ||
1292 | + gint i; | ||
1293 | + | ||
1294 | + /* Adjust the dash offset for the bottom and left so we | ||
1295 | + * match up at the upper left. | ||
1296 | + */ | ||
1297 | + for (i = 0; i < dash_len; i++) | ||
1298 | + dash_pixels += dash_list[i]; | ||
1299 | + | ||
1300 | + if (dash_len % 2 == 1) | ||
1301 | + dash_pixels *= 2; | ||
1302 | + | ||
1303 | + gdk_gc_set_dashes (gc, dash_pixels - (width + height - 2 * line_width) % dash_pixels, dash_list, dash_len); | ||
1304 | } | ||
1305 | - | ||
1306 | - /* The dash offset here aligns the pattern to integer pixels | ||
1307 | - * by starting the dash at the right side of the left border | ||
1308 | - * Negative dash offsets in cairo don't work | ||
1309 | - * (https://bugs.freedesktop.org/show_bug.cgi?id=2729) | ||
1310 | - */ | ||
1311 | - dash_offset = - line_width / 2.; | ||
1312 | - while (dash_offset < 0) | ||
1313 | - dash_offset += total_length; | ||
1314 | |||
1315 | - cairo_set_dash (cr, dashes, n_dashes, dash_offset); | ||
1316 | - g_free (dashes); | ||
1317 | + gdk_draw_lines (window, gc, points + 2, 3); | ||
1318 | } | ||
1319 | |||
1320 | - if (area) | ||
1321 | - { | ||
1322 | - gdk_cairo_rectangle (cr, area); | ||
1323 | - cairo_clip (cr); | ||
1324 | - } | ||
1325 | + gdk_gc_set_line_attributes (gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
1326 | |||
1327 | - cairo_rectangle (cr, | ||
1328 | - x + line_width / 2., | ||
1329 | - y + line_width / 2., | ||
1330 | - width - line_width, | ||
1331 | - height - line_width); | ||
1332 | - cairo_stroke (cr); | ||
1333 | - cairo_destroy (cr); | ||
1334 | + if (area) | ||
1335 | + gdk_gc_set_clip_rectangle (gc, NULL); | ||
1336 | |||
1337 | if (free_dash_list) | ||
1338 | g_free (dash_list); | ||
1339 | @@ -4599,6 +4846,9 @@ | ||
1340 | gint height, | ||
1341 | GtkOrientation orientation) | ||
1342 | { | ||
1343 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
1344 | + g_return_if_fail (window != NULL); | ||
1345 | + | ||
1346 | sanitize_size (window, &width, &height); | ||
1347 | |||
1348 | gtk_paint_box (style, window, state_type, shadow_type, | ||
1349 | @@ -4627,6 +4877,7 @@ | ||
1350 | gint y, | ||
1351 | gushort size) | ||
1352 | { | ||
1353 | + | ||
1354 | size = CLAMP (size, 2, 3); | ||
1355 | |||
1356 | if (size == 2) | ||
1357 | @@ -4667,6 +4918,9 @@ | ||
1358 | GdkRectangle dest; | ||
1359 | gint intersect; | ||
1360 | |||
1361 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
1362 | + g_return_if_fail (window != NULL); | ||
1363 | + | ||
1364 | sanitize_size (window, &width, &height); | ||
1365 | |||
1366 | gtk_paint_box (style, window, state_type, shadow_type, area, widget, | ||
1367 | @@ -4682,9 +4936,9 @@ | ||
1368 | if (state_type == GTK_STATE_SELECTED && widget && !GTK_WIDGET_HAS_FOCUS (widget)) | ||
1369 | { | ||
1370 | GdkColor unfocused_light; | ||
1371 | - | ||
1372 | + | ||
1373 | _gtk_style_shade (&style->base[GTK_STATE_ACTIVE], &unfocused_light, | ||
1374 | - LIGHTNESS_MULT); | ||
1375 | + LIGHTNESS_MULT); | ||
1376 | |||
1377 | light_gc = free_me = gdk_gc_new (window); | ||
1378 | gdk_gc_set_rgb_fg_color (light_gc, &unfocused_light); | ||
1379 | @@ -4750,6 +5004,72 @@ | ||
1380 | } | ||
1381 | |||
1382 | static void | ||
1383 | +create_expander_affine (gdouble affine[6], | ||
1384 | + gint degrees, | ||
1385 | + gint expander_size, | ||
1386 | + gint x, | ||
1387 | + gint y) | ||
1388 | +{ | ||
1389 | + gdouble s, c; | ||
1390 | + gdouble width; | ||
1391 | + gdouble height; | ||
1392 | + | ||
1393 | + width = expander_size / 4.0; | ||
1394 | + height = expander_size / 2.0; | ||
1395 | + | ||
1396 | + switch (degrees) | ||
1397 | + { | ||
1398 | + case 0: | ||
1399 | + s = 0.0; | ||
1400 | + c = 1.0; | ||
1401 | + break; | ||
1402 | + case 90: | ||
1403 | + s = 1.0; | ||
1404 | + c = 0.0; | ||
1405 | + break; | ||
1406 | + case 180: | ||
1407 | + s = 0.0; | ||
1408 | + c = -1.0; | ||
1409 | + break; | ||
1410 | + default: | ||
1411 | + s = sin (degrees * G_PI / 180.0); | ||
1412 | + c = cos (degrees * G_PI / 180.0); | ||
1413 | + break; | ||
1414 | + } | ||
1415 | + | ||
1416 | + affine[0] = c; | ||
1417 | + affine[1] = s; | ||
1418 | + affine[2] = -s; | ||
1419 | + affine[3] = c; | ||
1420 | + affine[4] = -width * c - height * -s + x; | ||
1421 | + affine[5] = -width * s - height * c + y; | ||
1422 | +} | ||
1423 | + | ||
1424 | +static void | ||
1425 | +apply_affine_on_point (double affine[6], GdkPoint *point) | ||
1426 | +{ | ||
1427 | + gdouble x, y; | ||
1428 | + | ||
1429 | + x = point->x * affine[0] + point->y * affine[2] + affine[4]; | ||
1430 | + y = point->x * affine[1] + point->y * affine[3] + affine[5]; | ||
1431 | + | ||
1432 | + point->x = floor (x); | ||
1433 | + point->y = floor (y); | ||
1434 | +} | ||
1435 | + | ||
1436 | +static void | ||
1437 | +gtk_style_draw_polygon_with_gc (GdkWindow *window, GdkGC *gc, gint line_width, | ||
1438 | + gboolean do_fill, GdkPoint *points, gint n_points) | ||
1439 | +{ | ||
1440 | + gdk_gc_set_line_attributes (gc, line_width, | ||
1441 | + GDK_LINE_SOLID, | ||
1442 | + GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
1443 | + | ||
1444 | + gdk_draw_polygon (window, gc, do_fill, points, n_points); | ||
1445 | + gdk_gc_set_line_attributes (gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); | ||
1446 | +} | ||
1447 | + | ||
1448 | +static void | ||
1449 | gtk_default_draw_expander (GtkStyle *style, | ||
1450 | GdkWindow *window, | ||
1451 | GtkStateType state_type, | ||
1452 | @@ -4760,127 +5080,82 @@ | ||
1453 | gint y, | ||
1454 | GtkExpanderStyle expander_style) | ||
1455 | { | ||
1456 | -#define DEFAULT_EXPANDER_SIZE 12 | ||
1457 | - | ||
1458 | gint expander_size; | ||
1459 | - gint line_width; | ||
1460 | - double vertical_overshoot; | ||
1461 | - int diameter; | ||
1462 | - double radius; | ||
1463 | - double interp; /* interpolation factor for center position */ | ||
1464 | - double x_double_horz, y_double_horz; | ||
1465 | - double x_double_vert, y_double_vert; | ||
1466 | - double x_double, y_double; | ||
1467 | + GdkPoint points[3]; | ||
1468 | + gint i; | ||
1469 | + gint line_width, o; | ||
1470 | + gdouble affine[6]; | ||
1471 | gint degrees = 0; | ||
1472 | |||
1473 | - cairo_t *cr = gdk_cairo_create (window); | ||
1474 | - | ||
1475 | + gtk_widget_style_get (widget, | ||
1476 | + "expander-size", &expander_size, | ||
1477 | + NULL); | ||
1478 | + line_width = MAX (1, expander_size/9); | ||
1479 | + | ||
1480 | if (area) | ||
1481 | { | ||
1482 | - gdk_cairo_rectangle (cr, area); | ||
1483 | - cairo_clip (cr); | ||
1484 | + gdk_gc_set_clip_rectangle (style->fg_gc[GTK_STATE_NORMAL], area); | ||
1485 | + gdk_gc_set_clip_rectangle (style->base_gc[GTK_STATE_NORMAL], area); | ||
1486 | } | ||
1487 | |||
1488 | - if (widget && | ||
1489 | - gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget), | ||
1490 | - "expander-size")) | ||
1491 | - { | ||
1492 | - gtk_widget_style_get (widget, | ||
1493 | - "expander-size", &expander_size, | ||
1494 | - NULL); | ||
1495 | - } | ||
1496 | - else | ||
1497 | - expander_size = DEFAULT_EXPANDER_SIZE; | ||
1498 | - | ||
1499 | - line_width = MAX (1, expander_size/9); | ||
1500 | + /* a rough estimate of how much the joins of the triangle will overshoot. | ||
1501 | + * 2.4 ~ 1 / tan (45 / 2) | ||
1502 | + */ | ||
1503 | + o = ceil (2.4 * line_width / 2.0); | ||
1504 | + points[0].x = line_width / 2; | ||
1505 | + points[0].y = o; | ||
1506 | + points[1].x = expander_size / 2 + line_width / 2 - o; | ||
1507 | + points[1].y = expander_size / 2; | ||
1508 | + points[2].x = line_width / 2; | ||
1509 | + points[2].y = expander_size - o; | ||
1510 | |||
1511 | switch (expander_style) | ||
1512 | { | ||
1513 | case GTK_EXPANDER_COLLAPSED: | ||
1514 | degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 180 : 0; | ||
1515 | - interp = 0.0; | ||
1516 | break; | ||
1517 | case GTK_EXPANDER_SEMI_COLLAPSED: | ||
1518 | degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 150 : 30; | ||
1519 | - interp = 0.25; | ||
1520 | break; | ||
1521 | case GTK_EXPANDER_SEMI_EXPANDED: | ||
1522 | degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 120 : 60; | ||
1523 | - interp = 0.75; | ||
1524 | break; | ||
1525 | case GTK_EXPANDER_EXPANDED: | ||
1526 | degrees = 90; | ||
1527 | - interp = 1.0; | ||
1528 | break; | ||
1529 | default: | ||
1530 | g_assert_not_reached (); | ||
1531 | } | ||
1532 | |||
1533 | - /* Compute distance that the stroke extends beyonds the end | ||
1534 | - * of the triangle we draw. | ||
1535 | - */ | ||
1536 | - vertical_overshoot = line_width / 2.0 * (1. / tan (G_PI / 8)); | ||
1537 | - | ||
1538 | - /* For odd line widths, we end the vertical line of the triangle | ||
1539 | - * at a half pixel, so we round differently. | ||
1540 | - */ | ||
1541 | - if (line_width % 2 == 1) | ||
1542 | - vertical_overshoot = ceil (0.5 + vertical_overshoot) - 0.5; | ||
1543 | - else | ||
1544 | - vertical_overshoot = ceil (vertical_overshoot); | ||
1545 | - | ||
1546 | - /* Adjust the size of the triangle we draw so that the entire stroke fits | ||
1547 | - */ | ||
1548 | - diameter = MAX (3, expander_size - 2 * vertical_overshoot); | ||
1549 | - | ||
1550 | - /* If the line width is odd, we want the diameter to be even, | ||
1551 | - * and vice versa, so force the sum to be odd. This relationship | ||
1552 | - * makes the point of the triangle look right. | ||
1553 | - */ | ||
1554 | - diameter -= (1 - (diameter + line_width) % 2); | ||
1555 | - | ||
1556 | - radius = diameter / 2.; | ||
1557 | - | ||
1558 | - /* Adjust the center so that the stroke is properly aligned with | ||
1559 | - * the pixel grid. The center adjustment is different for the | ||
1560 | - * horizontal and vertical orientations. For intermediate positions | ||
1561 | - * we interpolate between the two. | ||
1562 | - */ | ||
1563 | - x_double_vert = floor (x - (radius + line_width) / 2.) + (radius + line_width) / 2.; | ||
1564 | - y_double_vert = y - 0.5; | ||
1565 | - | ||
1566 | - x_double_horz = x - 0.5; | ||
1567 | - y_double_horz = floor (y - (radius + line_width) / 2.) + (radius + line_width) / 2.; | ||
1568 | - | ||
1569 | - x_double = x_double_vert * (1 - interp) + x_double_horz * interp; | ||
1570 | - y_double = y_double_vert * (1 - interp) + y_double_horz * interp; | ||
1571 | - | ||
1572 | - cairo_translate (cr, x_double, y_double); | ||
1573 | - cairo_rotate (cr, degrees * G_PI / 180); | ||
1574 | + create_expander_affine (affine, degrees, expander_size, x, y); | ||
1575 | |||
1576 | - cairo_move_to (cr, - radius / 2., - radius); | ||
1577 | - cairo_line_to (cr, radius / 2., 0); | ||
1578 | - cairo_line_to (cr, - radius / 2., radius); | ||
1579 | - cairo_close_path (cr); | ||
1580 | - | ||
1581 | - cairo_set_line_width (cr, line_width); | ||
1582 | + for (i = 0; i < 3; i++) | ||
1583 | + apply_affine_on_point (affine, &points[i]); | ||
1584 | |||
1585 | if (state_type == GTK_STATE_PRELIGHT) | ||
1586 | - gdk_cairo_set_source_color (cr, | ||
1587 | - &style->fg[GTK_STATE_PRELIGHT]); | ||
1588 | + { | ||
1589 | + gtk_style_draw_polygon_with_gc (window, style->fg_gc[GTK_STATE_PRELIGHT], | ||
1590 | + 1, TRUE, points, 3); | ||
1591 | + } | ||
1592 | else if (state_type == GTK_STATE_ACTIVE) | ||
1593 | - gdk_cairo_set_source_color (cr, | ||
1594 | - &style->light[GTK_STATE_ACTIVE]); | ||
1595 | + { | ||
1596 | + gtk_style_draw_polygon_with_gc (window, style->light_gc[GTK_STATE_ACTIVE], | ||
1597 | + 1, TRUE, points, 3); | ||
1598 | + gtk_style_draw_polygon_with_gc (window, style->fg_gc[GTK_STATE_NORMAL], | ||
1599 | + line_width, FALSE, points, 3); | ||
1600 | + } | ||
1601 | else | ||
1602 | - gdk_cairo_set_source_color (cr, | ||
1603 | - &style->base[GTK_STATE_NORMAL]); | ||
1604 | - | ||
1605 | - cairo_fill_preserve (cr); | ||
1606 | - | ||
1607 | - gdk_cairo_set_source_color (cr, &style->fg[state_type]); | ||
1608 | - cairo_stroke (cr); | ||
1609 | - | ||
1610 | - cairo_destroy (cr); | ||
1611 | + { | ||
1612 | + gtk_style_draw_polygon_with_gc (window, style->base_gc[GTK_STATE_NORMAL], | ||
1613 | + 1, TRUE, points, 3); | ||
1614 | + gtk_style_draw_polygon_with_gc (window, style->fg_gc[GTK_STATE_NORMAL], | ||
1615 | + line_width, FALSE, points, 3); | ||
1616 | + } | ||
1617 | + if (area) | ||
1618 | + { | ||
1619 | + gdk_gc_set_clip_rectangle (style->fg_gc[GTK_STATE_NORMAL], NULL); | ||
1620 | + gdk_gc_set_clip_rectangle (style->base_gc[GTK_STATE_NORMAL], NULL); | ||
1621 | + } | ||
1622 | } | ||
1623 | |||
1624 | typedef struct _ByteRange ByteRange; | ||
1625 | @@ -5046,6 +5321,9 @@ | ||
1626 | PangoLayout *layout) | ||
1627 | { | ||
1628 | GdkGC *gc; | ||
1629 | + | ||
1630 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
1631 | + g_return_if_fail (window != NULL); | ||
1632 | |||
1633 | gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type]; | ||
1634 | |||
1635 | @@ -5087,6 +5365,9 @@ | ||
1636 | GdkPoint points[4]; | ||
1637 | gint i, j, skip; | ||
1638 | |||
1639 | + g_return_if_fail (GTK_IS_STYLE (style)); | ||
1640 | + g_return_if_fail (window != NULL); | ||
1641 | + | ||
1642 | if (area) | ||
1643 | { | ||
1644 | gdk_gc_set_clip_rectangle (style->light_gc[state_type], area); | ||
1645 | @@ -5390,8 +5671,8 @@ | ||
1646 | |||
1647 | void | ||
1648 | _gtk_style_shade (GdkColor *a, | ||
1649 | - GdkColor *b, | ||
1650 | - gdouble k) | ||
1651 | + GdkColor *b, | ||
1652 | + gdouble k) | ||
1653 | { | ||
1654 | gdouble red; | ||
1655 | gdouble green; | ||
1656 | @@ -5578,10 +5859,9 @@ | ||
1657 | * @style: a #GtkStyle | ||
1658 | * @window: a #GdkWindow | ||
1659 | * @state_type: a state | ||
1660 | - * @area: rectangle to which the output is clipped, or %NULL if the | ||
1661 | - * output should not be clipped | ||
1662 | - * @widget: the widget (may be %NULL) | ||
1663 | - * @detail: a style detail (may be %NULL) | ||
1664 | + * @area: rectangle to which the output is clipped | ||
1665 | + * @widget: the widget | ||
1666 | + * @detail: a style detail | ||
1667 | * @x1: the starting x coordinate | ||
1668 | * @x2: the ending x coordinate | ||
1669 | * @y: the y coordinate | ||
1670 | @@ -5602,7 +5882,6 @@ | ||
1671 | { | ||
1672 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1673 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL); | ||
1674 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1675 | |||
1676 | GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y); | ||
1677 | } | ||
1678 | @@ -5612,10 +5891,9 @@ | ||
1679 | * @style: a #GtkStyle | ||
1680 | * @window: a #GdkWindow | ||
1681 | * @state_type: a state | ||
1682 | - * @area: rectangle to which the output is clipped, or %NULL if the | ||
1683 | - * output should not be clipped | ||
1684 | - * @widget: the widget (may be %NULL) | ||
1685 | - * @detail: a style detail (may be %NULL) | ||
1686 | + * @area: rectangle to which the output is clipped | ||
1687 | + * @widget: the widget | ||
1688 | + * @detail: a style detail | ||
1689 | * @y1_: the starting y coordinate | ||
1690 | * @y2_: the ending y coordinate | ||
1691 | * @x: the x coordinate | ||
1692 | @@ -5636,7 +5914,6 @@ | ||
1693 | { | ||
1694 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1695 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL); | ||
1696 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1697 | |||
1698 | GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1_, y2_, x); | ||
1699 | } | ||
1700 | @@ -5647,10 +5924,9 @@ | ||
1701 | * @window: a #GdkWindow | ||
1702 | * @state_type: a state | ||
1703 | * @shadow_type: type of shadow to draw | ||
1704 | - * @area: clip rectangle or %NULL if the | ||
1705 | - * output should not be clipped | ||
1706 | - * @widget: the widget (may be %NULL) | ||
1707 | - * @detail: a style detail (may be %NULL) | ||
1708 | + * @area: clip rectangle | ||
1709 | + * @widget: the widget | ||
1710 | + * @detail: a style detail | ||
1711 | * @x: x origin of the rectangle | ||
1712 | * @y: y origin of the rectangle | ||
1713 | * @width: width of the rectangle | ||
1714 | @@ -5674,7 +5950,6 @@ | ||
1715 | { | ||
1716 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1717 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL); | ||
1718 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1719 | |||
1720 | GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
1721 | } | ||
1722 | @@ -5685,10 +5960,9 @@ | ||
1723 | * @window: a #GdkWindow | ||
1724 | * @state_type: a state | ||
1725 | * @shadow_type: type of shadow to draw | ||
1726 | - * @area: clip rectangle, or %NULL if the | ||
1727 | - * output should not be clipped | ||
1728 | - * @widget: the widget (may be %NULL) | ||
1729 | - * @detail: a style detail (may be %NULL) | ||
1730 | + * @area: clip rectangle | ||
1731 | + * @widget: the widget | ||
1732 | + * @detail: a style detail | ||
1733 | * @points: an array of #GdkPoint<!-- -->s | ||
1734 | * @npoints: length of @points | ||
1735 | * @fill: %TRUE if the polygon should be filled | ||
1736 | @@ -5709,7 +5983,6 @@ | ||
1737 | { | ||
1738 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1739 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL); | ||
1740 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1741 | |||
1742 | GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill); | ||
1743 | } | ||
1744 | @@ -5720,10 +5993,9 @@ | ||
1745 | * @window: a #GdkWindow | ||
1746 | * @state_type: a state | ||
1747 | * @shadow_type: the type of shadow to draw | ||
1748 | - * @area: clip rectangle, or %NULL if the | ||
1749 | - * output should not be clipped | ||
1750 | - * @widget: the widget (may be %NULL) | ||
1751 | - * @detail: a style detail (may be %NULL) | ||
1752 | + * @area: clip rectangle | ||
1753 | + * @widget: the widget | ||
1754 | + * @detail: a style detail | ||
1755 | * @arrow_type: the type of arrow to draw | ||
1756 | * @fill: %TRUE if the arrow tip should be filled | ||
1757 | * @x: x origin of the rectangle to draw the arrow in | ||
1758 | @@ -5751,7 +6023,6 @@ | ||
1759 | { | ||
1760 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1761 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL); | ||
1762 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1763 | |||
1764 | GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height); | ||
1765 | } | ||
1766 | @@ -5762,10 +6033,9 @@ | ||
1767 | * @window: a #GdkWindow | ||
1768 | * @state_type: a state | ||
1769 | * @shadow_type: the type of shadow to draw | ||
1770 | - * @area: clip rectangle, or %NULL if the | ||
1771 | - * output should not be clipped | ||
1772 | - * @widget: the widget (may be %NULL) | ||
1773 | - * @detail: a style detail (may be %NULL) | ||
1774 | + * @area: clip rectangle | ||
1775 | + * @widget: the widget | ||
1776 | + * @detail: a style detail | ||
1777 | * @x: x origin of the rectangle to draw the diamond in | ||
1778 | * @y: y origin of the rectangle to draw the diamond in | ||
1779 | * @width: width of the rectangle to draw the diamond in | ||
1780 | @@ -5789,7 +6059,6 @@ | ||
1781 | { | ||
1782 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1783 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL); | ||
1784 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1785 | |||
1786 | GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
1787 | } | ||
1788 | @@ -5799,10 +6068,9 @@ | ||
1789 | * @style: a #GtkStyle | ||
1790 | * @window: a #GdkWindow | ||
1791 | * @state_type: a state | ||
1792 | - * @area: clip rectangle, or %NULL if the | ||
1793 | - * output should not be clipped | ||
1794 | - * @widget: the widget (may be %NULL) | ||
1795 | - * @detail: a style detail (may be %NULL) | ||
1796 | + * @area: clip rectangle | ||
1797 | + * @widget: the widget | ||
1798 | + * @detail: a style detail | ||
1799 | * @x: x origin | ||
1800 | * @y: y origin | ||
1801 | * @string: the string to draw | ||
1802 | @@ -5824,7 +6092,6 @@ | ||
1803 | { | ||
1804 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1805 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL); | ||
1806 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1807 | |||
1808 | GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string); | ||
1809 | } | ||
1810 | @@ -5835,10 +6102,9 @@ | ||
1811 | * @window: a #GdkWindow | ||
1812 | * @state_type: a state | ||
1813 | * @shadow_type: the type of shadow to draw | ||
1814 | - * @area: clip rectangle, or %NULL if the | ||
1815 | - * output should not be clipped | ||
1816 | - * @widget: the widget (may be %NULL) | ||
1817 | - * @detail: a style detail (may be %NULL) | ||
1818 | + * @area: clip rectangle | ||
1819 | + * @widget: the widget | ||
1820 | + * @detail: a style detail | ||
1821 | * @x: x origin of the box | ||
1822 | * @y: y origin of the box | ||
1823 | * @width: the width of the box | ||
1824 | @@ -5861,7 +6127,6 @@ | ||
1825 | { | ||
1826 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1827 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL); | ||
1828 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1829 | |||
1830 | GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
1831 | } | ||
1832 | @@ -5872,10 +6137,9 @@ | ||
1833 | * @window: a #GdkWindow | ||
1834 | * @state_type: a state | ||
1835 | * @shadow_type: the type of shadow to draw | ||
1836 | - * @area: clip rectangle, or %NULL if the | ||
1837 | - * output should not be clipped | ||
1838 | - * @widget: the widget (may be %NULL) | ||
1839 | - * @detail: a style detail (may be %NULL) | ||
1840 | + * @area: clip rectangle | ||
1841 | + * @widget: the widget | ||
1842 | + * @detail: a style detail | ||
1843 | * @x: x origin of the box | ||
1844 | * @y: y origin of the box | ||
1845 | * @width: the width of the box | ||
1846 | @@ -5898,7 +6162,6 @@ | ||
1847 | { | ||
1848 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1849 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL); | ||
1850 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1851 | |||
1852 | GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
1853 | } | ||
1854 | @@ -5909,10 +6172,9 @@ | ||
1855 | * @window: a #GdkWindow | ||
1856 | * @state_type: a state | ||
1857 | * @shadow_type: the type of shadow to draw | ||
1858 | - * @area: clip rectangle, or %NULL if the | ||
1859 | - * output should not be clipped | ||
1860 | - * @widget: the widget (may be %NULL) | ||
1861 | - * @detail: a style detail (may be %NULL) | ||
1862 | + * @area: clip rectangle | ||
1863 | + * @widget: the widget | ||
1864 | + * @detail: a style detail | ||
1865 | * @x: x origin of the rectangle to draw the check in | ||
1866 | * @y: y origin of the rectangle to draw the check in | ||
1867 | * @width: the width of the rectangle to draw the check in | ||
1868 | @@ -5936,7 +6198,6 @@ | ||
1869 | { | ||
1870 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1871 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL); | ||
1872 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1873 | |||
1874 | GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
1875 | } | ||
1876 | @@ -5947,10 +6208,9 @@ | ||
1877 | * @window: a #GdkWindow | ||
1878 | * @state_type: a state | ||
1879 | * @shadow_type: the type of shadow to draw | ||
1880 | - * @area: clip rectangle, or %NULL if the | ||
1881 | - * output should not be clipped | ||
1882 | - * @widget: the widget (may be %NULL) | ||
1883 | - * @detail: a style detail (may be %NULL) | ||
1884 | + * @area: clip rectangle | ||
1885 | + * @widget: the widget | ||
1886 | + * @detail: a style detail | ||
1887 | * @x: x origin of the rectangle to draw the option in | ||
1888 | * @y: y origin of the rectangle to draw the option in | ||
1889 | * @width: the width of the rectangle to draw the option in | ||
1890 | @@ -5974,7 +6234,6 @@ | ||
1891 | { | ||
1892 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1893 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL); | ||
1894 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1895 | |||
1896 | GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
1897 | } | ||
1898 | @@ -5985,10 +6244,9 @@ | ||
1899 | * @window: a #GdkWindow | ||
1900 | * @state_type: a state | ||
1901 | * @shadow_type: the type of shadow to draw | ||
1902 | - * @area: clip rectangle, or %NULL if the | ||
1903 | - * output should not be clipped | ||
1904 | - * @widget: the widget (may be %NULL) | ||
1905 | - * @detail: a style detail (may be %NULL) | ||
1906 | + * @area: clip rectangle | ||
1907 | + * @widget: the widget | ||
1908 | + * @detail: a style detail | ||
1909 | * @x: x origin of the rectangle to draw the tab in | ||
1910 | * @y: y origin of the rectangle to draw the tab in | ||
1911 | * @width: the width of the rectangle to draw the tab in | ||
1912 | @@ -6012,7 +6270,6 @@ | ||
1913 | { | ||
1914 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1915 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL); | ||
1916 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1917 | |||
1918 | GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); | ||
1919 | } | ||
1920 | @@ -6023,10 +6280,9 @@ | ||
1921 | * @window: a #GdkWindow | ||
1922 | * @state_type: a state | ||
1923 | * @shadow_type: type of shadow to draw | ||
1924 | - * @area: clip rectangle, or %NULL if the | ||
1925 | - * output should not be clipped | ||
1926 | - * @widget: the widget (may be %NULL) | ||
1927 | - * @detail: a style detail (may be %NULL) | ||
1928 | + * @area: clip rectangle | ||
1929 | + * @widget: the widget | ||
1930 | + * @detail: a style detail | ||
1931 | * @x: x origin of the rectangle | ||
1932 | * @y: y origin of the rectangle | ||
1933 | * @width: width of the rectangle | ||
1934 | @@ -6057,7 +6313,6 @@ | ||
1935 | { | ||
1936 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1937 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL); | ||
1938 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1939 | |||
1940 | GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); | ||
1941 | } | ||
1942 | @@ -6069,10 +6324,9 @@ | ||
1943 | * @window: a #GdkWindow | ||
1944 | * @state_type: a state | ||
1945 | * @shadow_type: type of shadow to draw | ||
1946 | - * @area: clip rectangle, or %NULL if the | ||
1947 | - * output should not be clipped | ||
1948 | - * @widget: the widget (may be %NULL) | ||
1949 | - * @detail: a style detail (may be %NULL) | ||
1950 | + * @area: clip rectangle | ||
1951 | + * @widget: the widget | ||
1952 | + * @detail: a style detail | ||
1953 | * @x: x origin of the rectangle | ||
1954 | * @y: y origin of the rectangle | ||
1955 | * @width: width of the rectangle | ||
1956 | @@ -6102,7 +6356,6 @@ | ||
1957 | { | ||
1958 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1959 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL); | ||
1960 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1961 | |||
1962 | GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); | ||
1963 | } | ||
1964 | @@ -6113,10 +6366,9 @@ | ||
1965 | * @window: a #GdkWindow | ||
1966 | * @state_type: a state | ||
1967 | * @shadow_type: type of shadow to draw | ||
1968 | - * @area: clip rectangle, or %NULL if the | ||
1969 | - * output should not be clipped | ||
1970 | - * @widget: the widget (may be %NULL) | ||
1971 | - * @detail: a style detail (may be %NULL) | ||
1972 | + * @area: clip rectangle | ||
1973 | + * @widget: the widget | ||
1974 | + * @detail: a style detail | ||
1975 | * @x: x origin of the extension | ||
1976 | * @y: y origin of the extension | ||
1977 | * @width: width of the extension | ||
1978 | @@ -6141,7 +6393,6 @@ | ||
1979 | { | ||
1980 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
1981 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL); | ||
1982 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
1983 | |||
1984 | GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side); | ||
1985 | } | ||
1986 | @@ -6151,10 +6402,9 @@ | ||
1987 | * @style: a #GtkStyle | ||
1988 | * @window: a #GdkWindow | ||
1989 | * @state_type: a state | ||
1990 | - * @area: clip rectangle, or %NULL if the | ||
1991 | - * output should not be clipped | ||
1992 | - * @widget: the widget (may be %NULL) | ||
1993 | - * @detail: a style detail (may be %NULL) | ||
1994 | + * @area: clip rectangle | ||
1995 | + * @widget: the widget | ||
1996 | + * @detail: a style detail | ||
1997 | * @x: the x origin of the rectangle around which to draw a focus indicator | ||
1998 | * @y: the y origin of the rectangle around which to draw a focus indicator | ||
1999 | * @width: the width of the rectangle around which to draw a focus indicator | ||
2000 | @@ -6177,30 +6427,10 @@ | ||
2001 | { | ||
2002 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
2003 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL); | ||
2004 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
2005 | |||
2006 | GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, state_type, area, widget, detail, x, y, width, height); | ||
2007 | } | ||
2008 | |||
2009 | -/** | ||
2010 | - * gtk_paint_slider: | ||
2011 | - * @style: a #GtkStyle | ||
2012 | - * @window: a #GdkWindow | ||
2013 | - * @state_type: a state | ||
2014 | - * @shadow_type: a shadow | ||
2015 | - * @area: clip rectangle, or %NULL if the | ||
2016 | - * output should not be clipped | ||
2017 | - * @widget: the widget (may be %NULL) | ||
2018 | - * @detail: a style detail (may be %NULL) | ||
2019 | - * @x: the x origin of the rectangle in which to draw a slider | ||
2020 | - * @y: the y origin of the rectangle in which to draw a slider | ||
2021 | - * @width: the width of the rectangle in which to draw a slider | ||
2022 | - * @height: the height of the rectangle in which to draw a slider | ||
2023 | - * @orientation: the orientation to be used | ||
2024 | - * | ||
2025 | - * Draws a slider in the given rectangle on @window using the | ||
2026 | - * given style and orientation. | ||
2027 | - **/ | ||
2028 | void | ||
2029 | gtk_paint_slider (GtkStyle *style, | ||
2030 | GdkWindow *window, | ||
2031 | @@ -6217,7 +6447,6 @@ | ||
2032 | { | ||
2033 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
2034 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL); | ||
2035 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
2036 | |||
2037 | GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); | ||
2038 | } | ||
2039 | @@ -6228,10 +6457,9 @@ | ||
2040 | * @window: a #GdkWindow | ||
2041 | * @state_type: a state | ||
2042 | * @shadow_type: type of shadow to draw | ||
2043 | - * @area: clip rectangle, or %NULL if the | ||
2044 | - * output should not be clipped | ||
2045 | - * @widget: the widget (may be %NULL) | ||
2046 | - * @detail: a style detail (may be %NULL) | ||
2047 | + * @area: clip rectangle | ||
2048 | + * @widget: the widget | ||
2049 | + * @detail: a style detail | ||
2050 | * @x: x origin of the handle | ||
2051 | * @y: y origin of the handle | ||
2052 | * @width: with of the handle | ||
2053 | @@ -6256,7 +6484,6 @@ | ||
2054 | { | ||
2055 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
2056 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL); | ||
2057 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
2058 | |||
2059 | GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); | ||
2060 | } | ||
2061 | @@ -6266,25 +6493,14 @@ | ||
2062 | * @style: a #GtkStyle | ||
2063 | * @window: a #GdkWindow | ||
2064 | * @state_type: a state | ||
2065 | - * @area: clip rectangle, or %NULL if the | ||
2066 | - * output should not be clipped | ||
2067 | - * @widget: the widget (may be %NULL) | ||
2068 | - * @detail: a style detail (may be %NULL) | ||
2069 | + * @area: clip rectangle | ||
2070 | + * @widget: the widget | ||
2071 | + * @detail: a style detail | ||
2072 | * @x: the x position to draw the expander at | ||
2073 | * @y: the y position to draw the expander at | ||
2074 | - * @expander_style: the style to draw the expander in; determines | ||
2075 | - * whether the expander is collapsed, expanded, or in an | ||
2076 | - * intermediate state. | ||
2077 | + * @expander_style: the style to draw the expander in | ||
2078 | * | ||
2079 | - * Draws an expander as used in #GtkTreeView. @x and @y specify the | ||
2080 | - * center the expander. The size of the expander is determined by the | ||
2081 | - * "expander-size" style property of @widget. (If widget is not | ||
2082 | - * specified or doesn't have an "expander-size" property, an | ||
2083 | - * unspecified default size will be used, since the caller doesn't | ||
2084 | - * have sufficient information to position the expander, this is | ||
2085 | - * likely not useful.) The expander is expander_size pixels tall | ||
2086 | - * in the collapsed position and expander_size pixels wide in the | ||
2087 | - * expanded position. | ||
2088 | + * Draws an expander as used in #GtkTreeView. | ||
2089 | **/ | ||
2090 | void | ||
2091 | gtk_paint_expander (GtkStyle *style, | ||
2092 | @@ -6299,34 +6515,16 @@ | ||
2093 | { | ||
2094 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
2095 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_expander != NULL); | ||
2096 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
2097 | |||
2098 | GTK_STYLE_GET_CLASS (style)->draw_expander (style, window, state_type, area, | ||
2099 | widget, detail, x, y, expander_style); | ||
2100 | } | ||
2101 | |||
2102 | -/** | ||
2103 | - * gtk_paint_layout: | ||
2104 | - * @style: a #GtkStyle | ||
2105 | - * @window: a #GdkWindow | ||
2106 | - * @state_type: a state | ||
2107 | - * @use_text: whether to use the text or foreground | ||
2108 | - * graphics context of @style | ||
2109 | - * @area: clip rectangle, or %NULL if the | ||
2110 | - * output should not be clipped | ||
2111 | - * @widget: the widget (may be %NULL) | ||
2112 | - * @detail: a style detail (may be %NULL) | ||
2113 | - * @x: x origin | ||
2114 | - * @y: y origin | ||
2115 | - * @layout: the layout to draw | ||
2116 | - * | ||
2117 | - * Draws a layout on @window using the given parameters. | ||
2118 | - **/ | ||
2119 | void | ||
2120 | gtk_paint_layout (GtkStyle *style, | ||
2121 | GdkWindow *window, | ||
2122 | GtkStateType state_type, | ||
2123 | - gboolean use_text, | ||
2124 | + gboolean use_text, | ||
2125 | GdkRectangle *area, | ||
2126 | GtkWidget *widget, | ||
2127 | const gchar *detail, | ||
2128 | @@ -6336,7 +6534,6 @@ | ||
2129 | { | ||
2130 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
2131 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_layout != NULL); | ||
2132 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
2133 | |||
2134 | GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type, use_text, area, | ||
2135 | widget, detail, x, y, layout); | ||
2136 | @@ -6347,10 +6544,9 @@ | ||
2137 | * @style: a #GtkStyle | ||
2138 | * @window: a #GdkWindow | ||
2139 | * @state_type: a state | ||
2140 | - * @area: clip rectangle, or %NULL if the | ||
2141 | - * output should not be clipped | ||
2142 | - * @widget: the widget (may be %NULL) | ||
2143 | - * @detail: a style detail (may be %NULL) | ||
2144 | + * @area: clip rectangle | ||
2145 | + * @widget: the widget | ||
2146 | + * @detail: a style detail | ||
2147 | * @edge: the edge in which to draw the resize grip | ||
2148 | * @x: the x origin of the rectangle in which to draw the resize grip | ||
2149 | * @y: the y origin of the rectangle in which to draw the resize grip | ||
2150 | @@ -6376,7 +6572,6 @@ | ||
2151 | { | ||
2152 | g_return_if_fail (GTK_IS_STYLE (style)); | ||
2153 | g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_resize_grip != NULL); | ||
2154 | - g_return_if_fail (style->depth == gdk_drawable_get_depth (window)); | ||
2155 | |||
2156 | GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, window, state_type, | ||
2157 | area, widget, detail, | ||
2158 | @@ -6414,7 +6609,7 @@ | ||
2159 | static GType our_type = 0; | ||
2160 | |||
2161 | if (our_type == 0) | ||
2162 | - our_type = g_boxed_type_register_static (I_("GtkBorder"), | ||
2163 | + our_type = g_boxed_type_register_static ("GtkBorder", | ||
2164 | (GBoxedCopyFunc) gtk_border_copy, | ||
2165 | (GBoxedFreeFunc) gtk_border_free); | ||
2166 | |||
2167 | @@ -6553,7 +6748,7 @@ | ||
2168 | gtk_gc_release (cursor_info->secondary_gc); | ||
2169 | |||
2170 | g_free (cursor_info); | ||
2171 | - g_object_set_data (G_OBJECT (style), I_("gtk-style-cursor-info"), NULL); | ||
2172 | + g_object_set_data (G_OBJECT (style), "gtk-style-cursor-info", NULL); | ||
2173 | } | ||
2174 | } | ||
2175 | |||
2176 | @@ -6591,7 +6786,7 @@ | ||
2177 | if (!cursor_info) | ||
2178 | { | ||
2179 | cursor_info = g_new (CursorInfo, 1); | ||
2180 | - g_object_set_data (G_OBJECT (widget->style), I_("gtk-style-cursor-info"), cursor_info); | ||
2181 | + g_object_set_data (G_OBJECT (widget->style), "gtk-style-cursor-info", cursor_info); | ||
2182 | cursor_info->primary_gc = NULL; | ||
2183 | cursor_info->secondary_gc = NULL; | ||
2184 | cursor_info->for_type = G_TYPE_INVALID; | ||
2185 | @@ -6655,6 +6850,8 @@ | ||
2186 | gfloat cursor_aspect_ratio; | ||
2187 | gint offset; | ||
2188 | |||
2189 | + g_return_if_fail (direction != GTK_TEXT_DIR_NONE); | ||
2190 | + | ||
2191 | /* When changing the shape or size of the cursor here, | ||
2192 | * propagate the changes to gtktextview.c:text_window_invalidate_cursors(). | ||
2193 | */ | ||