From: Mikael Magnusson Date: Mon, 11 Jan 2010 00:27:30 +0000 (+0100) Subject: Fix ordering so fallback for inactive osd to label works X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=3e9dbc01430193035e3d1f5832c019c3f9623db8;p=chaz%2Fopenbox Fix ordering so fallback for inactive osd to label works The themeing options (sic) for inactive osd labels added in cfdbe23e0d9b72b4c220a10ddf60a4e981967b63 had the fallback to inactive label before that was read in, so fallback failed to pick up some things. --- diff --git a/obrender/theme.c b/obrender/theme.c index 6c136bf5..43fb0dd1 100644 --- a/obrender/theme.c +++ b/obrender/theme.c @@ -932,13 +932,6 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->osd_hilite_label->texture[0].data.text.color = theme->osd_text_active_color; - theme->osd_unhilite_label->texture[0].type = RR_TEXTURE_TEXT; - theme->osd_unhilite_label->texture[0].data.text.justify = RR_JUSTIFY_LEFT; - theme->osd_unhilite_label->texture[0].data.text.font = - theme->osd_font_unhilite; - theme->osd_unhilite_label->texture[0].data.text.color = - theme->osd_text_inactive_color; - if (read_string(db, "osd.active.label.text.font", &str) || read_string(db, "osd.label.text.font", &str)) { @@ -988,6 +981,51 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->osd_hilite_label->texture[0].data.text.shadow_alpha = theme->osd_text_active_shadow_alpha; + theme->a_unfocused_label->texture[0].type = RR_TEXTURE_TEXT; + theme->a_unfocused_label->texture[0].data.text.justify = winjust; + theme->a_unfocused_label->texture[0].data.text.font = + theme->win_font_unfocused; + theme->a_unfocused_label->texture[0].data.text.color = + theme->title_unfocused_color; + + if (read_string(db, "window.inactive.label.text.font", &str)) { + char *p; + gint i = 0; + gint j; + if (strstr(str, "shadow=y")) { + if ((p = strstr(str, "shadowoffset="))) + i = parse_inline_number(p + strlen("shadowoffset=")); + else + i = 1; + theme->a_unfocused_label->texture[0].data.text.shadow_offset_x = i; + theme->a_unfocused_label->texture[0].data.text.shadow_offset_y = i; + } + if ((p = strstr(str, "shadowtint="))) + { + i = parse_inline_number(p + strlen("shadowtint=")); + j = (i > 0 ? 0 : 255); + i = ABS(i*255/100); + + theme->title_unfocused_shadow_color = RrColorNew(inst, j, j, j); + theme->title_unfocused_shadow_alpha = i; + } else { + theme->title_unfocused_shadow_color = RrColorNew(inst, 0, 0, 0); + theme->title_unfocused_shadow_alpha = 50; + } + } + + theme->a_unfocused_label->texture[0].data.text.shadow_color = + theme->title_unfocused_shadow_color; + theme->a_unfocused_label->texture[0].data.text.shadow_alpha = + theme->title_unfocused_shadow_alpha; + + theme->osd_unhilite_label->texture[0].type = RR_TEXTURE_TEXT; + theme->osd_unhilite_label->texture[0].data.text.justify = RR_JUSTIFY_LEFT; + theme->osd_unhilite_label->texture[0].data.text.font = + theme->osd_font_unhilite; + theme->osd_unhilite_label->texture[0].data.text.color = + theme->osd_text_inactive_color; + if (read_string(db, "osd.inactive.label.text.font", &str)) { char *p; @@ -1014,7 +1052,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->osd_text_inactive_shadow_alpha = 50; } } else { - /* inherit the font settings from the focused label */ + /* inherit the font settings from the unfocused label */ theme->osd_unhilite_label->texture[0].data.text.shadow_offset_x = theme->a_unfocused_label->texture[0].data.text.shadow_offset_x; theme->osd_unhilite_label->texture[0].data.text.shadow_offset_y = @@ -1036,44 +1074,6 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, theme->osd_unhilite_label->texture[0].data.text.shadow_alpha = theme->osd_text_inactive_shadow_alpha; - theme->a_unfocused_label->texture[0].type = RR_TEXTURE_TEXT; - theme->a_unfocused_label->texture[0].data.text.justify = winjust; - theme->a_unfocused_label->texture[0].data.text.font = - theme->win_font_unfocused; - theme->a_unfocused_label->texture[0].data.text.color = - theme->title_unfocused_color; - - if (read_string(db, "window.inactive.label.text.font", &str)) { - char *p; - gint i = 0; - gint j; - if (strstr(str, "shadow=y")) { - if ((p = strstr(str, "shadowoffset="))) - i = parse_inline_number(p + strlen("shadowoffset=")); - else - i = 1; - theme->a_unfocused_label->texture[0].data.text.shadow_offset_x = i; - theme->a_unfocused_label->texture[0].data.text.shadow_offset_y = i; - } - if ((p = strstr(str, "shadowtint="))) - { - i = parse_inline_number(p + strlen("shadowtint=")); - j = (i > 0 ? 0 : 255); - i = ABS(i*255/100); - - theme->title_unfocused_shadow_color = RrColorNew(inst, j, j, j); - theme->title_unfocused_shadow_alpha = i; - } else { - theme->title_unfocused_shadow_color = RrColorNew(inst, 0, 0, 0); - theme->title_unfocused_shadow_alpha = 50; - } - } - - theme->a_unfocused_label->texture[0].data.text.shadow_color = - theme->title_unfocused_shadow_color; - theme->a_unfocused_label->texture[0].data.text.shadow_alpha = - theme->title_unfocused_shadow_alpha; - theme->a_menu_text_title->texture[0].type = RR_TEXTURE_TEXT; theme->a_menu_text_title->texture[0].data.text.justify = mtitlejust; theme->a_menu_text_title->texture[0].data.text.font =