X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=inline;f=render%2Ftheme.c;h=8ad8c8415a998a8206835b0abf6baad0cd029a65;hb=c1b2fc5324522f74a14a5cfa210c95e1509a6e7f;hp=e658d8731f8a264eba9af2ecabe97866aacef509;hpb=5d658c98e2ce6aa00f0236b3dedfc6ff0c2041ca;p=chaz%2Fopenbox diff --git a/render/theme.c b/render/theme.c index e658d873..8ad8c841 100644 --- a/render/theme.c +++ b/render/theme.c @@ -4,6 +4,7 @@ #include "mask.h" #include "theme.h" #include "icon.h" +#include "parser/parse.h" #include #include @@ -924,6 +925,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) void RrThemeFree(RrTheme *theme) { if (theme) { + g_free(theme->path); g_free(theme->name); RrColorFree(theme->b_color); @@ -1051,26 +1053,36 @@ void RrThemeFree(RrTheme *theme) RrAppearanceFree(theme->app_unhilite_fg); RrAppearanceFree(theme->app_hilite_label); RrAppearanceFree(theme->app_unhilite_label); + + g_free(theme); } } static XrmDatabase loaddb(RrTheme *theme, char *name) { - XrmDatabase db; + GSList *it; + XrmDatabase db = NULL; + gchar *s; - char *s = g_build_filename(g_get_home_dir(), ".openbox", "themes", - name, "themerc", NULL); - if ((db = XrmGetFileDatabase(s))) - theme->path = g_path_get_dirname(s); - g_free(s); - if (db == NULL) { - char *s = g_build_filename(THEMEDIR, name, "themerc", NULL); + if (name[0] == '/') { + s = g_build_filename(name, "openbox-3", "themerc", NULL); if ((db = XrmGetFileDatabase(s))) theme->path = g_path_get_dirname(s); - g_free(s); + g_free(s); + } else { + for (it = parse_xdg_data_dir_paths(); !db && it; + it = g_slist_next(it)) + { + s = g_build_filename(it->data, "themes", name, + "openbox-3", "themerc", NULL); + if ((db = XrmGetFileDatabase(s))) + theme->path = g_path_get_dirname(s); + g_free(s); + } } + if (db == NULL) { - char *s = g_build_filename(name, "themerc", NULL); + s = g_build_filename(name, "themerc", NULL); if ((db = XrmGetFileDatabase(s))) theme->path = g_path_get_dirname(s); g_free(s); @@ -1291,11 +1303,9 @@ static RrPixel32* read_c_image(gint width, gint height, const guint8 *data) RrPixel32 *im, *p; gint i; - p = im = g_memdup(OB_DEFAULT_ICON_pixel_data, - OB_DEFAULT_ICON_WIDTH * OB_DEFAULT_ICON_HEIGHT * - sizeof(RrPixel32)); + p = im = g_memdup(data, width * height * sizeof(RrPixel32)); - for (i = 0; i < OB_DEFAULT_ICON_WIDTH*OB_DEFAULT_ICON_HEIGHT; ++i) { + for (i = 0; i < width * height; ++i) { guchar a = ((*p >> 24) & 0xff); guchar b = ((*p >> 16) & 0xff); guchar g = ((*p >> 8) & 0xff);