1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
25 #include <gtk/gtkthemingengine.h>
26 #include <gtk/gtkstylecontext.h>
27 #include <gtk/gtkintl.h>
31 typedef struct GtkThemingEnginePrivate GtkThemingEnginePrivate;
40 struct GtkThemingEnginePrivate
42 GtkStyleContext *context;
45 #define GTK_THEMING_ENGINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_THEMING_ENGINE, GtkThemingEnginePrivate))
47 static void gtk_theming_engine_render_check (GtkThemingEngine *engine,
53 static void gtk_theming_engine_render_option (GtkThemingEngine *engine,
59 static void gtk_theming_engine_render_arrow (GtkThemingEngine *engine,
65 static void gtk_theming_engine_render_background (GtkThemingEngine *engine,
71 static void gtk_theming_engine_render_frame (GtkThemingEngine *engine,
77 static void gtk_theming_engine_render_expander (GtkThemingEngine *engine,
83 static void gtk_theming_engine_render_focus (GtkThemingEngine *engine,
89 static void gtk_theming_engine_render_layout (GtkThemingEngine *engine,
94 static void gtk_theming_engine_render_line (GtkThemingEngine *engine,
100 static void gtk_theming_engine_render_slider (GtkThemingEngine *engine,
106 GtkOrientation orientation);
107 static void gtk_theming_engine_render_frame_gap (GtkThemingEngine *engine,
113 GtkPositionType gap_side,
116 static void gtk_theming_engine_render_extension (GtkThemingEngine *engine,
122 GtkPositionType gap_side);
123 static void gtk_theming_engine_render_handle (GtkThemingEngine *engine,
129 GtkOrientation orientation);
131 G_DEFINE_TYPE (GtkThemingEngine, gtk_theming_engine, G_TYPE_OBJECT)
134 typedef struct GtkThemingModule GtkThemingModule;
135 typedef struct GtkThemingModuleClass GtkThemingModuleClass;
137 struct GtkThemingModule
139 GTypeModule parent_instance;
142 GtkThemingEngine * (*create_engine) (void);
145 struct GtkThemingModuleClass
147 GTypeModuleClass parent_class;
150 #define GTK_TYPE_THEMING_MODULE (gtk_theming_module_get_type ())
151 #define GTK_THEMING_MODULE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_THEMING_MODULE, GtkThemingModule))
152 #define GTK_IS_THEMING_MODULE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_THEMING_MODULE))
154 G_DEFINE_TYPE (GtkThemingModule, gtk_theming_module, G_TYPE_TYPE_MODULE);
157 gtk_theming_engine_class_init (GtkThemingEngineClass *klass)
159 GObjectClass *object_class = G_OBJECT_CLASS (klass);
161 klass->render_check = gtk_theming_engine_render_check;
162 klass->render_option = gtk_theming_engine_render_option;
163 klass->render_arrow = gtk_theming_engine_render_arrow;
164 klass->render_background = gtk_theming_engine_render_background;
165 klass->render_frame = gtk_theming_engine_render_frame;
166 klass->render_expander = gtk_theming_engine_render_expander;
167 klass->render_focus = gtk_theming_engine_render_focus;
168 klass->render_layout = gtk_theming_engine_render_layout;
169 klass->render_line = gtk_theming_engine_render_line;
170 klass->render_slider = gtk_theming_engine_render_slider;
171 klass->render_frame_gap = gtk_theming_engine_render_frame_gap;
172 klass->render_extension = gtk_theming_engine_render_extension;
173 klass->render_handle = gtk_theming_engine_render_handle;
175 g_type_class_add_private (object_class, sizeof (GtkThemingEnginePrivate));
179 gtk_theming_engine_init (GtkThemingEngine *engine)
181 engine->priv = GTK_THEMING_ENGINE_GET_PRIVATE (engine);
185 _gtk_theming_engine_set_context (GtkThemingEngine *engine,
186 GtkStyleContext *context)
188 GtkThemingEnginePrivate *priv;
190 g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
191 g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
194 priv->context = context;
198 gtk_theming_engine_get_property (GtkThemingEngine *engine,
199 const gchar *property,
203 GtkThemingEnginePrivate *priv;
205 g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
206 g_return_if_fail (property != NULL);
207 g_return_if_fail (state < GTK_STATE_LAST);
208 g_return_if_fail (value != NULL);
211 gtk_style_context_get_property (priv->context, property, state, value);
215 gtk_theming_engine_get_valist (GtkThemingEngine *engine,
219 GtkThemingEnginePrivate *priv;
221 g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
222 g_return_if_fail (state < GTK_STATE_LAST);
225 gtk_style_context_get_valist (priv->context, state, args);
229 gtk_theming_engine_get (GtkThemingEngine *engine,
233 GtkThemingEnginePrivate *priv;
236 g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
237 g_return_if_fail (state < GTK_STATE_LAST);
241 va_start (args, state);
242 gtk_style_context_get_valist (priv->context, state, args);
247 gtk_theming_engine_get_style_property (GtkThemingEngine *engine,
248 const gchar *property_name,
251 GtkThemingEnginePrivate *priv;
253 g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
254 g_return_if_fail (property_name != NULL);
257 gtk_style_context_get_style_property (priv->context, property_name, value);
261 gtk_theming_engine_get_style_valist (GtkThemingEngine *engine,
264 GtkThemingEnginePrivate *priv;
266 g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
269 gtk_style_context_get_style_valist (priv->context, args);
273 gtk_theming_engine_get_style (GtkThemingEngine *engine,
276 GtkThemingEnginePrivate *priv;
279 g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
283 va_start (args, engine);
284 gtk_style_context_get_style_valist (priv->context, args);
289 gtk_theming_engine_get_state (GtkThemingEngine *engine)
291 GtkThemingEnginePrivate *priv;
293 g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), 0);
296 return gtk_style_context_get_state (priv->context);
300 gtk_theming_engine_is_state_set (GtkThemingEngine *engine,
303 GtkThemingEnginePrivate *priv;
305 g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), 0);
308 return gtk_style_context_is_state_set (priv->context, state);
311 G_CONST_RETURN GtkWidgetPath *
312 gtk_theming_engine_get_path (GtkThemingEngine *engine)
314 GtkThemingEnginePrivate *priv;
316 g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), NULL);
319 return gtk_style_context_get_path (priv->context);
323 gtk_theming_engine_has_class (GtkThemingEngine *engine,
324 const gchar *style_class)
326 GtkThemingEnginePrivate *priv;
328 g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), FALSE);
331 return gtk_style_context_has_class (priv->context, style_class);
335 gtk_theming_engine_has_child_class (GtkThemingEngine *engine,
336 const gchar *style_class,
337 GtkChildClassFlags *flags)
339 GtkThemingEnginePrivate *priv;
344 g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), FALSE);
347 return gtk_style_context_has_child_class (priv->context, style_class, flags);
351 gtk_theming_engine_get_direction (GtkThemingEngine *engine)
353 GtkThemingEnginePrivate *priv;
355 g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), GTK_TEXT_DIR_LTR);
358 return gtk_style_context_get_direction (priv->context);
361 /* GtkThemingModule */
364 gtk_theming_module_load (GTypeModule *type_module)
366 GtkThemingModule *theming_module;
368 gchar *name, *module_path;
370 theming_module = GTK_THEMING_MODULE (type_module);
371 name = theming_module->name;
372 module_path = _gtk_find_module (name, "theming-engines");
376 g_warning (_("Unable to locate theme engine in module path: \"%s\","), name);
380 module = g_module_open (module_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
381 g_free (module_path);
385 g_warning ("%s", g_module_error ());
389 if (!g_module_symbol (module, "create_engine",
390 (gpointer *) &theming_module->create_engine))
392 g_warning ("%s", g_module_error());
393 g_module_close (module);
398 g_module_make_resident (module);
404 gtk_theming_module_class_init (GtkThemingModuleClass *klass)
406 GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (klass);
408 module_class->load = gtk_theming_module_load;
412 gtk_theming_module_init (GtkThemingModule *module)
416 G_CONST_RETURN GtkThemingEngine *
417 gtk_theming_engine_load (const gchar *name)
419 static GHashTable *engines = NULL;
420 static GtkThemingEngine *default_engine;
421 GtkThemingEngine *engine = NULL;
426 engines = g_hash_table_new (g_str_hash, g_str_equal);
428 engine = g_hash_table_lookup (engines, name);
432 GtkThemingModule *module;
434 module = g_object_new (GTK_TYPE_THEMING_MODULE, NULL);
435 g_type_module_set_name (G_TYPE_MODULE (module), name);
436 module->name = g_strdup (name);
438 if (module && g_type_module_use (G_TYPE_MODULE (module)))
440 engine = (module->create_engine) ();
443 g_hash_table_insert (engines, module->name, engine);
450 if (G_UNLIKELY (!default_engine))
451 default_engine = g_object_new (GTK_TYPE_THEMING_ENGINE, NULL);
453 engine = default_engine;
460 gtk_theming_engine_get_screen (GtkThemingEngine *engine)
462 GtkThemingEnginePrivate *priv;
464 g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), NULL);
467 return gtk_style_context_get_screen (priv->context);
470 /* Paint method implementations */
472 gtk_theming_engine_render_check (GtkThemingEngine *engine,
479 GdkColor *fg_color, *base_color, *text_color;
480 const GtkWidgetPath *path;
483 gint exterior_size, interior_size, thickness, pad;
485 flags = gtk_theming_engine_get_state (engine);
486 path = gtk_theming_engine_get_path (engine);
489 if (flags & GTK_STATE_FLAG_PRELIGHT)
490 state = GTK_STATE_PRELIGHT;
492 state = GTK_STATE_NORMAL;
494 gtk_theming_engine_get (engine, state,
495 "foreground-color", &fg_color,
496 "base-color", &base_color,
497 "text-color", &text_color,
500 exterior_size = MIN (width, height);
502 if (exterior_size % 2 == 0) /* Ensure odd */
505 /* FIXME: thickness */
507 pad = thickness + MAX (1, (exterior_size - 2 * thickness) / 9);
508 interior_size = MAX (1, exterior_size - 2 * pad);
510 if (interior_size < 7)
513 pad = MAX (0, (exterior_size - interior_size) / 2);
516 x -= (1 + exterior_size - (gint) width) / 2;
517 y -= (1 + exterior_size - (gint) height) / 2;
519 if (!gtk_theming_engine_has_class (engine, "menu"))
521 cairo_set_line_width (cr, 1.0);
523 cairo_rectangle (cr, x + 0.5, y + 0.5, exterior_size - 1, exterior_size - 1);
524 gdk_cairo_set_source_color (cr, base_color);
525 cairo_fill_preserve (cr);
527 if (gtk_theming_engine_has_class (engine, "cell"))
528 gdk_cairo_set_source_color (cr, text_color);
530 gdk_cairo_set_source_color (cr, fg_color);
535 if (gtk_theming_engine_has_class (engine, "menu"))
536 gdk_cairo_set_source_color (cr, fg_color);
538 gdk_cairo_set_source_color (cr, text_color);
540 if (gtk_theming_engine_is_state_set (engine, GTK_STATE_INCONSISTENT))
542 int line_thickness = MAX (1, (3 + interior_size * 2) / 7);
546 y + pad + (1 + interior_size - line_thickness) / 2,
551 else if (gtk_theming_engine_is_state_set (engine, GTK_STATE_ACTIVE))
556 cairo_scale (cr, interior_size / 7., interior_size / 7.);
558 cairo_move_to (cr, 7.0, 0.0);
559 cairo_line_to (cr, 7.5, 1.0);
560 cairo_curve_to (cr, 5.3, 2.0,
563 cairo_curve_to (cr, 3.0, 5.7,
566 cairo_line_to (cr, 0.2, 3.5);
567 cairo_curve_to (cr, 1.1, 3.5,
570 cairo_curve_to (cr, 1.0, 3.9,
573 cairo_curve_to (cr, 3.5, 3.1,
582 gdk_color_free (fg_color);
583 gdk_color_free (base_color);
584 gdk_color_free (text_color);
588 gtk_theming_engine_render_option (GtkThemingEngine *engine,
596 GdkColor *base_color, *fg_color, *text_color;
597 const GtkWidgetPath *path;
599 gint exterior_size, interior_size, pad, thickness;
602 /* FIXME: set clipping */
604 flags = gtk_theming_engine_get_state (engine);
605 path = gtk_theming_engine_get_path (engine);
606 radius = MIN (width, height) / 2 - 0.5;
610 if (flags & GTK_STATE_FLAG_PRELIGHT)
611 state = GTK_STATE_PRELIGHT;
613 state = GTK_STATE_NORMAL;
615 gtk_theming_engine_get (engine, state,
616 "foreground-color", &fg_color,
617 "base-color", &base_color,
618 "text-color", &text_color,
621 exterior_size = MIN (width, height);
623 if (exterior_size % 2 == 0) /* Ensure odd */
626 x -= (1 + exterior_size - width) / 2;
627 y -= (1 + exterior_size - height) / 2;
629 if (!gtk_theming_engine_has_class (engine, "menu"))
631 gdk_cairo_set_source_color (cr, base_color);
634 x + exterior_size / 2.,
635 y + exterior_size / 2.,
636 (exterior_size - 1) / 2.,
639 cairo_fill_preserve (cr);
641 if (gtk_theming_engine_has_class (engine, "cell"))
642 gdk_cairo_set_source_color (cr, text_color);
644 gdk_cairo_set_source_color (cr, fg_color);
646 cairo_set_line_width (cr, 1.);
650 if (gtk_theming_engine_has_class (engine, "menu"))
651 gdk_cairo_set_source_color (cr, fg_color);
653 gdk_cairo_set_source_color (cr, text_color);
655 /* FIXME: thickness */
658 if (gtk_theming_engine_is_state_set (engine, GTK_STATE_INCONSISTENT))
662 pad = thickness + MAX (1, (exterior_size - 2 * thickness) / 9);
663 interior_size = MAX (1, exterior_size - 2 * pad);
665 if (interior_size < 7)
668 pad = MAX (0, (exterior_size - interior_size) / 2);
671 line_thickness = MAX (1, (3 + interior_size * 2) / 7);
675 y + pad + (interior_size - line_thickness) / 2.,
680 if (gtk_theming_engine_is_state_set (engine, GTK_STATE_ACTIVE))
682 pad = thickness + MAX (1, 2 * (exterior_size - 2 * thickness) / 9);
683 interior_size = MAX (1, exterior_size - 2 * pad);
685 if (interior_size < 5)
688 pad = MAX (0, (exterior_size - interior_size) / 2);
692 x + pad + interior_size / 2.,
693 y + pad + interior_size / 2.,
703 add_path_arrow (cairo_t *cr,
711 cairo_translate (cr, x + (size / 2), y + (size / 2));
712 cairo_rotate (cr, angle);
714 cairo_move_to (cr, 0, - (size / 4));
715 cairo_line_to (cr, - (size / 2), (size / 4));
716 cairo_line_to (cr, (size / 2), (size / 4));
717 cairo_close_path (cr);
723 gtk_theming_engine_render_arrow (GtkThemingEngine *engine,
736 flags = gtk_theming_engine_get_state (engine);
738 if (flags & GTK_STATE_FLAG_PRELIGHT)
739 state = GTK_STATE_PRELIGHT;
740 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
741 state = GTK_STATE_INSENSITIVE;
743 state = GTK_STATE_NORMAL;
745 gtk_theming_engine_get (engine, state,
746 "foreground-color", &fg_color,
749 if (flags & GTK_STATE_FLAG_INSENSITIVE)
751 add_path_arrow (cr, angle, x + 1, y + 1, size);
752 cairo_set_source_rgb (cr, 1, 1, 1);
756 add_path_arrow (cr, angle, x, y, size);
757 gdk_cairo_set_source_color (cr, fg_color);
762 gdk_color_free (fg_color);
766 add_path_line (cairo_t *cr,
772 /* Adjust endpoints */
786 cairo_move_to (cr, x1, y1);
787 cairo_line_to (cr, x2, y2);
791 add_path_rectangle_sides (cairo_t *cr,
798 if (sides & SIDE_TOP)
800 cairo_move_to (cr, x, y + 0.5);
801 cairo_line_to (cr, x + width, y + 0.5);
804 if (sides & SIDE_RIGHT)
806 cairo_move_to (cr, x + width - 0.5, y);
807 cairo_line_to (cr, x + width - 0.5, y + height);
810 if (sides & SIDE_BOTTOM)
812 cairo_move_to (cr, x, y + height - 0.5);
813 cairo_line_to (cr, x + width, y + height - 0.5);
816 if (sides & SIDE_LEFT)
818 cairo_move_to (cr, x + 0.5, y + height);
819 cairo_line_to (cr, x + 0.5, y);
824 add_path_gap_side (cairo_t *cr,
825 GtkPositionType gap_side,
836 add_path_line (cr, x, y, x + xy0_gap, y);
837 add_path_line (cr, x + xy1_gap, y, x + width, y);
840 add_path_line (cr, x, y + height, x + xy0_gap, y + height);
841 add_path_line (cr, x + xy1_gap, y + height, x + width, y + height);
844 add_path_line (cr, x, y, x, y + xy0_gap);
845 add_path_line (cr, x, y + xy1_gap, x, y + height);
848 add_path_line (cr, x + width, y, x + width, y + xy0_gap);
849 add_path_line (cr, x + width, y + xy1_gap, x + width, y + height);
855 color_shade (const GdkColor *color,
857 GdkColor *color_return)
859 color_return->red = CLAMP (color->red * factor, 0, 65535);
860 color_return->green = CLAMP (color->green * factor, 0, 65535);
861 color_return->blue = CLAMP (color->blue * factor, 0, 65535);
865 gtk_theming_engine_render_background (GtkThemingEngine *engine,
877 flags = gtk_theming_engine_get_state (engine);
879 if (flags & GTK_STATE_FLAG_ACTIVE)
880 state = GTK_STATE_ACTIVE;
881 else if (flags & GTK_STATE_FLAG_SELECTED)
882 state = GTK_STATE_SELECTED;
883 else if (flags & GTK_STATE_FLAG_PRELIGHT)
884 state = GTK_STATE_PRELIGHT;
885 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
886 state = GTK_STATE_INSENSITIVE;
888 state = GTK_STATE_NORMAL;
890 if (gtk_theming_engine_has_class (engine, "entry"))
891 gtk_theming_engine_get (engine, state,
892 "base-color", &color,
895 gtk_theming_engine_get (engine, state,
896 "background-color", &color,
899 gdk_cairo_set_source_color (cr, color);
901 if (gtk_theming_engine_has_class (engine, "spinbutton") &&
902 gtk_theming_engine_has_class (engine, "button"))
903 cairo_rectangle (cr, x + 2, y + 2, width - 4, height - 4);
905 cairo_rectangle (cr, x, y, width, height);
907 if (gtk_theming_engine_has_class (engine, "tooltip"))
909 cairo_fill_preserve (cr);
911 cairo_set_source_rgb (cr, 0, 0, 0);
919 gdk_color_free (color);
923 gtk_theming_engine_render_frame (GtkThemingEngine *engine,
932 GdkColor lighter, darker;
936 flags = gtk_theming_engine_get_state (engine);
938 if (flags & GTK_STATE_FLAG_PRELIGHT)
939 state = GTK_STATE_PRELIGHT;
940 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
941 state = GTK_STATE_INSENSITIVE;
943 state = GTK_STATE_NORMAL;
945 cairo_set_line_width (cr, 1);
947 gtk_theming_engine_get (engine, state,
948 "background-color", &bg_color,
950 color_shade (bg_color, 0.7, &darker);
951 color_shade (bg_color, 1.3, &lighter);
953 if (gtk_theming_engine_has_class (engine, "entry") ||
954 gtk_theming_engine_has_class (engine, "scrolled-window") ||
955 gtk_theming_engine_has_class (engine, "viewport"))
957 gdk_cairo_set_source_color (cr, bg_color);
958 add_path_rectangle_sides (cr, x + 1, y + 1, width - 2, height - 2,
959 SIDE_BOTTOM | SIDE_RIGHT);
962 cairo_set_source_rgb (cr, 0, 0, 0);
963 add_path_rectangle_sides (cr, x + 1, y + 1, width - 2, height - 2,
964 SIDE_TOP | SIDE_LEFT);
967 cairo_set_source_rgb (cr, 1, 1, 1);
968 add_path_rectangle_sides (cr, x, y, width, height,
969 SIDE_BOTTOM | SIDE_RIGHT);
972 gdk_cairo_set_source_color (cr, &darker);
973 add_path_rectangle_sides (cr, x, y, width, height,
974 SIDE_TOP | SIDE_LEFT);
977 else if (gtk_theming_engine_has_class (engine, "button") &&
978 gtk_theming_engine_has_class (engine, "default"))
980 cairo_set_source_rgb (cr, 0, 0, 0);
981 cairo_rectangle (cr, x + 0.5, x + 0.5, width - 1, height - 1);
984 else if (gtk_theming_engine_has_class (engine, "scrollbar") &&
985 gtk_theming_engine_has_class (engine, "trough"))
987 gdk_cairo_set_source_color (cr, &darker);
988 add_path_rectangle_sides (cr, x, y, width, height,
989 SIDE_TOP | SIDE_LEFT);
992 gdk_cairo_set_source_color (cr, &lighter);
993 add_path_rectangle_sides (cr, x, y, width, height,
994 SIDE_BOTTOM | SIDE_RIGHT);
997 else if (gtk_theming_engine_has_class (engine, "spinbutton"))
999 if (gtk_theming_engine_has_class (engine, "button"))
1001 gdk_cairo_set_source_color (cr, &lighter);
1002 add_path_rectangle_sides (cr, x + 1, y + 2, width - 3, height - 2, SIDE_TOP);
1005 gdk_cairo_set_source_color (cr, &darker);
1006 add_path_rectangle_sides (cr, x + 1, y + 2, width - 3, height - 2, SIDE_BOTTOM);
1011 gdk_cairo_set_source_color (cr, &lighter);
1012 add_path_rectangle_sides (cr, x, y, width, height,
1013 SIDE_BOTTOM | SIDE_RIGHT);
1016 gdk_cairo_set_source_color (cr, &darker);
1017 add_path_rectangle_sides (cr, x, y, width, height, SIDE_TOP);
1020 gdk_cairo_set_source_color (cr, bg_color);
1021 add_path_rectangle_sides (cr, x, y, width - 1, height - 1, SIDE_BOTTOM);
1024 cairo_set_source_rgb (cr, 0, 0, 0);
1025 add_path_rectangle_sides (cr, x, y + 1, width - 1, height - 3,
1026 SIDE_TOP | SIDE_LEFT | SIDE_RIGHT);
1032 if (flags & GTK_STATE_FLAG_ACTIVE)
1034 cairo_set_source_rgb (cr, 0, 0, 0);
1035 add_path_rectangle_sides (cr, x + 1, y + 1, width - 2, height - 2,
1036 SIDE_TOP | SIDE_LEFT);
1039 gdk_cairo_set_source_color (cr, &lighter);
1040 add_path_rectangle_sides (cr, x, y, width, height,
1041 SIDE_BOTTOM | SIDE_RIGHT);
1044 gdk_cairo_set_source_color (cr, &darker);
1045 add_path_rectangle_sides (cr, x, y, width, height,
1046 SIDE_TOP | SIDE_LEFT);
1051 gdk_cairo_set_source_color (cr, &darker);
1052 add_path_rectangle_sides (cr, x, y, width - 1, height - 1,
1053 SIDE_BOTTOM | SIDE_RIGHT);
1056 gdk_cairo_set_source_color (cr, &lighter);
1057 add_path_rectangle_sides (cr, x, y, width, height,
1058 SIDE_TOP | SIDE_LEFT);
1061 cairo_set_source_rgb (cr, 0, 0, 0);
1062 add_path_rectangle_sides (cr, x, y, width, height,
1063 SIDE_BOTTOM | SIDE_RIGHT);
1070 gdk_color_free (bg_color);
1074 gtk_theming_engine_render_expander (GtkThemingEngine *engine,
1081 GtkStateFlags flags;
1082 GdkColor *bg_color, *fg_color, *base_color;
1084 double vertical_overshoot;
1087 double interp; /* interpolation factor for center position */
1088 double x_double_horz, y_double_horz;
1089 double x_double_vert, y_double_vert;
1090 double x_double, y_double;
1095 flags = gtk_theming_engine_get_state (engine);
1097 if (flags & GTK_STATE_FLAG_PRELIGHT)
1098 state = GTK_STATE_PRELIGHT;
1099 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
1100 state = GTK_STATE_INSENSITIVE;
1102 state = GTK_STATE_NORMAL;
1104 gtk_theming_engine_get (engine, state,
1105 "foreground-color", &fg_color,
1106 "background-color", &bg_color,
1107 "base-color", &base_color,
1112 /* FIXME: LTR/RTL */
1113 if (flags & GTK_STATE_FLAG_ACTIVE)
1124 /* Compute distance that the stroke extends beyonds the end
1125 * of the triangle we draw.
1127 vertical_overshoot = line_width / 2.0 * (1. / tan (G_PI / 8));
1129 /* For odd line widths, we end the vertical line of the triangle
1130 * at a half pixel, so we round differently.
1132 if (line_width % 2 == 1)
1133 vertical_overshoot = ceil (0.5 + vertical_overshoot) - 0.5;
1135 vertical_overshoot = ceil (vertical_overshoot);
1137 /* Adjust the size of the triangle we draw so that the entire stroke fits
1139 diameter = (gint) MAX (3, width - 2 * vertical_overshoot);
1141 /* If the line width is odd, we want the diameter to be even,
1142 * and vice versa, so force the sum to be odd. This relationship
1143 * makes the point of the triangle look right.
1145 diameter -= (1 - (diameter + line_width) % 2);
1147 radius = diameter / 2.;
1149 /* Adjust the center so that the stroke is properly aligned with
1150 * the pixel grid. The center adjustment is different for the
1151 * horizontal and vertical orientations. For intermediate positions
1152 * we interpolate between the two.
1154 x_double_vert = floor ((x + width / 2) - (radius + line_width) / 2.) + (radius + line_width) / 2.;
1155 y_double_vert = (y + height / 2) - 0.5;
1157 x_double_horz = (x + width / 2) - 0.5;
1158 y_double_horz = floor ((y + height / 2) - (radius + line_width) / 2.) + (radius + line_width) / 2.;
1160 x_double = x_double_vert * (1 - interp) + x_double_horz * interp;
1161 y_double = y_double_vert * (1 - interp) + y_double_horz * interp;
1163 cairo_translate (cr, x_double, y_double);
1164 cairo_rotate (cr, angle);
1166 cairo_move_to (cr, - radius / 2., - radius);
1167 cairo_line_to (cr, radius / 2., 0);
1168 cairo_line_to (cr, - radius / 2., radius);
1169 cairo_close_path (cr);
1171 cairo_set_line_width (cr, line_width);
1173 if (flags & GTK_STATE_FLAG_PRELIGHT)
1174 gdk_cairo_set_source_color (cr, fg_color);
1176 gdk_cairo_set_source_color (cr, base_color);
1178 cairo_fill_preserve (cr);
1180 gdk_cairo_set_source_color (cr, fg_color);
1185 gdk_color_free (base_color);
1186 gdk_color_free (fg_color);
1187 gdk_color_free (bg_color);
1191 gtk_theming_engine_render_focus (GtkThemingEngine *engine,
1198 GtkStateFlags flags;
1205 flags = gtk_theming_engine_get_state (engine);
1207 if (flags & GTK_STATE_FLAG_PRELIGHT)
1208 state = GTK_STATE_PRELIGHT;
1209 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
1210 state = GTK_STATE_INSENSITIVE;
1212 state = GTK_STATE_NORMAL;
1214 gtk_theming_engine_get (engine, state,
1215 "foreground-color", &color,
1218 gtk_theming_engine_get_style (engine,
1219 "focus-line-width", &line_width,
1220 "focus-line-pattern", (gchar *) &dash_list,
1223 cairo_set_line_width (cr, (gdouble) line_width);
1227 gint n_dashes = strlen ((const gchar *) dash_list);
1228 gdouble *dashes = g_new (gdouble, n_dashes);
1229 gdouble total_length = 0;
1230 gdouble dash_offset;
1233 for (i = 0; i < n_dashes; i++)
1235 dashes[i] = dash_list[i];
1236 total_length += dash_list[i];
1239 /* The dash offset here aligns the pattern to integer pixels
1240 * by starting the dash at the right side of the left border
1241 * Negative dash offsets in cairo don't work
1242 * (https://bugs.freedesktop.org/show_bug.cgi?id=2729)
1244 dash_offset = - line_width / 2.;
1246 while (dash_offset < 0)
1247 dash_offset += total_length;
1249 cairo_set_dash (cr, dashes, n_dashes, dash_offset);
1253 cairo_rectangle (cr,
1254 x + line_width / 2.,
1255 y + line_width / 2.,
1257 height - line_width);
1259 gdk_cairo_set_source_color (cr, color);
1264 gdk_color_free (color);
1269 gtk_theming_engine_render_line (GtkThemingEngine *engine,
1276 GdkColor *bg_color, darker, lighter;
1277 GtkStateFlags flags;
1279 gint i, thickness, thickness_dark, thickness_light, len;
1280 cairo_matrix_t matrix;
1283 /* FIXME: thickness */
1285 thickness_dark = thickness / 2;
1286 thickness_light = thickness - thickness_dark;
1288 flags = gtk_theming_engine_get_state (engine);
1291 if (flags & GTK_STATE_FLAG_PRELIGHT)
1292 state = GTK_STATE_PRELIGHT;
1293 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
1294 state = GTK_STATE_INSENSITIVE;
1296 state = GTK_STATE_NORMAL;
1298 gtk_theming_engine_get (engine, state,
1299 "background-color", &bg_color,
1301 color_shade (bg_color, 0.7, &darker);
1302 color_shade (bg_color, 1.3, &lighter);
1304 cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
1305 cairo_set_line_width (cr, 1);
1307 angle = atan2 (x1 - x0, y1 - y0);
1308 angle = (2 * G_PI) - angle;
1311 cairo_get_matrix (cr, &matrix);
1312 cairo_matrix_translate (&matrix, x0, y0);
1313 cairo_matrix_rotate (&matrix, angle);
1314 cairo_set_matrix (cr, &matrix);
1319 len = (gint) sqrt ((x1 * x1) + (y1 * y1));
1321 y0 = -thickness_dark;
1323 for (i = 0; i < thickness_dark; i++)
1325 gdk_cairo_set_source_color (cr, &lighter);
1326 add_path_line (cr, len - i - 1.5, y0, len - 0.5, y0);
1329 gdk_cairo_set_source_color (cr, &darker);
1330 add_path_line (cr, 0.5, y0, len - i - 1.5, y0);
1336 for (i = 0; i < thickness_light; i++)
1338 gdk_cairo_set_source_color (cr, &darker);
1339 add_path_line (cr, 0.5, y0, thickness_light - i + 0.5, y0);
1342 gdk_cairo_set_source_color (cr, &lighter);
1343 add_path_line (cr, thickness_light - i + 0.5, y0, len - 0.5, y0);
1352 typedef struct _ByteRange ByteRange;
1361 range_new (guint start,
1364 ByteRange *br = g_new (ByteRange, 1);
1373 get_insensitive_layout (PangoLayout *layout)
1375 GSList *embossed_ranges = NULL;
1376 GSList *shaded_ranges = NULL;
1377 PangoLayoutIter *iter;
1378 GSList *tmp_list = NULL;
1379 PangoLayout *new_layout;
1380 PangoAttrList *attrs;
1382 iter = pango_layout_get_iter (layout);
1386 PangoLayoutRun *run;
1387 PangoAttribute *attr;
1388 gboolean need_shade = FALSE;
1391 run = pango_layout_iter_get_run_readonly (iter);
1395 tmp_list = run->item->analysis.extra_attrs;
1397 while (tmp_list != NULL)
1399 attr = tmp_list->data;
1400 switch (attr->klass->type)
1402 case PANGO_ATTR_FOREGROUND:
1403 case PANGO_ATTR_BACKGROUND:
1414 tmp_list = g_slist_next (tmp_list);
1417 br = range_new (run->item->offset, run->item->offset + run->item->length);
1420 shaded_ranges = g_slist_prepend (shaded_ranges, br);
1422 embossed_ranges = g_slist_prepend (embossed_ranges, br);
1425 while (pango_layout_iter_next_run (iter));
1427 pango_layout_iter_free (iter);
1429 new_layout = pango_layout_copy (layout);
1431 attrs = pango_layout_get_attributes (new_layout);
1435 /* Create attr list if there wasn't one */
1436 attrs = pango_attr_list_new ();
1437 pango_layout_set_attributes (new_layout, attrs);
1438 pango_attr_list_unref (attrs);
1441 tmp_list = embossed_ranges;
1442 while (tmp_list != NULL)
1444 PangoAttribute *attr;
1445 ByteRange *br = tmp_list->data;
1447 attr = gdk_pango_attr_embossed_new (TRUE);
1449 attr->start_index = br->start;
1450 attr->end_index = br->end;
1452 pango_attr_list_change (attrs, attr);
1456 tmp_list = g_slist_next (tmp_list);
1459 g_slist_free (embossed_ranges);
1461 tmp_list = shaded_ranges;
1462 while (tmp_list != NULL)
1464 PangoAttribute *attr;
1465 ByteRange *br = tmp_list->data;
1467 attr = gdk_pango_attr_shade_new (0.7);
1469 attr->start_index = br->start;
1470 attr->end_index = br->end;
1472 pango_attr_list_change (attrs, attr);
1476 tmp_list = g_slist_next (tmp_list);
1479 g_slist_free (shaded_ranges);
1485 gtk_theming_engine_render_layout (GtkThemingEngine *engine,
1489 PangoLayout *layout)
1492 GtkStateFlags flags;
1497 flags = gtk_theming_engine_get_state (engine);
1499 /* FIXME: Set clipping */
1501 if (flags & GTK_STATE_FLAG_ACTIVE)
1502 state = GTK_STATE_ACTIVE;
1503 else if (flags & GTK_STATE_FLAG_SELECTED)
1504 state = GTK_STATE_SELECTED;
1505 else if (flags & GTK_STATE_FLAG_PRELIGHT)
1506 state = GTK_STATE_PRELIGHT;
1507 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
1508 state = GTK_STATE_INSENSITIVE;
1510 state = GTK_STATE_NORMAL;
1512 gtk_theming_engine_get (engine, state,
1513 "foreground-color", &fg_color,
1516 screen = gtk_theming_engine_get_screen (engine);
1518 if (state == GTK_STATE_INSENSITIVE)
1520 PangoLayout *insensitive_layout;
1522 insensitive_layout = get_insensitive_layout (layout);
1523 gdk_pango_show_layout (screen,
1527 g_object_unref (insensitive_layout);
1530 gdk_pango_show_layout (screen, cr, x, y, layout,
1535 gdk_color_free (fg_color);
1539 gtk_theming_engine_render_slider (GtkThemingEngine *engine,
1545 GtkOrientation orientation)
1547 const GtkWidgetPath *path;
1550 path = gtk_theming_engine_get_path (engine);
1552 gtk_theming_engine_render_background (engine, cr, x, y, width, height);
1553 gtk_theming_engine_render_frame (engine, cr, x, y, width, height);
1555 /* FIXME: thickness */
1558 if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE))
1560 if (orientation == GTK_ORIENTATION_VERTICAL)
1561 gtk_theming_engine_render_line (engine, cr,
1563 y + (gint) height / 2,
1564 x + width - thickness - 1,
1565 y + (gint) height / 2);
1567 gtk_theming_engine_render_line (engine, cr,
1568 x + (gint) width / 2,
1570 x + (gint) width / 2,
1571 y + height - thickness - 1);
1576 gtk_theming_engine_render_frame_gap (GtkThemingEngine *engine,
1582 GtkPositionType gap_side,
1586 GtkStateFlags flags;
1589 GdkColor lighter, darker;
1593 flags = gtk_theming_engine_get_state (engine);
1595 if (flags & GTK_STATE_FLAG_PRELIGHT)
1596 state = GTK_STATE_PRELIGHT;
1597 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
1598 state = GTK_STATE_INSENSITIVE;
1600 state = GTK_STATE_NORMAL;
1602 cairo_set_line_width (cr, 1);
1604 gtk_theming_engine_get (engine, state,
1605 "background-color", &bg_color,
1607 color_shade (bg_color, 0.7, &darker);
1608 color_shade (bg_color, 1.3, &lighter);
1610 if (gtk_theming_engine_has_class (engine, "frame"))
1612 if (gap_side == GTK_POS_RIGHT)
1613 sides = SIDE_BOTTOM;
1614 else if (gap_side == GTK_POS_BOTTOM)
1617 sides = SIDE_BOTTOM | SIDE_RIGHT;
1619 gdk_cairo_set_source_color (cr, &lighter);
1620 add_path_rectangle_sides (cr, x , y, width , height, sides);
1623 gdk_cairo_set_source_color (cr, &darker);
1624 add_path_rectangle_sides (cr, x, y, width - 1, height - 1, sides);
1627 if (gap_side == GTK_POS_RIGHT ||
1628 gap_side == GTK_POS_BOTTOM)
1630 gdk_cairo_set_source_color (cr, &darker);
1631 add_path_gap_side (cr, gap_side,
1632 x + 1, y + 1, width - 4, height - 4,
1636 gdk_cairo_set_source_color (cr, &lighter);
1637 add_path_gap_side (cr, gap_side,
1638 x, y, width, height,
1643 if (gap_side == GTK_POS_LEFT)
1645 else if (gap_side == GTK_POS_TOP)
1648 sides = SIDE_TOP | SIDE_LEFT;
1650 gdk_cairo_set_source_color (cr, &lighter);
1651 add_path_rectangle_sides (cr, x + 1, y + 1, width - 2, height - 3, sides);
1654 gdk_cairo_set_source_color (cr, &darker);
1655 add_path_rectangle_sides (cr, x, y, width - 1, height - 1, sides);
1658 if (gap_side == GTK_POS_LEFT ||
1659 gap_side == GTK_POS_TOP)
1661 gdk_cairo_set_source_color (cr, &lighter);
1662 add_path_gap_side (cr, gap_side,
1663 x + 1, y + 1, width - 4, height - 4,
1667 gdk_cairo_set_source_color (cr, &darker);
1668 add_path_gap_side (cr, gap_side,
1669 x, y, width - 2, height - 2,
1676 if (gap_side == GTK_POS_RIGHT)
1677 sides = SIDE_BOTTOM;
1678 else if (gap_side == GTK_POS_BOTTOM)
1681 sides = SIDE_BOTTOM | SIDE_RIGHT;
1683 gdk_cairo_set_source_color (cr, &darker);
1684 add_path_rectangle_sides (cr, x + 1, y, width - 2, height, sides);
1685 add_path_rectangle_sides (cr, x, y + 1, width, height - 2, sides);
1688 cairo_set_source_rgb (cr, 0, 0, 0);
1689 add_path_rectangle_sides (cr, x, y, width, height, sides);
1692 if (gap_side == GTK_POS_RIGHT ||
1693 gap_side == GTK_POS_BOTTOM)
1695 gdk_cairo_set_source_color (cr, &darker);
1696 add_path_gap_side (cr, gap_side,
1697 x, y, width - 2, height - 2,
1701 cairo_set_source_rgb (cr, 0, 0, 0);
1702 add_path_gap_side (cr, gap_side,
1703 x, y, width - 1, height - 1,
1708 if (gap_side == GTK_POS_LEFT)
1710 else if (gap_side == GTK_POS_TOP)
1713 sides = SIDE_TOP | SIDE_LEFT;
1715 gdk_cairo_set_source_color (cr, &lighter);
1716 add_path_rectangle_sides (cr, x, y, width, height, sides);
1719 if (gap_side == GTK_POS_LEFT ||
1720 gap_side == GTK_POS_TOP)
1722 add_path_gap_side (cr, gap_side,
1723 x, y, width, height,
1731 gdk_color_free (bg_color);
1735 gtk_theming_engine_render_extension (GtkThemingEngine *engine,
1741 GtkPositionType gap_side)
1743 GtkStateFlags flags;
1746 GdkColor lighter, darker;
1749 flags = gtk_theming_engine_get_state (engine);
1751 if (flags & GTK_STATE_FLAG_ACTIVE)
1752 state = GTK_STATE_ACTIVE;
1753 else if (flags & GTK_STATE_FLAG_PRELIGHT)
1754 state = GTK_STATE_PRELIGHT;
1755 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
1756 state = GTK_STATE_INSENSITIVE;
1758 state = GTK_STATE_NORMAL;
1760 cairo_set_line_width (cr, 1);
1762 gtk_theming_engine_get (engine, state,
1763 "background-color", &bg_color,
1765 color_shade (bg_color, 0.7, &darker);
1766 color_shade (bg_color, 1.3, &lighter);
1771 gdk_cairo_set_source_color (cr, bg_color);
1772 cairo_rectangle (cr, x + 1, y, width - 2, height);
1775 gdk_cairo_set_source_color (cr, &lighter);
1776 add_path_line (cr, x, y, x, y + height - 2);
1779 gdk_cairo_set_source_color (cr, bg_color);
1780 add_path_line (cr, x + 1, y, x + 1, y + height - 2);
1783 gdk_cairo_set_source_color (cr, &darker);
1784 add_path_line (cr, x + 2, y + height - 2, x + width - 2, y + height - 2);
1785 add_path_line (cr, x + width - 2, y, x + width - 2, y + height - 2);
1788 cairo_set_source_rgb (cr, 0, 0, 0);
1789 add_path_line (cr, x + 1, y + height - 1, x + width - 2, y + height - 1);
1790 add_path_line (cr, x + width - 1, y, x + width - 1, y + height - 2);
1794 case GTK_POS_BOTTOM:
1795 gdk_cairo_set_source_color (cr, bg_color);
1796 cairo_rectangle (cr, x + 1, y, width - 2, height);
1799 gdk_cairo_set_source_color (cr, &lighter);
1800 add_path_line (cr, x + 1, y, x + width - 2, y);
1801 add_path_line (cr, x, y + 1, x, y + height - 1);
1804 gdk_cairo_set_source_color (cr, bg_color);
1805 add_path_line (cr, x + 1, y + 1, x + width - 2, y + 1);
1806 add_path_line (cr, x + 1, y + 1, x + 1, y + height - 1);
1809 gdk_cairo_set_source_color (cr, &darker);
1810 add_path_line (cr, x + width - 2, y + 2, x + width - 2, y + height - 1);
1813 cairo_set_source_rgb (cr, 0, 0, 0);
1814 add_path_line (cr, x + width - 1, y + 1, x + width - 1, y + height - 1);
1819 gdk_cairo_set_source_color (cr, bg_color);
1820 cairo_rectangle (cr, x, y + 1, width, height - 2);
1823 gdk_cairo_set_source_color (cr, &lighter);
1824 add_path_line (cr, x, y, x + width - 2, y);
1827 gdk_cairo_set_source_color (cr, bg_color);
1828 add_path_line (cr, x + 1, y + 1, x + width - 2, y + 1);
1831 gdk_cairo_set_source_color (cr, &darker);
1832 add_path_line (cr, x, y + height - 2, x + width - 2, y + height - 2);
1833 add_path_line (cr, x + width - 2, y + 2, x + width - 2, y + height - 2);
1836 cairo_set_source_rgb (cr, 0, 0, 0);
1837 add_path_line (cr, x, y + height - 1, x + width - 2, y + height - 1);
1838 add_path_line (cr, x + width - 1, y + 1, x + width - 1, y + height - 2);
1843 gdk_cairo_set_source_color (cr, bg_color);
1844 cairo_rectangle (cr, x, y + 1, width, height - 2);
1847 gdk_cairo_set_source_color (cr, &lighter);
1848 add_path_line (cr, x + 1, y, x + width - 1, y);
1849 add_path_line (cr, x, y + 1, x, y + height - 2);
1852 gdk_cairo_set_source_color (cr, bg_color);
1853 add_path_line (cr, x + 1, y + 1, x + width - 1, y + 1);
1854 add_path_line (cr, x + 1, y + 1, x + 1, y + height - 2);
1857 gdk_cairo_set_source_color (cr, &darker);
1858 add_path_line (cr, x + 2, y + height - 2, x + width - 1, y + height - 2);
1861 cairo_set_source_rgb (cr, 0, 0, 0);
1862 add_path_line (cr, x + 1, y + height - 1, x + width - 1, y + height - 1);
1870 gdk_color_free (bg_color);
1874 render_dot (cairo_t *cr,
1875 const GdkColor *lighter,
1876 const GdkColor *darker,
1881 size = CLAMP ((gint) size, 2, 3);
1885 gdk_cairo_set_source_color (cr, lighter);
1886 cairo_rectangle (cr, x, y, 1, 1);
1887 cairo_rectangle (cr, x + 1, y + 1, 1, 1);
1892 gdk_cairo_set_source_color (cr, lighter);
1893 cairo_rectangle (cr, x, y, 2, 1);
1894 cairo_rectangle (cr, x, y, 1, 2);
1897 gdk_cairo_set_source_color (cr, darker);
1898 cairo_rectangle (cr, x + 1, y + 1, 2, 1);
1899 cairo_rectangle (cr, x + 2, y, 1, 2);
1905 gtk_theming_engine_render_handle (GtkThemingEngine *engine,
1911 GtkOrientation orientation)
1913 GtkStateFlags flags;
1916 GdkColor lighter, darker;
1920 flags = gtk_theming_engine_get_state (engine);
1922 if (flags & GTK_STATE_FLAG_ACTIVE)
1923 state = GTK_STATE_ACTIVE;
1924 else if (flags & GTK_STATE_FLAG_PRELIGHT)
1925 state = GTK_STATE_PRELIGHT;
1926 else if (flags & GTK_STATE_FLAG_INSENSITIVE)
1927 state = GTK_STATE_INSENSITIVE;
1929 state = GTK_STATE_NORMAL;
1931 cairo_set_line_width (cr, 1);
1933 gtk_theming_engine_get (engine, state,
1934 "background-color", &bg_color,
1936 color_shade (bg_color, 0.7, &darker);
1937 color_shade (bg_color, 1.3, &lighter);
1939 gdk_cairo_set_source_color (cr, bg_color);
1940 cairo_rectangle (cr, x, y, width, height);
1943 if (gtk_theming_engine_has_class (engine, "paned"))
1945 if (orientation == GTK_ORIENTATION_HORIZONTAL)
1946 for (xx = x + width / 2 - 15; xx <= x + width / 2 + 15; xx += 5)
1947 render_dot (cr, &lighter, &darker, xx, y + height / 2 - 1, 3);
1949 for (yy = y + height / 2 - 15; yy <= y + height / 2 + 15; yy += 5)
1950 render_dot (cr, &lighter, &darker, x + width / 2 - 1, yy, 3);
1954 for (yy = y; yy < y + height; yy += 3)
1955 for (xx = x; xx < x + width; xx += 6)
1957 render_dot (cr, &lighter, &darker, xx, yy, 2);
1958 render_dot (cr, &lighter, &darker, xx + 3, yy + 1, 2);
1964 gdk_color_free (bg_color);
1967 #define __GTK_THEMING_ENGINE_C__
1968 #include "gtkaliasdef.c"