Move some more code around to make it shorter

This commit is contained in:
Mikael Magnusson 2014-11-05 18:31:49 +01:00
parent 35e92e4c2a
commit 24bb21a124
5 changed files with 77 additions and 394 deletions

View file

@ -29,34 +29,10 @@ RrButton *RrButtonNew (const RrInstance *inst)
{
RrButton *out = NULL;
out = g_new(RrButton, 1);
/* no need to alloc colors and masks, set them null (for freeing later) */
out = g_new0(RrButton, 1);
out->inst = inst;
/* no need to alloc colors, set them null (for freeing later) */
out->focused_unpressed_color = NULL;
out->unfocused_unpressed_color = NULL;
out->focused_pressed_color = NULL;
out->unfocused_pressed_color = NULL;
out->focused_disabled_color = NULL;
out->unfocused_disabled_color = NULL;
out->focused_hover_color = NULL;
out->unfocused_hover_color = NULL;
out->focused_hover_toggled_color = NULL;
out->unfocused_hover_toggled_color = NULL;
out->focused_pressed_toggled_color = NULL;
out->unfocused_pressed_toggled_color = NULL;
out->focused_unpressed_toggled_color = NULL;
out->unfocused_unpressed_toggled_color = NULL;
/* same with masks */
out->mask = NULL;
out->pressed_mask = NULL;
out->disabled_mask = NULL;
out->hover_mask = NULL;
out->toggled_mask = NULL;
out->hover_toggled_mask = NULL;
out->pressed_toggled_mask = NULL;
/* allocate appearances */
out->a_focused_unpressed = RrAppearanceNew(inst, 1);
out->a_unfocused_unpressed = RrAppearanceNew(inst, 1);
@ -79,43 +55,29 @@ RrButton *RrButtonNew (const RrInstance *inst)
void RrButtonFree(RrButton *b)
{
/* colors */
if (b->focused_unpressed_color)
RrColorFree(b->focused_unpressed_color);
if (b->unfocused_unpressed_color)
RrColorFree(b->unfocused_unpressed_color);
if (b->focused_pressed_color)
RrColorFree(b->focused_pressed_color);
if (b->unfocused_pressed_color)
RrColorFree(b->unfocused_pressed_color);
if (b->focused_disabled_color)
RrColorFree(b->focused_disabled_color);
if (b->unfocused_disabled_color)
RrColorFree(b->unfocused_disabled_color);
if (b->focused_hover_color)
RrColorFree(b->focused_hover_color);
if (b->unfocused_hover_color)
RrColorFree(b->unfocused_hover_color);
if (b->focused_hover_toggled_color)
RrColorFree(b->focused_hover_toggled_color);
if (b->unfocused_hover_toggled_color)
RrColorFree(b->unfocused_hover_toggled_color);
if (b->focused_pressed_toggled_color)
RrColorFree(b->focused_pressed_toggled_color);
if (b->unfocused_pressed_toggled_color)
RrColorFree(b->unfocused_pressed_toggled_color);
if (b->focused_unpressed_toggled_color)
RrColorFree(b->focused_unpressed_toggled_color);
if (b->unfocused_unpressed_toggled_color)
RrColorFree(b->unfocused_unpressed_toggled_color);
RrColorFree(b->focused_unpressed_color);
RrColorFree(b->unfocused_unpressed_color);
RrColorFree(b->focused_pressed_color);
RrColorFree(b->unfocused_pressed_color);
RrColorFree(b->focused_disabled_color);
RrColorFree(b->unfocused_disabled_color);
RrColorFree(b->focused_hover_color);
RrColorFree(b->unfocused_hover_color);
RrColorFree(b->focused_hover_toggled_color);
RrColorFree(b->unfocused_hover_toggled_color);
RrColorFree(b->focused_pressed_toggled_color);
RrColorFree(b->unfocused_pressed_toggled_color);
RrColorFree(b->focused_unpressed_toggled_color);
RrColorFree(b->unfocused_unpressed_toggled_color);
/* masks */
if (b->mask) RrPixmapMaskFree(b->mask);
if (b->pressed_mask) RrPixmapMaskFree(b->pressed_mask);
if (b->disabled_mask) RrPixmapMaskFree(b->disabled_mask);
if (b->hover_mask) RrPixmapMaskFree(b->hover_mask);
if (b->toggled_mask) RrPixmapMaskFree(b->toggled_mask);
if (b->hover_toggled_mask) RrPixmapMaskFree(b->hover_toggled_mask);
if (b->pressed_toggled_mask) RrPixmapMaskFree(b->pressed_toggled_mask);
RrPixmapMaskFree(b->unpressed_mask);
RrPixmapMaskFree(b->pressed_mask);
RrPixmapMaskFree(b->disabled_mask);
RrPixmapMaskFree(b->hover_mask);
RrPixmapMaskFree(b->unpressed_toggled_mask);
RrPixmapMaskFree(b->hover_toggled_mask);
RrPixmapMaskFree(b->pressed_toggled_mask);
/* appearances */
RrAppearanceFree(b->a_focused_unpressed);

View file

@ -307,11 +307,11 @@ struct _RrButton {
RrColor *unfocused_unpressed_toggled_color;
/* masks */
RrPixmapMask *mask;
RrPixmapMask *unpressed_mask;
RrPixmapMask *pressed_mask;
RrPixmapMask *disabled_mask;
RrPixmapMask *hover_mask;
RrPixmapMask *toggled_mask;
RrPixmapMask *unpressed_toggled_mask;
RrPixmapMask *hover_toggled_mask;
RrPixmapMask *pressed_toggled_mask;

View file

@ -846,17 +846,16 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
i = ABS(i*255/100);
theme->menu_title_shadow_color = RrColorNew(inst, j, j, j);
theme->menu_title_shadow_alpha = i;
} else {
theme->menu_title_shadow_color = RrColorNew(inst, 0, 0, 0);
theme->menu_title_shadow_alpha = 50;
i = 50;
}
}
theme->a_menu_text_title->texture[0].data.text.shadow_color =
theme->menu_title_shadow_color;
theme->a_menu_text_title->texture[0].data.text.shadow_alpha =
theme->menu_title_shadow_alpha;
theme->a_menu_text_title->texture[0].data.text.shadow_color =
theme->menu_title_shadow_color;
theme->a_menu_text_title->texture[0].data.text.shadow_alpha =
i;
}
theme->a_menu_text_normal->texture[0].type =
theme->a_menu_text_selected->texture[0].type =
@ -912,307 +911,30 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
j = (i > 0 ? 0 : 255);
i = ABS(i*255/100);
theme->menu_text_normal_shadow_color = RrColorNew(inst, j, j, j);
theme->menu_text_selected_shadow_color = RrColorNew(inst, j, j, j);
theme->menu_text_disabled_shadow_color = RrColorNew(inst, j, j, j);
theme->menu_text_normal_shadow_alpha = i;
theme->menu_text_selected_shadow_alpha = i;
theme->menu_text_disabled_shadow_alpha = i;
theme->menu_text_disabled_selected_shadow_alpha = i;
theme->menu_text_shadow_color = RrColorNew(inst, j, j, j);
} else {
theme->menu_text_normal_shadow_color = RrColorNew(inst, 0, 0, 0);
theme->menu_text_selected_shadow_color = RrColorNew(inst, 0, 0, 0);
theme->menu_text_disabled_shadow_color = RrColorNew(inst, 0, 0, 0);
theme->menu_text_normal_shadow_alpha = 50;
theme->menu_text_selected_shadow_alpha = 50;
theme->menu_text_disabled_selected_shadow_alpha = 50;
theme->menu_text_shadow_color = RrColorNew(inst, 0, 0, 0);
i = 50;
}
theme->a_menu_text_normal->texture[0].data.text.shadow_color =
theme->a_menu_text_selected->texture[0].data.text.shadow_color =
theme->a_menu_text_disabled->texture[0].data.text.shadow_color =
theme->a_menu_text_disabled_selected->texture[0].data.text.shadow_color =
theme->menu_text_shadow_color;
theme->a_menu_text_normal->texture[0].data.text.shadow_alpha =
theme->a_menu_text_selected->texture[0].data.text.shadow_alpha =
theme->a_menu_text_disabled->texture[0].data.text.shadow_alpha =
theme->a_menu_text_disabled_selected->texture[0].data.text.shadow_alpha =
i;
}
theme->a_menu_text_normal->texture[0].data.text.shadow_color =
theme->menu_text_normal_shadow_color;
theme->a_menu_text_normal->texture[0].data.text.shadow_alpha =
theme->menu_text_normal_shadow_alpha;
theme->a_menu_text_selected->texture[0].data.text.shadow_color =
theme->menu_text_selected_shadow_color;
theme->a_menu_text_selected->texture[0].data.text.shadow_alpha =
theme->menu_text_selected_shadow_alpha;
theme->a_menu_text_disabled->texture[0].data.text.shadow_color =
theme->menu_text_disabled_shadow_color;
theme->a_menu_text_disabled->texture[0].data.text.shadow_alpha =
theme->menu_text_disabled_shadow_alpha;
theme->a_menu_text_disabled_selected->texture[0].data.text.shadow_color =
theme->menu_text_disabled_shadow_color;
theme->a_menu_text_disabled_selected->texture[0].data.text.shadow_alpha =
theme->menu_text_disabled_shadow_alpha;
theme->btn_max->a_focused_disabled->texture[0].type =
theme->btn_max->a_unfocused_disabled->texture[0].type =
theme->btn_max->a_focused_hover->texture[0].type =
theme->btn_max->a_unfocused_hover->texture[0].type =
theme->btn_max->a_focused_hover_toggled->texture[0].type =
theme->btn_max->a_unfocused_hover_toggled->texture[0].type =
theme->btn_max->a_focused_unpressed_toggled->texture[0].type =
theme->btn_max->a_unfocused_unpressed_toggled->texture[0].type =
theme->btn_max->a_focused_pressed_toggled->texture[0].type =
theme->btn_max->a_unfocused_pressed_toggled->texture[0].type =
theme->btn_max->a_focused_unpressed->texture[0].type =
theme->btn_max->a_focused_pressed->texture[0].type =
theme->btn_max->a_unfocused_unpressed->texture[0].type =
theme->btn_max->a_unfocused_pressed->texture[0].type =
theme->btn_close->a_focused_disabled->texture[0].type =
theme->btn_close->a_unfocused_disabled->texture[0].type =
theme->btn_close->a_focused_hover->texture[0].type =
theme->btn_close->a_unfocused_hover->texture[0].type =
theme->btn_close->a_focused_unpressed->texture[0].type =
theme->btn_close->a_focused_pressed->texture[0].type =
theme->btn_close->a_unfocused_unpressed->texture[0].type =
theme->btn_close->a_unfocused_pressed->texture[0].type =
theme->btn_desk->a_focused_disabled->texture[0].type =
theme->btn_desk->a_unfocused_disabled->texture[0].type =
theme->btn_desk->a_focused_hover->texture[0].type =
theme->btn_desk->a_unfocused_hover->texture[0].type =
theme->btn_desk->a_focused_hover_toggled->texture[0].type =
theme->btn_desk->a_unfocused_hover_toggled->texture[0].type =
theme->btn_desk->a_focused_unpressed_toggled->texture[0].type =
theme->btn_desk->a_unfocused_unpressed_toggled->texture[0].type =
theme->btn_desk->a_focused_pressed_toggled->texture[0].type =
theme->btn_desk->a_unfocused_pressed_toggled->texture[0].type =
theme->btn_desk->a_focused_unpressed->texture[0].type =
theme->btn_desk->a_focused_pressed->texture[0].type =
theme->btn_desk->a_unfocused_unpressed->texture[0].type =
theme->btn_desk->a_unfocused_pressed->texture[0].type =
theme->btn_shade->a_focused_disabled->texture[0].type =
theme->btn_shade->a_unfocused_disabled->texture[0].type =
theme->btn_shade->a_focused_hover->texture[0].type =
theme->btn_shade->a_unfocused_hover->texture[0].type =
theme->btn_shade->a_focused_hover_toggled->texture[0].type =
theme->btn_shade->a_unfocused_hover_toggled->texture[0].type =
theme->btn_shade->a_focused_unpressed_toggled->texture[0].type =
theme->btn_shade->a_unfocused_unpressed_toggled->texture[0].type =
theme->btn_shade->a_focused_pressed_toggled->texture[0].type =
theme->btn_shade->a_unfocused_pressed_toggled->texture[0].type =
theme->btn_shade->a_focused_unpressed->texture[0].type =
theme->btn_shade->a_focused_pressed->texture[0].type =
theme->btn_shade->a_unfocused_unpressed->texture[0].type =
theme->btn_shade->a_unfocused_pressed->texture[0].type =
theme->btn_iconify->a_focused_disabled->texture[0].type =
theme->btn_iconify->a_unfocused_disabled->texture[0].type =
theme->btn_iconify->a_focused_hover->texture[0].type =
theme->btn_iconify->a_unfocused_hover->texture[0].type =
theme->btn_iconify->a_focused_unpressed->texture[0].type =
theme->btn_iconify->a_focused_pressed->texture[0].type =
theme->btn_iconify->a_unfocused_unpressed->texture[0].type =
theme->btn_iconify->a_unfocused_pressed->texture[0].type =
theme->a_menu_bullet_normal->texture[0].type =
theme->a_menu_bullet_normal->texture[0].type =
theme->a_menu_bullet_selected->texture[0].type = RR_TEXTURE_MASK;
theme->btn_max->a_focused_disabled->texture[0].data.mask.mask =
theme->btn_max->a_unfocused_disabled->texture[0].data.mask.mask =
theme->btn_max->disabled_mask;
theme->btn_max->a_focused_hover->texture[0].data.mask.mask =
theme->btn_max->a_unfocused_hover->texture[0].data.mask.mask =
theme->btn_max->hover_mask;
theme->btn_max->a_focused_pressed->texture[0].data.mask.mask =
theme->btn_max->a_unfocused_pressed->texture[0].data.mask.mask =
theme->btn_max->pressed_mask;
theme->btn_max->a_focused_unpressed->texture[0].data.mask.mask =
theme->btn_max->a_unfocused_unpressed->texture[0].data.mask.mask =
theme->btn_max->mask;
theme->btn_max->a_focused_hover_toggled->texture[0].data.mask.mask =
theme->btn_max->a_unfocused_hover_toggled->texture[0].data.mask.mask =
theme->btn_max->hover_toggled_mask;
theme->btn_max->a_focused_unpressed_toggled->texture[0].data.mask.mask =
theme->btn_max->a_unfocused_unpressed_toggled->
texture[0].data.mask.mask = theme->btn_max->toggled_mask;
theme->btn_max->a_focused_pressed_toggled->texture[0].data.mask.mask =
theme->btn_max->a_unfocused_pressed_toggled->texture[0].data.mask.mask
= theme->btn_max->pressed_toggled_mask;
theme->btn_close->a_focused_disabled->texture[0].data.mask.mask =
theme->btn_close->a_unfocused_disabled->texture[0].data.mask.mask =
theme->btn_close->disabled_mask;
theme->btn_close->a_focused_hover->texture[0].data.mask.mask =
theme->btn_close->a_unfocused_hover->texture[0].data.mask.mask =
theme->btn_close->hover_mask;
theme->btn_close->a_focused_pressed->texture[0].data.mask.mask =
theme->btn_close->a_unfocused_pressed->texture[0].data.mask.mask =
theme->btn_close->pressed_mask;
theme->btn_close->a_focused_unpressed->texture[0].data.mask.mask =
theme->btn_close->a_unfocused_unpressed->texture[0].data.mask.mask =
theme->btn_close->mask;
theme->btn_desk->a_focused_disabled->texture[0].data.mask.mask =
theme->btn_desk->a_unfocused_disabled->texture[0].data.mask.mask =
theme->btn_desk->disabled_mask;
theme->btn_desk->a_focused_hover->texture[0].data.mask.mask =
theme->btn_desk->a_unfocused_hover->texture[0].data.mask.mask =
theme->btn_desk->hover_mask;
theme->btn_desk->a_focused_pressed->texture[0].data.mask.mask =
theme->btn_desk->a_unfocused_pressed->texture[0].data.mask.mask =
theme->btn_desk->pressed_mask;
theme->btn_desk->a_focused_unpressed->texture[0].data.mask.mask =
theme->btn_desk->a_unfocused_unpressed->texture[0].data.mask.mask =
theme->btn_desk->mask;
theme->btn_desk->a_focused_hover_toggled->texture[0].data.mask.mask =
theme->btn_desk->a_unfocused_hover_toggled->texture[0].data.mask.mask =
theme->btn_desk->hover_toggled_mask;
theme->btn_desk->a_focused_unpressed_toggled->texture[0].data.mask.mask =
theme->btn_desk->a_unfocused_unpressed_toggled->
texture[0].data.mask.mask = theme->btn_desk->toggled_mask;
theme->btn_desk->a_focused_pressed_toggled->texture[0].data.mask.mask =
theme->btn_desk->a_unfocused_pressed_toggled->texture[0].data.mask.mask
= theme->btn_desk->pressed_toggled_mask;
theme->btn_shade->a_focused_disabled->texture[0].data.mask.mask =
theme->btn_shade->a_unfocused_disabled->texture[0].data.mask.mask =
theme->btn_shade->disabled_mask;
theme->btn_shade->a_focused_hover->texture[0].data.mask.mask =
theme->btn_shade->a_unfocused_hover->texture[0].data.mask.mask =
theme->btn_shade->hover_mask;
theme->btn_shade->a_focused_pressed->texture[0].data.mask.mask =
theme->btn_shade->a_unfocused_pressed->texture[0].data.mask.mask =
theme->btn_shade->pressed_mask;
theme->btn_shade->a_focused_unpressed->texture[0].data.mask.mask =
theme->btn_shade->a_unfocused_unpressed->texture[0].data.mask.mask =
theme->btn_shade->mask;
theme->btn_shade->a_focused_hover_toggled->texture[0].data.mask.mask =
theme->btn_shade->a_unfocused_hover_toggled->texture[0].data.mask.mask
= theme->btn_shade->hover_toggled_mask;
theme->btn_shade->a_focused_unpressed_toggled->texture[0].data.mask.mask =
theme->btn_shade->a_unfocused_unpressed_toggled->
texture[0].data.mask.mask = theme->btn_shade->toggled_mask;
theme->btn_shade->a_focused_pressed_toggled->texture[0].data.mask.mask =
theme->btn_shade->a_unfocused_pressed_toggled->
texture[0].data.mask.mask = theme->btn_shade->pressed_toggled_mask;
theme->btn_iconify->a_focused_disabled->texture[0].data.mask.mask =
theme->btn_iconify->a_unfocused_disabled->texture[0].data.mask.mask =
theme->btn_iconify->disabled_mask;
theme->btn_iconify->a_focused_hover->texture[0].data.mask.mask =
theme->btn_iconify->a_unfocused_hover->texture[0].data.mask.mask =
theme->btn_iconify->hover_mask;
theme->btn_iconify->a_focused_pressed->texture[0].data.mask.mask =
theme->btn_iconify->a_unfocused_pressed->texture[0].data.mask.mask =
theme->btn_iconify->pressed_mask;
theme->btn_iconify->a_focused_unpressed->texture[0].data.mask.mask =
theme->btn_iconify->a_unfocused_unpressed->texture[0].data.mask.mask =
theme->btn_iconify->mask;
theme->a_menu_bullet_normal->texture[0].data.mask.mask =
theme->a_menu_bullet_selected->texture[0].data.mask.mask =
theme->menu_bullet_mask;
theme->btn_max->a_focused_disabled->texture[0].data.mask.color =
theme->btn_max->focused_disabled_color;
theme->btn_close->a_focused_disabled->texture[0].data.mask.color =
theme->btn_close->focused_disabled_color;
theme->btn_desk->a_focused_disabled->texture[0].data.mask.color =
theme->btn_desk->focused_disabled_color;
theme->btn_shade->a_focused_disabled->texture[0].data.mask.color =
theme->btn_shade->focused_disabled_color;
theme->btn_iconify->a_focused_disabled->texture[0].data.mask.color =
theme->btn_iconify->focused_disabled_color;
theme->btn_max->a_unfocused_disabled->texture[0].data.mask.color =
theme->btn_max->unfocused_disabled_color;
theme->btn_close->a_unfocused_disabled->texture[0].data.mask.color =
theme->btn_close->unfocused_disabled_color;
theme->btn_desk->a_unfocused_disabled->texture[0].data.mask.color =
theme->btn_desk->unfocused_disabled_color;
theme->btn_shade->a_unfocused_disabled->texture[0].data.mask.color =
theme->btn_shade->unfocused_disabled_color;
theme->btn_iconify->a_unfocused_disabled->texture[0].data.mask.color =
theme->btn_iconify->unfocused_disabled_color;
theme->btn_max->a_focused_hover->texture[0].data.mask.color =
theme->btn_max->focused_hover_color;
theme->btn_close->a_focused_hover->texture[0].data.mask.color =
theme->btn_close->focused_hover_color;
theme->btn_desk->a_focused_hover->texture[0].data.mask.color =
theme->btn_desk->focused_hover_color;
theme->btn_shade->a_focused_hover->texture[0].data.mask.color =
theme->btn_shade->focused_hover_color;
theme->btn_iconify->a_focused_hover->texture[0].data.mask.color =
theme->btn_iconify->focused_hover_color;
theme->btn_max->a_unfocused_hover->texture[0].data.mask.color =
theme->btn_max->unfocused_hover_color;
theme->btn_close->a_unfocused_hover->texture[0].data.mask.color =
theme->btn_close->unfocused_hover_color;
theme->btn_desk->a_unfocused_hover->texture[0].data.mask.color =
theme->btn_desk->unfocused_hover_color;
theme->btn_shade->a_unfocused_hover->texture[0].data.mask.color =
theme->btn_shade->unfocused_hover_color;
theme->btn_iconify->a_unfocused_hover->texture[0].data.mask.color =
theme->btn_iconify->unfocused_hover_color;
theme->btn_max->a_focused_hover_toggled->texture[0].data.mask.color =
theme->btn_max->focused_hover_toggled_color;
theme->btn_desk->a_focused_hover_toggled->texture[0].data.mask.color =
theme->btn_desk->focused_hover_toggled_color;
theme->btn_shade->a_focused_hover_toggled->texture[0].data.mask.color =
theme->btn_shade->focused_hover_toggled_color;
theme->btn_max->a_unfocused_hover_toggled->texture[0].data.mask.color =
theme->btn_max->unfocused_hover_toggled_color;
theme->btn_desk->a_unfocused_hover_toggled->texture[0].data.mask.color =
theme->btn_desk->unfocused_hover_toggled_color;
theme->btn_shade->a_unfocused_hover_toggled->texture[0].data.mask.color =
theme->btn_shade->unfocused_hover_toggled_color;
theme->btn_max->a_focused_unpressed_toggled->texture[0].data.mask.color =
theme->btn_max->focused_unpressed_toggled_color;
theme->btn_desk->a_focused_unpressed_toggled->texture[0].data.mask.color =
theme->btn_desk->focused_unpressed_toggled_color;
theme->btn_shade->a_focused_unpressed_toggled->texture[0].data.mask.color =
theme->btn_shade->focused_unpressed_toggled_color;
theme->btn_max->a_unfocused_unpressed_toggled->texture[0].data.mask.color =
theme->btn_max->unfocused_unpressed_toggled_color;
theme->btn_desk->a_unfocused_unpressed_toggled->texture[0].data.mask.color
= theme->btn_desk->unfocused_unpressed_toggled_color;
theme->btn_shade->a_unfocused_unpressed_toggled->texture[0].data.mask.color
= theme->btn_shade->unfocused_unpressed_toggled_color;
theme->btn_max->a_focused_pressed_toggled->texture[0].data.mask.color =
theme->btn_max->focused_pressed_toggled_color;
theme->btn_desk->a_focused_pressed_toggled->texture[0].data.mask.color =
theme->btn_desk->focused_pressed_toggled_color;
theme->btn_shade->a_focused_pressed_toggled->texture[0].data.mask.color =
theme->btn_shade->focused_pressed_toggled_color;
theme->btn_max->a_unfocused_pressed_toggled->texture[0].data.mask.color =
theme->btn_max->unfocused_pressed_toggled_color;
theme->btn_desk->a_unfocused_pressed_toggled->texture[0].data.mask.color =
theme->btn_desk->unfocused_pressed_toggled_color;
theme->btn_shade->a_unfocused_pressed_toggled->texture[0].data.mask.color =
theme->btn_shade->unfocused_pressed_toggled_color;
theme->btn_max->a_focused_unpressed->texture[0].data.mask.color =
theme->btn_max->focused_unpressed_color;
theme->btn_close->a_focused_unpressed->texture[0].data.mask.color =
theme->btn_close->focused_unpressed_color;
theme->btn_desk->a_focused_unpressed->texture[0].data.mask.color =
theme->btn_desk->focused_unpressed_color;
theme->btn_shade->a_focused_unpressed->texture[0].data.mask.color =
theme->btn_shade->focused_unpressed_color;
theme->btn_iconify->a_focused_unpressed->texture[0].data.mask.color =
theme->btn_iconify->focused_unpressed_color;
theme->btn_max->a_focused_pressed->texture[0].data.mask.color =
theme->btn_max->focused_pressed_color;
theme->btn_close->a_focused_pressed->texture[0].data.mask.color =
theme->btn_close->focused_pressed_color;
theme->btn_desk->a_focused_pressed->texture[0].data.mask.color =
theme->btn_desk->focused_pressed_color;
theme->btn_shade->a_focused_pressed->texture[0].data.mask.color =
theme->btn_shade->focused_pressed_color;
theme->btn_iconify->a_focused_pressed->texture[0].data.mask.color =
theme->btn_iconify->focused_pressed_color;
theme->btn_max->a_unfocused_unpressed->texture[0].data.mask.color =
theme->btn_max->unfocused_unpressed_color;
theme->btn_close->a_unfocused_unpressed->texture[0].data.mask.color =
theme->btn_close->unfocused_unpressed_color;
theme->btn_desk->a_unfocused_unpressed->texture[0].data.mask.color =
theme->btn_desk->unfocused_unpressed_color;
theme->btn_shade->a_unfocused_unpressed->texture[0].data.mask.color =
theme->btn_shade->unfocused_unpressed_color;
theme->btn_iconify->a_unfocused_unpressed->texture[0].data.mask.color =
theme->btn_iconify->unfocused_unpressed_color;
theme->btn_max->a_unfocused_pressed->texture[0].data.mask.color =
theme->btn_max->unfocused_pressed_color;
theme->btn_close->a_unfocused_pressed->texture[0].data.mask.color =
theme->btn_close->unfocused_pressed_color;
theme->btn_desk->a_unfocused_pressed->texture[0].data.mask.color =
theme->btn_desk->unfocused_pressed_color;
theme->btn_shade->a_unfocused_pressed->texture[0].data.mask.color =
theme->btn_shade->unfocused_pressed_color;
theme->btn_iconify->a_unfocused_pressed->texture[0].data.mask.color =
theme->btn_iconify->unfocused_pressed_color;
theme->a_menu_bullet_normal->texture[0].data.mask.color =
theme->menu_bullet_color;
theme->a_menu_bullet_selected->texture[0].data.mask.color =
@ -1338,10 +1060,7 @@ void RrThemeFree(RrTheme *theme)
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);
RrColorFree(theme->menu_text_disabled_shadow_color);
RrColorFree(theme->menu_text_disabled_selected_shadow_color);
RrColorFree(theme->menu_text_shadow_color);
g_free(theme->def_win_icon);
@ -1754,29 +1473,29 @@ static void read_button_styles(XrmDatabase db, const RrInstance *inst,
gboolean userdef = TRUE;
g_snprintf(name, 128, "%s.xbm", btnname);
if (!read_mask(inst, path, name, &btn->mask) && normal_mask)
if (!read_mask(inst, path, name, &btn->unpressed_mask) && normal_mask)
{
btn->mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)normal_mask);
btn->unpressed_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)normal_mask);
userdef = FALSE;
}
g_snprintf(name, 128, "%s_toggled.xbm", btnname);
if (toggled_mask && !read_mask(inst, path, name, &btn->toggled_mask))
if (toggled_mask && !read_mask(inst, path, name, &btn->unpressed_toggled_mask))
{
if (userdef)
btn->toggled_mask = RrPixmapMaskCopy(btn->mask);
else if (toggled_mask)
btn->toggled_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)toggled_mask);
btn->unpressed_toggled_mask = RrPixmapMaskCopy(btn->unpressed_mask);
else
btn->unpressed_toggled_mask = RrPixmapMaskNew(inst, 6, 6, (gchar*)toggled_mask);
}
#define READ_BUTTON_MASK_COPY(type, fallback) \
g_snprintf(name, 128, "%s_" #type ".xbm", btnname); \
READ_MASK_COPY(name, btn->type##_mask, fallback);
READ_BUTTON_MASK_COPY(pressed, btn->mask);
READ_BUTTON_MASK_COPY(disabled, btn->mask);
READ_BUTTON_MASK_COPY(hover, btn->mask);
READ_BUTTON_MASK_COPY(pressed, btn->unpressed_mask);
READ_BUTTON_MASK_COPY(disabled, btn->unpressed_mask);
READ_BUTTON_MASK_COPY(hover, btn->unpressed_mask);
if (toggled_mask) {
READ_BUTTON_MASK_COPY(pressed_toggled, btn->toggled_mask);
READ_BUTTON_MASK_COPY(hover_toggled, btn->toggled_mask);
READ_BUTTON_MASK_COPY(pressed_toggled, btn->unpressed_toggled_mask);
READ_BUTTON_MASK_COPY(hover_toggled, btn->unpressed_toggled_mask);
}
#define READ_BUTTON_APPEARANCE(typedots, type, fallback) \
@ -1796,7 +1515,17 @@ static void read_button_styles(XrmDatabase db, const RrInstance *inst,
READ_APPEARANCE_COPY(name, btn->a_focused_##type, TRUE, fbs->focused_##type); \
g_snprintf(name, 128, "window.inactive.button.%s." typedots ".bg", btnname); \
READ_APPEARANCE_COPY(name, btn->a_unfocused_##type, TRUE, fbs->unfocused_##type); \
}
} \
btn->a_unfocused_##type->texture[0].typ##e = \
btn->a_focused_##type->texture[0].typ##e = \
RR_TEXTURE_MASK; \
btn->a_unfocused_##type->texture[0].data.mask.mask = \
btn->a_focused_##type->texture[0].data.mask.mask = \
btn->type##_mask; \
btn->a_unfocused_##type->texture[0].data.mask.color = \
btn->unfocused_##type##_color; \
btn->a_focused_##type->texture[0].data.mask.color = \
btn->focused_##type##_color;
READ_BUTTON_APPEARANCE("unpressed", unpressed, 0);
READ_BUTTON_APPEARANCE("pressed", pressed, 0);

View file

@ -114,15 +114,7 @@ struct _RrTheme {
RrColor *osd_pressed_lineart;
RrColor *osd_focused_lineart;
RrColor *menu_title_shadow_color;
gchar menu_title_shadow_alpha;
RrColor *menu_text_normal_shadow_color;
gchar menu_text_normal_shadow_alpha;
RrColor *menu_text_selected_shadow_color;
gchar menu_text_selected_shadow_alpha;
RrColor *menu_text_disabled_shadow_color;
gchar menu_text_disabled_shadow_alpha;
RrColor *menu_text_disabled_selected_shadow_color;
gchar menu_text_disabled_selected_shadow_alpha;
RrColor *menu_text_shadow_color;
/* style settings - pics */
RrPixel32 *def_win_icon; /* RGBA */

View file

@ -276,7 +276,7 @@ static gboolean send_to_menu_update(ObMenuFrame *frame, gpointer data)
if ((desk == DESKTOP_ALL && c->desktop != DESKTOP_ALL) ||
(c->desktop == DESKTOP_ALL && desk == screen_desktop))
{
e->data.normal.mask = ob_rr_theme->btn_desk->mask;
e->data.normal.mask = ob_rr_theme->btn_desk->unpressed_mask;
set_icon_color(e);
} else
e->data.normal.mask = NULL;
@ -392,7 +392,7 @@ void client_menu_startup(void)
menu_add_submenu(menu, CLIENT_LAYER, LAYER_MENU_NAME);
e = menu_add_normal(menu, CLIENT_RESTORE, _("R_estore"), NULL, TRUE);
e->data.normal.mask = ob_rr_theme->btn_max->toggled_mask;
e->data.normal.mask = ob_rr_theme->btn_max->unpressed_toggled_mask;
set_icon_color(e);
menu_add_normal(menu, CLIENT_MOVE, _("_Move"), NULL, TRUE);
@ -400,15 +400,15 @@ void client_menu_startup(void)
menu_add_normal(menu, CLIENT_RESIZE, _("Resi_ze"), NULL, TRUE);
e = menu_add_normal(menu, CLIENT_ICONIFY, _("Ico_nify"), NULL, TRUE);
e->data.normal.mask = ob_rr_theme->btn_iconify->mask;
e->data.normal.mask = ob_rr_theme->btn_iconify->unpressed_mask;
set_icon_color(e);
e = menu_add_normal(menu, CLIENT_MAXIMIZE, _("Ma_ximize"), NULL, TRUE);
e->data.normal.mask = ob_rr_theme->btn_max->mask;
e->data.normal.mask = ob_rr_theme->btn_max->unpressed_mask;
set_icon_color(e);
e = menu_add_normal(menu, CLIENT_SHADE, _("_Roll up/down"), NULL, TRUE);
e->data.normal.mask = ob_rr_theme->btn_shade->mask;
e->data.normal.mask = ob_rr_theme->btn_shade->unpressed_mask;
set_icon_color(e);
menu_add_normal(menu, CLIENT_DECORATE, _("Un/_Decorate"), NULL, TRUE);
@ -416,6 +416,6 @@ void client_menu_startup(void)
menu_add_separator(menu, -1, NULL);
e = menu_add_normal(menu, CLIENT_CLOSE, _("_Close"), NULL, TRUE);
e->data.normal.mask = ob_rr_theme->btn_close->mask;
e->data.normal.mask = ob_rr_theme->btn_close->unpressed_mask;
set_icon_color(e);
}