X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Ftheme.c;h=d040c171a0b15f313f55999ceaa5bcfda1481625;hb=c564b6245fcfaf0efd523cfa17bc1a73fe640d68;hp=d188e6ae7fc99615cf0c629994e6605255afdf72;hpb=7f5347897754164c9688d7e3d882411283c13a55;p=chaz%2Fopenbox diff --git a/render/theme.c b/render/theme.c index d188e6ae..d040c171 100644 --- a/render/theme.c +++ b/render/theme.c @@ -115,6 +115,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->a_menu_normal = RrAppearanceNew(inst, 0); theme->a_menu_selected = RrAppearanceNew(inst, 0); theme->a_menu_disabled = RrAppearanceNew(inst, 0); + /* a_menu_disabled_selected is copied from a_menu_selected */ theme->a_menu_text_normal = RrAppearanceNew(inst, 1); theme->a_menu_text_selected = RrAppearanceNew(inst, 1); theme->a_menu_text_disabled = RrAppearanceNew(inst, 1); @@ -176,9 +177,14 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->osd_font = RrFontOpenDefault(inst); /* load direct dimensions */ - if (!read_int(db, "menu.overlap", &theme->menu_overlap) || - theme->menu_overlap < -100 || theme->menu_overlap > 100) - theme->menu_overlap = 0; + if ((!read_int(db, "menu.overlap.x", &theme->menu_overlap_x) && + !read_int(db, "menu.overlap", &theme->menu_overlap_x)) || + theme->menu_overlap_x < -100 || theme->menu_overlap_x > 100) + theme->menu_overlap_x = 0; + if ((!read_int(db, "menu.overlap.y", &theme->menu_overlap_y) && + !read_int(db, "menu.overlap", &theme->menu_overlap_y)) || + theme->menu_overlap_y < -100 || theme->menu_overlap_y > 100) + theme->menu_overlap_y = 0; if (!read_int(db, "window.handle.width", &theme->handle_height) || theme->handle_height < 0 || theme->handle_height > 100) theme->handle_height = 6; @@ -205,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, @@ -214,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)) @@ -231,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)) @@ -402,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 */ @@ -541,6 +564,8 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->def_win_icon = read_c_image(OB_DEFAULT_ICON_WIDTH, OB_DEFAULT_ICON_HEIGHT, OB_DEFAULT_ICON_pixel_data); + 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, @@ -896,13 +921,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, j = (i > 0 ? 0 : 255); i = ABS(i*255/100); - theme->title_focused_shadow_color = RrColorNew(inst, j, j, j); - theme->title_focused_shadow_alpha = i; theme->osd_shadow_color = RrColorNew(inst, j, j, j); theme->osd_shadow_alpha = i; } else { - theme->title_focused_shadow_color = RrColorNew(inst, 0, 0, 0); - theme->title_focused_shadow_alpha = 50; theme->osd_shadow_color = RrColorNew(inst, 0, 0, 0); theme->osd_shadow_alpha = 50; } @@ -1403,6 +1424,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 +1476,7 @@ void RrThemeFree(RrTheme *theme) RrFontClose(theme->win_font_unfocused); RrFontClose(theme->menu_title_font); RrFontClose(theme->menu_font); + RrFontClose(theme->osd_font); RrAppearanceFree(theme->a_disabled_focused_max); RrAppearanceFree(theme->a_disabled_unfocused_max); @@ -1739,7 +1762,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)