X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Ftheme.c;h=265378539fd08fd779023526c0879c831ef5df57;hb=d945813e0856bdd8b06c1cc6d00e4cf33c9ee4cd;hp=ba1ce78d1f7d2eb1ddf61e593639de5656d88099;hpb=96bb892054bb9801fd2b5b7959ee2cec27c075ea;p=chaz%2Fopenbox diff --git a/render/theme.c b/render/theme.c index ba1ce78d..26537853 100644 --- a/render/theme.c +++ b/render/theme.c @@ -92,6 +92,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->a_hover_unfocused_max = RrAppearanceNew(inst, 1); theme->a_toggled_focused_unpressed_max = RrAppearanceNew(inst, 1); theme->a_toggled_unfocused_unpressed_max = RrAppearanceNew(inst, 1); + theme->a_toggled_hover_focused_max = RrAppearanceNew(inst, 1); + theme->a_toggled_hover_unfocused_max = RrAppearanceNew(inst, 1); + theme->a_toggled_focused_pressed_max = RrAppearanceNew(inst, 1); + theme->a_toggled_unfocused_pressed_max = RrAppearanceNew(inst, 1); theme->a_focused_unpressed_max = RrAppearanceNew(inst, 1); theme->a_focused_pressed_max = RrAppearanceNew(inst, 1); theme->a_unfocused_unpressed_max = RrAppearanceNew(inst, 1); @@ -322,6 +326,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->titlebut_unfocused_unpressed_color->g, theme->titlebut_unfocused_unpressed_color->b); if (!read_color(db, inst, + "window.active.button.toggled.unpressed.image.color", + &theme->titlebut_toggled_focused_unpressed_color) && + !read_color(db, inst, "window.active.button.toggled.image.color", &theme->titlebut_toggled_focused_unpressed_color)) theme->titlebut_toggled_focused_unpressed_color = @@ -330,6 +337,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->titlebut_focused_pressed_color->g, theme->titlebut_focused_pressed_color->b); if (!read_color(db, inst, + "window.inactive.button.toggled.unpressed.image.color", + &theme->titlebut_toggled_unfocused_unpressed_color) && + !read_color(db, inst, "window.inactive.button.toggled.image.color", &theme->titlebut_toggled_unfocused_unpressed_color)) theme->titlebut_toggled_unfocused_unpressed_color = @@ -337,6 +347,38 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->titlebut_unfocused_pressed_color->r, theme->titlebut_unfocused_pressed_color->g, theme->titlebut_unfocused_pressed_color->b); + if (!read_color(db, inst, + "window.active.button.toggled.hover.image.color", + &theme->titlebut_toggled_hover_focused_color)) + theme->titlebut_toggled_hover_focused_color = + RrColorNew(inst, + theme->titlebut_toggled_focused_unpressed_color->r, + theme->titlebut_toggled_focused_unpressed_color->g, + theme->titlebut_toggled_focused_unpressed_color->b); + if (!read_color(db, inst, + "window.inactive.button.toggled.hover.image.color", + &theme->titlebut_toggled_hover_unfocused_color)) + theme->titlebut_toggled_hover_unfocused_color = + RrColorNew(inst, + theme->titlebut_toggled_unfocused_unpressed_color->r, + theme->titlebut_toggled_unfocused_unpressed_color->g, + theme->titlebut_toggled_unfocused_unpressed_color->b); + if (!read_color(db, inst, + "window.active.button.toggled.pressed.image.color", + &theme->titlebut_toggled_focused_pressed_color)) + theme->titlebut_toggled_focused_pressed_color = + RrColorNew(inst, + theme->titlebut_focused_pressed_color->r, + theme->titlebut_focused_pressed_color->g, + theme->titlebut_focused_pressed_color->b); + if (!read_color(db, inst, + "window.inactive.button.toggled.pressed.image.color", + &theme->titlebut_toggled_unfocused_pressed_color)) + theme->titlebut_toggled_unfocused_pressed_color = + RrColorNew(inst, + theme->titlebut_unfocused_pressed_color->r, + theme->titlebut_unfocused_pressed_color->g, + theme->titlebut_unfocused_pressed_color->b); if (!read_color(db, inst, "menu.title.text.color", &theme->menu_title_color)) theme->menu_title_color = RrColorNew(inst, 0, 0, 0); @@ -359,29 +401,6 @@ 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); - - /* toggled hover = toggled unpressed (i.e. no change) */ - theme->titlebut_toggled_hover_focused_color = - RrColorNew(inst, - theme->titlebut_toggled_focused_unpressed_color->r, - theme->titlebut_toggled_focused_unpressed_color->g, - theme->titlebut_toggled_focused_unpressed_color->b); - theme->titlebut_toggled_hover_unfocused_color = - RrColorNew(inst, - theme->titlebut_toggled_unfocused_unpressed_color->r, - theme->titlebut_toggled_unfocused_unpressed_color->g, - theme->titlebut_toggled_unfocused_unpressed_color->b); - /* toggled pressed = pressed (which is the toggled unpressed fallback..) */ - theme->titlebut_toggled_focused_pressed_color = - RrColorNew(inst, - theme->titlebut_focused_pressed_color->r, - theme->titlebut_focused_pressed_color->g, - theme->titlebut_focused_pressed_color->b); - theme->titlebut_toggled_unfocused_pressed_color = - RrColorNew(inst, - theme->titlebut_unfocused_pressed_color->r, - theme->titlebut_unfocused_pressed_color->g, - theme->titlebut_unfocused_pressed_color->b); /* load the image masks */ @@ -636,6 +655,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, TRUE)) set_default_appearance(theme->a_unfocused_pressed_max); if (!read_appearance(db, inst, + "window.active.button.toggled.unpressed.bg", + theme->a_toggled_focused_unpressed_max, + TRUE) && + !read_appearance(db, inst, "window.active.button.toggled.bg", theme->a_toggled_focused_unpressed_max, TRUE)) @@ -645,6 +668,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, RrAppearanceCopy(theme->a_focused_pressed_max); } if (!read_appearance(db, inst, + "window.inactive.button.toggled.unpressed.bg", + theme->a_toggled_unfocused_unpressed_max, + TRUE) && + !read_appearance(db, inst, "window.inactive.button.toggled.bg", theme->a_toggled_unfocused_unpressed_max, TRUE)) @@ -653,6 +680,42 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->a_toggled_unfocused_unpressed_max = RrAppearanceCopy(theme->a_unfocused_pressed_max); } + if (!read_appearance(db, inst, + "window.active.button.toggled.hover.bg", + theme->a_toggled_hover_focused_max, + TRUE)) + { + RrAppearanceFree(theme->a_toggled_hover_focused_max); + theme->a_toggled_hover_focused_max = + RrAppearanceCopy(theme->a_toggled_focused_unpressed_max); + } + if (!read_appearance(db, inst, + "window.inactive.button.toggled.hover.bg", + theme->a_toggled_hover_unfocused_max, + TRUE)) + { + RrAppearanceFree(theme->a_toggled_hover_unfocused_max); + theme->a_toggled_hover_unfocused_max = + RrAppearanceCopy(theme->a_toggled_unfocused_unpressed_max); + } + if (!read_appearance(db, inst, + "window.active.button.toggled.pressed.bg", + theme->a_toggled_focused_pressed_max, + TRUE)) + { + RrAppearanceFree(theme->a_toggled_focused_pressed_max); + theme->a_toggled_focused_pressed_max = + RrAppearanceCopy(theme->a_focused_pressed_max); + } + if (!read_appearance(db, inst, + "window.inactive.button.toggled.pressed.bg", + theme->a_toggled_unfocused_pressed_max, + TRUE)) + { + RrAppearanceFree(theme->a_toggled_unfocused_pressed_max); + theme->a_toggled_unfocused_pressed_max = + RrAppearanceCopy(theme->a_unfocused_pressed_max); + } if (!read_appearance(db, inst, "window.active.button.unpressed.bg", theme->a_focused_unpressed_max, @@ -682,17 +745,6 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, RrAppearanceCopy(theme->a_unfocused_unpressed_max); } - /* toggled + hover = toggled unpressed (i.e. no change) */ - theme->a_toggled_hover_focused_max = - RrAppearanceCopy(theme->a_toggled_focused_unpressed_max); - theme->a_toggled_hover_unfocused_max = - RrAppearanceCopy(theme->a_toggled_unfocused_unpressed_max); - /* toggled + pressed = pressed (which is the toggled fallback..) */ - theme->a_toggled_focused_pressed_max = - RrAppearanceCopy(theme->a_focused_pressed_max); - theme->a_toggled_unfocused_pressed_max = - RrAppearanceCopy(theme->a_unfocused_pressed_max); - theme->a_disabled_focused_close = RrAppearanceCopy(theme->a_disabled_focused_max); theme->a_disabled_unfocused_close = @@ -1708,14 +1760,20 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst, { gboolean ret = FALSE; gchar *rclass = create_class_name(rname); - gchar *cname, *ctoname, *bcname, *icname; + gchar *cname, *ctoname, *bcname, *icname, *hname, *sname; + gchar *csplitname, *ctosplitname; gchar *rettype; XrmValue retvalue; + gint i; cname = g_strconcat(rname, ".color", NULL); ctoname = g_strconcat(rname, ".colorTo", NULL); bcname = g_strconcat(rname, ".border.color", NULL); icname = g_strconcat(rname, ".interlace.color", NULL); + hname = g_strconcat(rname, ".highlight", NULL); + sname = g_strconcat(rname, ".shadow", NULL); + csplitname = g_strconcat(rname, ".color.splitTo", NULL); + ctosplitname = g_strconcat(rname, ".colorTo.splitTo", NULL); if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr != NULL) { @@ -1738,9 +1796,52 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst, if (!read_color(db, inst, icname, &value->surface.interlace_color)) value->surface.interlace_color = RrColorNew(inst, 0, 0, 0); + if (read_int(db, hname, &i) && i >= 0) + value->surface.bevel_light_adjust = i; + if (read_int(db, sname, &i) && i >= 0 && i <= 256) + value->surface.bevel_dark_adjust = i; + + if (value->surface.grad == RR_SURFACE_SPLIT_VERTICAL) { + gint r, g, b; + + if (!read_color(db, inst, csplitname, + &value->surface.split_primary)) + { + r = value->surface.primary->r; + r += r >> 2; + g = value->surface.primary->g; + g += g >> 2; + b = value->surface.primary->b; + b += b >> 2; + if (r > 0xFF) r = 0xFF; + if (g > 0xFF) g = 0xFF; + if (b > 0xFF) b = 0xFF; + value->surface.split_primary = RrColorNew(inst, r, g, b); + } + + if (!read_color(db, inst, ctosplitname, + &value->surface.split_secondary)) + { + r = value->surface.secondary->r; + r += r >> 4; + g = value->surface.secondary->g; + g += g >> 4; + b = value->surface.secondary->b; + b += b >> 4; + if (r > 0xFF) r = 0xFF; + if (g > 0xFF) g = 0xFF; + if (b > 0xFF) b = 0xFF; + value->surface.split_secondary = RrColorNew(inst, r, g, b); + } + } + ret = TRUE; } + g_free(ctosplitname); + g_free(csplitname); + g_free(sname); + g_free(hname); g_free(icname); g_free(bcname); g_free(ctoname);