X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Ftheme.c;h=47c8a9c9cbfb77b4add7862268b868d96e199bc3;hb=90cecafa3de2f118e550622932d1d30266c71226;hp=cd2352c3ca5bb43f8935e80d9b52e61cdda83be8;hpb=4c7cc1cfa64bf5722f059eae0528d510c2ae636f;p=chaz%2Fopenbox diff --git a/render/theme.c b/render/theme.c index cd2352c3..47c8a9c9 100644 --- a/render/theme.c +++ b/render/theme.c @@ -23,7 +23,7 @@ #include "mask.h" #include "theme.h" #include "icon.h" -#include "parser/parse.h" +#include "obt/paths.h" #include #include @@ -211,6 +211,17 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, if (!read_int(db, "window.client.padding.height", &theme->cbwidthy) || theme->cbwidthy < 0 || theme->cbwidthy > 100) theme->cbwidthy = theme->cbwidthx; + if (!read_int(db, "menu.separator.width", &theme->menu_sep_width) || + theme->menu_sep_width < 1 || theme->menu_sep_width > 100) + theme->menu_sep_width = 1; + if (!read_int(db, "menu.separator.padding.width", + &theme->menu_sep_paddingx) || + theme->menu_sep_paddingx < 0 || theme->menu_sep_paddingx > 100) + theme->menu_sep_paddingx = 6; + if (!read_int(db, "menu.separator.padding.height", + &theme->menu_sep_paddingy) || + theme->menu_sep_paddingy < 0 || theme->menu_sep_paddingy > 100) + theme->menu_sep_paddingy = 3; /* load colors */ if (!read_color(db, inst, @@ -220,7 +231,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, "border.color", &theme->frame_focused_border_color)) theme->frame_focused_border_color = RrColorNew(inst, 0, 0, 0); - /* title separator focused color inherits from focused boder color */ + /* title separator focused color inherits from focused border color */ if (!read_color(db, inst, "window.active.title.separator.color", &theme->title_separator_focused_color)) @@ -237,7 +248,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, RrColorNew(inst, theme->frame_focused_border_color->r, theme->frame_focused_border_color->g, theme->frame_focused_border_color->b); - /* title separator unfocused color inherits from unfocused boder color */ + /* title separator unfocused color inherits from unfocused border color */ if (!read_color(db, inst, "window.inactive.title.separator.color", &theme->title_separator_unfocused_color)) @@ -408,6 +419,12 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, "menu.items.active.text.color", &theme->menu_selected_color)) theme->menu_selected_color = RrColorNew(inst, 0, 0, 0); + if (!read_color(db, inst, + "menu.separator.color", &theme->menu_sep_color)) + theme->menu_sep_color = RrColorNew(inst, + theme->menu_color->r, + theme->menu_color->g, + theme->menu_color->b); /* load the image masks */ @@ -543,6 +560,16 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->menu_bullet_mask = RrPixmapMaskNew(inst, 4, 7, (gchar*)data); } + /* up and down arrows */ + { + guchar data[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 }; + theme->down_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data); + } + { + guchar data[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 }; + theme->up_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data); + } + /* setup the default window icon */ theme->def_win_icon = read_c_image(OB_DEFAULT_ICON_WIDTH, OB_DEFAULT_ICON_HEIGHT, @@ -550,7 +577,6 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->def_win_icon_w = OB_DEFAULT_ICON_WIDTH; theme->def_win_icon_h = OB_DEFAULT_ICON_HEIGHT; - /* read the decoration textures */ if (!read_appearance(db, inst, "window.active.title.bg", theme->a_focused_title, @@ -1408,6 +1434,7 @@ void RrThemeFree(RrTheme *theme) RrColorFree(theme->titlebut_focused_unpressed_color); RrColorFree(theme->titlebut_unfocused_unpressed_color); RrColorFree(theme->menu_title_color); + RrColorFree(theme->menu_sep_color); RrColorFree(theme->menu_color); RrColorFree(theme->menu_selected_color); RrColorFree(theme->menu_disabled_color); @@ -1454,6 +1481,8 @@ void RrThemeFree(RrTheme *theme) RrPixmapMaskFree(theme->close_hover_mask); RrPixmapMaskFree(theme->close_pressed_mask); RrPixmapMaskFree(theme->menu_bullet_mask); + RrPixmapMaskFree(theme->down_arrow_mask); + RrPixmapMaskFree(theme->up_arrow_mask); RrFontClose(theme->win_font_focused); RrFontClose(theme->win_font_unfocused); @@ -1564,6 +1593,10 @@ static XrmDatabase loaddb(const gchar *name, gchar **path) *path = g_path_get_dirname(s); g_free(s); } else { + ObtPaths *p; + + p = obt_paths_new(); + /* XXX backwards compatibility, remove me sometime later */ s = g_build_filename(g_get_home_dir(), ".themes", name, "openbox-3", "themerc", NULL); @@ -1571,8 +1604,7 @@ static XrmDatabase loaddb(const gchar *name, gchar **path) *path = g_path_get_dirname(s); g_free(s); - for (it = parse_xdg_data_dir_paths(); !db && it; - it = g_slist_next(it)) + for (it = obt_paths_data_dirs(p); !db && it; it = g_slist_next(it)) { s = g_build_filename(it->data, "themes", name, "openbox-3", "themerc", NULL); @@ -1580,6 +1612,8 @@ static XrmDatabase loaddb(const gchar *name, gchar **path) *path = g_path_get_dirname(s); g_free(s); } + + obt_paths_unref(p); } if (db == NULL) { @@ -1745,7 +1779,6 @@ static void parse_appearance(gchar *tex, RrSurfaceColorType *grad, *interlaced = FALSE; } - static gboolean read_appearance(XrmDatabase db, const RrInstance *inst, const gchar *rname, RrAppearance *value, gboolean allow_trans)