+#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "obtheme.h"
-static void decor_print(gpointer data, gpointer user_data)
-{
- struct decor *decor = data;
- printf(" decor id %s\n", decor->name);
- printf(" anchor (%d %d %d)\n", decor->space.anchor.x, decor->space.anchor.y, decor->space.anchor.z);
- printf(" up (%d %d %d)\n", decor->space.up.x, decor->space.up.y, decor->space.up.z);
- if (decor->children)
- g_slist_foreach(decor->children, decor_print, NULL);
-}
-
-static void class_print(gpointer key, gpointer value, gpointer user_data)
-{
- char *classname = key;
- struct class *class = value;
-
- printf(" Class %s\n", classname);
- g_slist_foreach(class->tree, decor_print, NULL);
-}
-
-static void theme_print(gpointer key, gpointer value, gpointer user_data)
-{
- char *name = key;
- struct theme *thm = value;
- printf("name = %s\n", name);
- g_hash_table_foreach(thm->classes, class_print, NULL);
-}
-
-static void material_print(gpointer key, gpointer value, gpointer user_data)
-{
- char *name = key;
- struct material *mat = value;
- printf("name = %s\n", name);
- printf(" opacity = %f\n", mat->opacity);
-}
+struct obthemedata themedata;
int main(int argc, char **argv)
{
+ Rect r;
+ Strut s;
int err;
- struct obthemedata themedata;
+ struct theme *thm;
themedata.themes = g_hash_table_new(g_str_hash, g_str_equal);
themedata.materials = g_hash_table_new(g_str_hash, g_str_equal);
err = obtheme_parse(&themedata, argv[1]);
+ if (err) {
+ printf("Fix the script\n");
+ exit(1);
+ }
printf("err = %d\n", err);
- g_hash_table_foreach(themedata.materials, material_print, NULL);
+// g_hash_table_foreach(themedata.materials, material_print, NULL);
+
+// g_hash_table_foreach(themedata.themes, theme_print, NULL);
- g_hash_table_foreach(themedata.themes, theme_print, NULL);
+ thm = g_hash_table_lookup(themedata.themes, "awesome");
+ obtheme_decorate_window(thm, "regular_window");
+ obtheme_calc_bound(thm, "regular_window", &r, &s);
+ printf("bounding rectangle: (%d %d) - (%d %d)\n", r.x, r.y, r.width, r.height);
return 0;
}