+static void decor_render(gpointer data, gpointer user_data)
+{
+ struct decor *decor = data;
+ struct box *box = &decor->geometry.box;
+ struct vector *a = &decor->space.anchor;
+ double x, y;
+
+ printf("%s:", decor->name);
+ x = expression_eval(&a->x);
+ y = expression_eval(&a->y);
+ printf("rectangle(%f %f) - (%f %f)\n", x + expression_eval(&box->start.x), y + expression_eval(&box->start.y),
+ x + expression_eval(&box->end.x), y + expression_eval(&box->end.y));
+ if (decor->children)
+ g_slist_foreach(decor->children, decor_render, NULL);
+}
+
+static void decor_bound(gpointer data, gpointer user_data)
+{
+ struct boundrect *br = user_data;
+ struct decor *decor = data;
+ struct box *box = &decor->geometry.box;
+ struct vector *a = &decor->space.anchor;
+ double x1, y1, x2, y2;
+ x1 = expression_eval(&a->x);
+ y1 = expression_eval(&a->y);
+ x2 = x1;
+ y2 = y1;
+ x1 += expression_eval(&box->start.x);
+ y1 += expression_eval(&box->start.y);
+ x2 += expression_eval(&box->end.x);
+ y2 += expression_eval(&box->end.y);
+ if (x1 < br->x1)
+ br->x1 = x1;
+ if (x2 < br->x1)
+ br->x1 = x2;
+ if (x1 > br->x2)
+ br->x2 = x1;
+ if (x2 > br->x2)
+ br->x2 = x2;
+
+ if (y1 < br->y1)
+ br->y1 = y1;
+ if (y2 < br->y1)
+ br->y1 = y2;
+ if (y1 > br->y2)
+ br->y2 = y1;
+ if (y2 > br->y2)
+ br->y2 = y2;
+printf("%f %f %f %f\n", br->x1, br->y1, br->x2, br->y2);
+ if (decor->children)
+ g_slist_foreach(decor->children, decor_bound, br);
+}
+
+void bound(struct theme *thm, char *name, struct boundrect *br)
+{
+ struct style *sty;
+
+ br->x1 = 0.0;
+ br->y1 = 0.0;
+ br->x2 = 0.0;
+ br->y2 = 0.0;
+ sty = g_hash_table_lookup(thm->styles, name);
+ assert(sty);
+ g_slist_foreach(sty->tree, decor_bound, br);
+}
+
+void draw(struct theme *thm, char *name)
+{
+ struct style *sty;
+ sty = g_hash_table_lookup(thm->styles, name);
+ g_slist_foreach(sty->tree, decor_render, NULL);
+}
+