return NULL;
}
- theme = g_new0(RrTheme, 1);
+ theme = g_slice_new0(RrTheme);
theme->inst = inst;
theme->name = g_strdup(name ? name : DEFAULT_THEME);
theme->osd_hilite_bg = RrAppearanceNew(inst, 0);
theme->osd_unhilite_label = RrAppearanceNew(inst, 1);
theme->osd_unhilite_bg = RrAppearanceNew(inst, 0);
+ theme->osd_unpressed_button = RrAppearanceNew(inst, 1);
+ theme->osd_pressed_button = RrAppearanceNew(inst, 5);
+ theme->osd_focused_button = RrAppearanceNew(inst, 5);
/* load the font stuff */
theme->win_font_focused = get_font(active_window_font,
theme->menu_color->r,
theme->menu_color->g,
theme->menu_color->b);
+ if (!read_color(db, inst, "osd.button.unpressed.text.color",
+ &theme->osd_unpressed_color))
+ theme->osd_unpressed_color =
+ RrColorNew(inst,
+ theme->osd_text_active_color->r,
+ theme->osd_text_active_color->g,
+ theme->osd_text_active_color->b);
+ if (!read_color(db, inst, "osd.button.pressed.text.color",
+ &theme->osd_pressed_color))
+ theme->osd_pressed_color =
+ RrColorNew(inst,
+ theme->osd_text_active_color->r,
+ theme->osd_text_active_color->g,
+ theme->osd_text_active_color->b);
+ if (!read_color(db, inst, "osd.button.focused.text.color",
+ &theme->osd_focused_color))
+ theme->osd_focused_color =
+ RrColorNew(inst,
+ theme->osd_text_active_color->r,
+ theme->osd_text_active_color->g,
+ theme->osd_text_active_color->b);
+ if (!read_color(db, inst, "osd.button.pressed.box.color",
+ &theme->osd_pressed_lineart))
+ theme->osd_pressed_lineart =
+ 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, "osd.button.focused.box.color",
+ &theme->osd_focused_lineart))
+ theme->osd_focused_lineart =
+ RrColorNew(inst,
+ theme->titlebut_hover_focused_color->r,
+ theme->titlebut_hover_focused_color->g,
+ theme->titlebut_hover_focused_color->b);
/* load the image masks */
theme->a_hover_unfocused_max =
RrAppearanceCopy(theme->a_unfocused_unpressed_max);
}
+ if (!read_appearance(db, inst,
+ "osd.button.unpressed.bg",
+ theme->osd_unpressed_button,
+ TRUE))
+ {
+ RrAppearanceFree(theme->osd_unpressed_button);
+ theme->osd_unpressed_button =
+ RrAppearanceCopy(theme->a_focused_unpressed_max);
+ }
+ if (!read_appearance(db, inst,
+ "osd.button.pressed.bg",
+ theme->osd_pressed_button,
+ TRUE))
+ {
+ RrAppearanceFree(theme->osd_pressed_button);
+ theme->osd_pressed_button =
+ RrAppearanceCopy(theme->a_focused_pressed_max);
+ RrAppearanceRemoveTextures(theme->osd_pressed_button);
+ RrAppearanceAddTextures(theme->osd_pressed_button, 5);
+ }
+ if (!read_appearance(db, inst,
+ "osd.button.focused.bg",
+ theme->osd_focused_button,
+ TRUE))
+ {
+ RrAppearanceFree(theme->osd_focused_button);
+ theme->osd_focused_button =
+ RrAppearanceCopy(theme->a_hover_focused_max);
+ RrAppearanceRemoveTextures(theme->osd_focused_button);
+ RrAppearanceAddTextures(theme->osd_focused_button, 5);
+ }
theme->a_disabled_focused_close =
RrAppearanceCopy(theme->a_disabled_focused_max);
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))
{
theme->osd_hilite_label->texture[0].data.text.shadow_alpha =
theme->osd_text_active_shadow_alpha;
+ theme->osd_unpressed_button->texture[0] =
+ theme->osd_pressed_button->texture[0] =
+ theme->osd_focused_button->texture[0] =
+ theme->osd_hilite_label->texture[0];
+
+ theme->osd_unpressed_button->texture[0].data.text.justify =
+ theme->osd_pressed_button->texture[0].data.text.justify =
+ theme->osd_focused_button->texture[0].data.text.justify =
+ RR_JUSTIFY_CENTER;
+
+ theme->osd_unpressed_button->texture[0].data.text.color =
+ theme->osd_unpressed_color;
+ theme->osd_pressed_button->texture[0].data.text.color =
+ theme->osd_pressed_color;
+ theme->osd_focused_button->texture[0].data.text.color =
+ theme->osd_focused_color;
+
+ theme->osd_pressed_button->texture[1].data.lineart.color =
+ theme->osd_pressed_button->texture[2].data.lineart.color =
+ theme->osd_pressed_button->texture[3].data.lineart.color =
+ theme->osd_pressed_button->texture[4].data.lineart.color =
+ theme->osd_pressed_lineart;
+
+ theme->osd_focused_button->texture[1].data.lineart.color =
+ theme->osd_focused_button->texture[2].data.lineart.color =
+ theme->osd_focused_button->texture[3].data.lineart.color =
+ theme->osd_focused_button->texture[4].data.lineart.color =
+ theme->osd_focused_lineart;
+
+ 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;
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 =
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 =
RrColorFree(theme->osd_text_inactive_color);
RrColorFree(theme->osd_text_active_shadow_color);
RrColorFree(theme->osd_text_inactive_shadow_color);
+ RrColorFree(theme->osd_pressed_color);
+ RrColorFree(theme->osd_unpressed_color);
+ RrColorFree(theme->osd_focused_color);
+ RrColorFree(theme->osd_pressed_lineart);
+ RrColorFree(theme->osd_focused_lineart);
RrColorFree(theme->menu_title_shadow_color);
RrColorFree(theme->menu_text_normal_shadow_color);
RrColorFree(theme->menu_text_selected_shadow_color);
RrAppearanceFree(theme->osd_hilite_label);
RrAppearanceFree(theme->osd_unhilite_bg);
RrAppearanceFree(theme->osd_unhilite_label);
+ RrAppearanceFree(theme->osd_pressed_button);
+ RrAppearanceFree(theme->osd_unpressed_button);
+ RrAppearanceFree(theme->osd_focused_button);
- g_free(theme);
+ g_slice_free(RrTheme, theme);
}
}