X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=render%2Ftheme.c;h=4f86c8d062ea02a344b9403c371e0d9a137cd0cf;hb=c791cbfda0865a9716419c533b665d0550ae2916;hp=991dfd1c9f6f9964a8b3108fbfda05d595ee02b0;hpb=b1f5555218ecaa3827450125dc47b4bf0d404ee4;p=chaz%2Fopenbox diff --git a/render/theme.c b/render/theme.c index 991dfd1c..4f86c8d0 100644 --- a/render/theme.c +++ b/render/theme.c @@ -11,7 +11,7 @@ static XrmDatabase loaddb(char *theme); static gboolean read_int(XrmDatabase db, char *rname, int *value); static gboolean read_string(XrmDatabase db, char *rname, char **value); static gboolean read_color(XrmDatabase db, const RrInstance *inst, - gchar *rname, color_rgb **value); + gchar *rname, RrColor **value); static gboolean read_mask(XrmDatabase db, const RrInstance *inst, gchar *rname, gchar *theme, RrPixmapMask **value); @@ -27,7 +27,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) gchar *font_str; RrTheme *theme; - theme = g_new(RrTheme, 1); + theme = g_new0(RrTheme, 1); theme->inst = inst; @@ -125,9 +125,12 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) theme->winfont_shadow_tint < 100 || theme->winfont_shadow_tint > 100) theme->winfont_shadow_tint = 25; - theme->winfont = font_open(inst, font_str); - theme->winfont_height = font_height(theme->winfont, theme->winfont_shadow, - theme->winfont_shadow_offset); + if (!(theme->winfont = RrFontOpen(inst, font_str))) { + RrThemeFree(theme); + return NULL; + } + theme->winfont_height = RrFontHeight(theme->winfont, theme->winfont_shadow, + theme->winfont_shadow_offset); winjust = RR_JUSTIFY_LEFT; if (read_string(db, "window.justify", &str)) { @@ -156,10 +159,13 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) theme->mtitlefont_shadow_tint > 100) theme->mtitlefont_shadow_tint = 25; - theme->mtitlefont = font_open(inst, font_str); - theme->mtitlefont_height = font_height(theme->mtitlefont, - theme->mtitlefont_shadow, - theme->mtitlefont_shadow_offset); + if (!(theme->mtitlefont = RrFontOpen(inst, font_str))) { + RrThemeFree(theme); + return NULL; + } + theme->mtitlefont_height = RrFontHeight(theme->mtitlefont, + theme->mtitlefont_shadow, + theme->mtitlefont_shadow_offset); mtitlejust = RR_JUSTIFY_LEFT; if (read_string(db, "menu.title.justify", &str)) { @@ -188,9 +194,12 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) theme->mfont_shadow_tint > 100) theme->mfont_shadow_tint = 25; - theme->mfont = font_open(inst, font_str); - theme->mfont_height = font_height(theme->mfont, theme->mfont_shadow, - theme->mfont_shadow_offset); + if (!(theme->mfont = RrFontOpen(inst, font_str))) { + RrThemeFree(theme); + return NULL; + } + theme->mfont_height = RrFontHeight(theme->mfont, theme->mfont_shadow, + theme->mfont_shadow_offset); mjust = RR_JUSTIFY_LEFT; if (read_string(db, "menu.frame.justify", &str)) { @@ -647,9 +656,9 @@ void RrThemeFree(RrTheme *theme) RrPixmapMaskFree(theme->iconify_mask); RrPixmapMaskFree(theme->close_mask); - font_close(theme->winfont); - font_close(theme->mtitlefont); - font_close(theme->mfont); + RrFontClose(theme->winfont); + RrFontClose(theme->mtitlefont); + RrFontClose(theme->mfont); g_free(theme->title_layout); @@ -767,7 +776,7 @@ static gboolean read_string(XrmDatabase db, char *rname, char **value) } static gboolean read_color(XrmDatabase db, const RrInstance *inst, - gchar *rname, color_rgb **value) + gchar *rname, RrColor **value) { gboolean ret = FALSE; char *rclass = create_class_name(rname); @@ -776,7 +785,7 @@ static gboolean read_color(XrmDatabase db, const RrInstance *inst, if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr != NULL) { - color_rgb *c = RrColorParse(inst, retvalue.addr); + RrColor *c = RrColorParse(inst, retvalue.addr); if (c != NULL) { *value = c; ret = TRUE; @@ -862,14 +871,8 @@ static void parse_appearance(gchar *tex, RrSurfaceColorType *grad, if (strstr(tex, "gradient") != NULL) { if (strstr(tex, "crossdiagonal") != NULL) *grad = RR_SURFACE_CROSS_DIAGONAL; - else if (strstr(tex, "rectangle") != NULL) - *grad = RR_SURFACE_RECTANGLE; else if (strstr(tex, "pyramid") != NULL) *grad = RR_SURFACE_PYRAMID; - else if (strstr(tex, "pipecross") != NULL) - *grad = RR_SURFACE_PIPECROSS; - else if (strstr(tex, "elliptic") != NULL) - *grad = RR_SURFACE_PIPECROSS; else if (strstr(tex, "horizontal") != NULL) *grad = RR_SURFACE_HORIZONTAL; else if (strstr(tex, "vertical") != NULL)