Reduce length of theme.c a bit

This commit is contained in:
Mikael Magnusson 2014-11-05 13:22:56 +01:00
parent 10c276c6c2
commit 35e92e4c2a
5 changed files with 499 additions and 840 deletions

View file

@ -37,16 +37,16 @@ RrButton *RrButtonNew (const RrInstance *inst)
out->unfocused_unpressed_color = NULL;
out->focused_pressed_color = NULL;
out->unfocused_pressed_color = NULL;
out->disabled_focused_color = NULL;
out->disabled_unfocused_color = NULL;
out->hover_focused_color = NULL;
out->hover_unfocused_color = NULL;
out->toggled_hover_focused_color = NULL;
out->toggled_hover_unfocused_color = NULL;
out->toggled_focused_pressed_color = NULL;
out->toggled_unfocused_pressed_color = NULL;
out->toggled_focused_unpressed_color = NULL;
out->toggled_unfocused_unpressed_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;
@ -54,24 +54,24 @@ RrButton *RrButtonNew (const RrInstance *inst)
out->disabled_mask = NULL;
out->hover_mask = NULL;
out->toggled_mask = NULL;
out->toggled_hover_mask = NULL;
out->toggled_pressed_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);
out->a_focused_pressed = RrAppearanceNew(inst, 1);
out->a_unfocused_pressed = RrAppearanceNew(inst, 1);
out->a_disabled_focused = RrAppearanceNew(inst, 1);
out->a_disabled_unfocused = RrAppearanceNew(inst, 1);
out->a_hover_focused = RrAppearanceNew(inst, 1);
out->a_hover_unfocused = RrAppearanceNew(inst, 1);
out->a_toggled_focused_unpressed = RrAppearanceNew(inst, 1);
out->a_toggled_unfocused_unpressed = RrAppearanceNew(inst, 1);
out->a_toggled_focused_pressed = RrAppearanceNew(inst, 1);
out->a_toggled_unfocused_pressed = RrAppearanceNew(inst, 1);
out->a_toggled_hover_focused = RrAppearanceNew(inst, 1);
out->a_toggled_hover_unfocused = RrAppearanceNew(inst, 1);
out->a_focused_disabled = RrAppearanceNew(inst, 1);
out->a_unfocused_disabled = RrAppearanceNew(inst, 1);
out->a_focused_hover = RrAppearanceNew(inst, 1);
out->a_unfocused_hover = RrAppearanceNew(inst, 1);
out->a_focused_unpressed_toggled = RrAppearanceNew(inst, 1);
out->a_unfocused_unpressed_toggled = RrAppearanceNew(inst, 1);
out->a_focused_pressed_toggled = RrAppearanceNew(inst, 1);
out->a_unfocused_pressed_toggled = RrAppearanceNew(inst, 1);
out->a_focused_hover_toggled = RrAppearanceNew(inst, 1);
out->a_unfocused_hover_toggled = RrAppearanceNew(inst, 1);
return out;
}
@ -87,26 +87,26 @@ void RrButtonFree(RrButton *b)
RrColorFree(b->focused_pressed_color);
if (b->unfocused_pressed_color)
RrColorFree(b->unfocused_pressed_color);
if (b->disabled_focused_color)
RrColorFree(b->disabled_focused_color);
if (b->disabled_unfocused_color)
RrColorFree(b->disabled_unfocused_color);
if (b->hover_focused_color)
RrColorFree(b->hover_focused_color);
if (b->hover_unfocused_color)
RrColorFree(b->hover_unfocused_color);
if (b->toggled_hover_focused_color)
RrColorFree(b->toggled_hover_focused_color);
if (b->toggled_hover_unfocused_color)
RrColorFree(b->toggled_hover_unfocused_color);
if (b->toggled_focused_pressed_color)
RrColorFree(b->toggled_focused_pressed_color);
if (b->toggled_unfocused_pressed_color)
RrColorFree(b->toggled_unfocused_pressed_color);
if (b->toggled_focused_unpressed_color)
RrColorFree(b->toggled_focused_unpressed_color);
if (b->toggled_unfocused_unpressed_color)
RrColorFree(b->toggled_unfocused_unpressed_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);
/* masks */
if (b->mask) RrPixmapMaskFree(b->mask);
@ -114,22 +114,22 @@ void RrButtonFree(RrButton *b)
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->toggled_hover_mask) RrPixmapMaskFree(b->toggled_hover_mask);
if (b->toggled_pressed_mask) RrPixmapMaskFree(b->toggled_pressed_mask);
if (b->hover_toggled_mask) RrPixmapMaskFree(b->hover_toggled_mask);
if (b->pressed_toggled_mask) RrPixmapMaskFree(b->pressed_toggled_mask);
/* appearances */
RrAppearanceFree(b->a_focused_unpressed);
RrAppearanceFree(b->a_unfocused_unpressed);
RrAppearanceFree(b->a_focused_pressed);
RrAppearanceFree(b->a_unfocused_pressed);
RrAppearanceFree(b->a_disabled_focused);
RrAppearanceFree(b->a_disabled_unfocused);
RrAppearanceFree(b->a_hover_focused);
RrAppearanceFree(b->a_hover_unfocused);
RrAppearanceFree(b->a_toggled_focused_unpressed);
RrAppearanceFree(b->a_toggled_unfocused_unpressed);
RrAppearanceFree(b->a_toggled_focused_pressed);
RrAppearanceFree(b->a_toggled_unfocused_pressed);
RrAppearanceFree(b->a_toggled_hover_focused);
RrAppearanceFree(b->a_toggled_hover_unfocused);
RrAppearanceFree(b->a_focused_disabled);
RrAppearanceFree(b->a_unfocused_disabled);
RrAppearanceFree(b->a_focused_hover);
RrAppearanceFree(b->a_unfocused_hover);
RrAppearanceFree(b->a_focused_unpressed_toggled);
RrAppearanceFree(b->a_unfocused_unpressed_toggled);
RrAppearanceFree(b->a_focused_pressed_toggled);
RrAppearanceFree(b->a_unfocused_pressed_toggled);
RrAppearanceFree(b->a_focused_hover_toggled);
RrAppearanceFree(b->a_unfocused_hover_toggled);
}

View file

@ -295,16 +295,16 @@ struct _RrButton {
RrColor *unfocused_unpressed_color;
RrColor *focused_pressed_color;
RrColor *unfocused_pressed_color;
RrColor *disabled_focused_color;
RrColor *disabled_unfocused_color;
RrColor *hover_focused_color;
RrColor *hover_unfocused_color;
RrColor *toggled_hover_focused_color;
RrColor *toggled_hover_unfocused_color;
RrColor *toggled_focused_pressed_color;
RrColor *toggled_unfocused_pressed_color;
RrColor *toggled_focused_unpressed_color;
RrColor *toggled_unfocused_unpressed_color;
RrColor *focused_disabled_color;
RrColor *unfocused_disabled_color;
RrColor *focused_hover_color;
RrColor *unfocused_hover_color;
RrColor *focused_hover_toggled_color;
RrColor *unfocused_hover_toggled_color;
RrColor *focused_pressed_toggled_color;
RrColor *unfocused_pressed_toggled_color;
RrColor *focused_unpressed_toggled_color;
RrColor *unfocused_unpressed_toggled_color;
/* masks */
RrPixmapMask *mask;
@ -312,24 +312,24 @@ struct _RrButton {
RrPixmapMask *disabled_mask;
RrPixmapMask *hover_mask;
RrPixmapMask *toggled_mask;
RrPixmapMask *toggled_hover_mask;
RrPixmapMask *toggled_pressed_mask;
RrPixmapMask *hover_toggled_mask;
RrPixmapMask *pressed_toggled_mask;
/* textures */
RrAppearance *a_focused_unpressed;
RrAppearance *a_unfocused_unpressed;
RrAppearance *a_focused_pressed;
RrAppearance *a_unfocused_pressed;
RrAppearance *a_disabled_focused;
RrAppearance *a_disabled_unfocused;
RrAppearance *a_hover_focused;
RrAppearance *a_hover_unfocused;
RrAppearance *a_toggled_focused_unpressed;
RrAppearance *a_toggled_unfocused_unpressed;
RrAppearance *a_toggled_focused_pressed;
RrAppearance *a_toggled_unfocused_pressed;
RrAppearance *a_toggled_hover_focused;
RrAppearance *a_toggled_hover_unfocused;
RrAppearance *a_focused_disabled;
RrAppearance *a_unfocused_disabled;
RrAppearance *a_focused_hover;
RrAppearance *a_unfocused_hover;
RrAppearance *a_focused_unpressed_toggled;
RrAppearance *a_unfocused_unpressed_toggled;
RrAppearance *a_focused_pressed_toggled;
RrAppearance *a_unfocused_pressed_toggled;
RrAppearance *a_focused_hover_toggled;
RrAppearance *a_unfocused_hover_toggled;
};

File diff suppressed because it is too large Load diff

View file

@ -76,16 +76,16 @@ struct _RrTheme {
RrColor *cb_unfocused_color;
RrColor *title_focused_color;
RrColor *title_unfocused_color;
RrColor *titlebut_disabled_focused_color;
RrColor *titlebut_disabled_unfocused_color;
RrColor *titlebut_hover_focused_color;
RrColor *titlebut_hover_unfocused_color;
RrColor *titlebut_toggled_hover_focused_color;
RrColor *titlebut_toggled_hover_unfocused_color;
RrColor *titlebut_toggled_focused_pressed_color;
RrColor *titlebut_toggled_unfocused_pressed_color;
RrColor *titlebut_toggled_focused_unpressed_color;
RrColor *titlebut_toggled_unfocused_unpressed_color;
RrColor *titlebut_focused_disabled_color;
RrColor *titlebut_unfocused_disabled_color;
RrColor *titlebut_focused_hover_color;
RrColor *titlebut_unfocused_hover_color;
RrColor *titlebut_focused_hover_toggled_color;
RrColor *titlebut_unfocused_hover_toggled_color;
RrColor *titlebut_focused_pressed_toggled_color;
RrColor *titlebut_unfocused_pressed_toggled_color;
RrColor *titlebut_focused_unpressed_toggled_color;
RrColor *titlebut_unfocused_unpressed_toggled_color;
RrColor *titlebut_focused_pressed_color;
RrColor *titlebut_unfocused_pressed_color;
RrColor *titlebut_focused_unpressed_color;

View file

@ -131,115 +131,115 @@ void framerender_frame(ObFrame *self)
t = ob_rr_theme->a_focused_title;
l = ob_rr_theme->a_focused_label;
m = (!(self->decorations & OB_FRAME_DECOR_MAXIMIZE) ?
ob_rr_theme->btn_max->a_disabled_focused :
ob_rr_theme->btn_max->a_focused_disabled :
(self->client->max_vert || self->client->max_horz ?
(self->max_press ?
ob_rr_theme->btn_max->a_toggled_focused_pressed :
ob_rr_theme->btn_max->a_focused_pressed_toggled :
(self->max_hover ?
ob_rr_theme->btn_max->a_toggled_hover_focused :
ob_rr_theme->btn_max->a_toggled_focused_unpressed)) :
ob_rr_theme->btn_max->a_focused_hover_toggled :
ob_rr_theme->btn_max->a_focused_unpressed_toggled)) :
(self->max_press ?
ob_rr_theme->btn_max->a_focused_pressed :
(self->max_hover ?
ob_rr_theme->btn_max->a_hover_focused :
ob_rr_theme->btn_max->a_focused_hover :
ob_rr_theme->btn_max->a_focused_unpressed))));
n = ob_rr_theme->a_icon;
i = (!(self->decorations & OB_FRAME_DECOR_ICONIFY) ?
ob_rr_theme->btn_iconify->a_disabled_focused :
ob_rr_theme->btn_iconify->a_focused_disabled :
(self->iconify_press ?
ob_rr_theme->btn_iconify->a_focused_pressed :
(self->iconify_hover ?
ob_rr_theme->btn_iconify->a_hover_focused :
ob_rr_theme->btn_iconify->a_focused_hover :
ob_rr_theme->btn_iconify->a_focused_unpressed)));
d = (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) ?
ob_rr_theme->btn_desk->a_disabled_focused :
ob_rr_theme->btn_desk->a_focused_disabled :
(self->client->desktop == DESKTOP_ALL ?
(self->desk_press ?
ob_rr_theme->btn_desk->a_toggled_focused_pressed :
ob_rr_theme->btn_desk->a_focused_pressed_toggled :
(self->desk_hover ?
ob_rr_theme->btn_desk->a_toggled_hover_focused :
ob_rr_theme->btn_desk->a_toggled_focused_unpressed)) :
ob_rr_theme->btn_desk->a_focused_hover_toggled :
ob_rr_theme->btn_desk->a_focused_unpressed_toggled)) :
(self->desk_press ?
ob_rr_theme->btn_desk->a_focused_pressed :
(self->desk_hover ?
ob_rr_theme->btn_desk->a_hover_focused :
ob_rr_theme->btn_desk->a_focused_hover :
ob_rr_theme->btn_desk->a_focused_unpressed))));
s = (!(self->decorations & OB_FRAME_DECOR_SHADE) ?
ob_rr_theme->btn_shade->a_disabled_focused :
ob_rr_theme->btn_shade->a_focused_disabled :
(self->client->shaded ?
(self->shade_press ?
ob_rr_theme->btn_shade->a_toggled_focused_pressed :
ob_rr_theme->btn_shade->a_focused_pressed_toggled :
(self->shade_hover ?
ob_rr_theme->btn_shade->a_toggled_hover_focused :
ob_rr_theme->btn_shade->a_toggled_focused_unpressed)) :
ob_rr_theme->btn_shade->a_focused_hover_toggled :
ob_rr_theme->btn_shade->a_focused_unpressed_toggled)) :
(self->shade_press ?
ob_rr_theme->btn_shade->a_focused_pressed :
(self->shade_hover ?
ob_rr_theme->btn_shade->a_hover_focused :
ob_rr_theme->btn_shade->a_focused_hover :
ob_rr_theme->btn_shade->a_focused_unpressed))));
c = (!(self->decorations & OB_FRAME_DECOR_CLOSE) ?
ob_rr_theme->btn_close->a_disabled_focused :
ob_rr_theme->btn_close->a_focused_disabled :
(self->close_press ?
ob_rr_theme->btn_close->a_focused_pressed :
(self->close_hover ?
ob_rr_theme->btn_close->a_hover_focused :
ob_rr_theme->btn_close->a_focused_hover :
ob_rr_theme->btn_close->a_focused_unpressed)));
} else {
t = ob_rr_theme->a_unfocused_title;
l = ob_rr_theme->a_unfocused_label;
m = (!(self->decorations & OB_FRAME_DECOR_MAXIMIZE) ?
ob_rr_theme->btn_max->a_disabled_unfocused :
ob_rr_theme->btn_max->a_unfocused_disabled :
(self->client->max_vert || self->client->max_horz ?
(self->max_press ?
ob_rr_theme->btn_max->a_toggled_unfocused_pressed :
ob_rr_theme->btn_max->a_unfocused_pressed_toggled :
(self->max_hover ?
ob_rr_theme->btn_max->a_toggled_hover_unfocused :
ob_rr_theme->btn_max->a_toggled_unfocused_unpressed)) :
ob_rr_theme->btn_max->a_unfocused_hover_toggled :
ob_rr_theme->btn_max->a_unfocused_unpressed_toggled)) :
(self->max_press ?
ob_rr_theme->btn_max->a_unfocused_pressed :
(self->max_hover ?
ob_rr_theme->btn_max->a_hover_unfocused :
ob_rr_theme->btn_max->a_unfocused_hover :
ob_rr_theme->btn_max->a_unfocused_unpressed))));
n = ob_rr_theme->a_icon;
i = (!(self->decorations & OB_FRAME_DECOR_ICONIFY) ?
ob_rr_theme->btn_iconify->a_disabled_unfocused :
ob_rr_theme->btn_iconify->a_unfocused_disabled :
(self->iconify_press ?
ob_rr_theme->btn_iconify->a_unfocused_pressed :
(self->iconify_hover ?
ob_rr_theme->btn_iconify->a_hover_unfocused :
ob_rr_theme->btn_iconify->a_unfocused_hover :
ob_rr_theme->btn_iconify->a_unfocused_unpressed)));
d = (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) ?
ob_rr_theme->btn_desk->a_disabled_unfocused :
ob_rr_theme->btn_desk->a_unfocused_disabled :
(self->client->desktop == DESKTOP_ALL ?
(self->desk_press ?
ob_rr_theme->btn_desk->a_toggled_unfocused_pressed :
ob_rr_theme->btn_desk->a_unfocused_pressed_toggled :
(self->desk_hover ?
ob_rr_theme->btn_desk->a_toggled_hover_unfocused :
ob_rr_theme->btn_desk->a_toggled_unfocused_unpressed)) :
ob_rr_theme->btn_desk->a_unfocused_hover_toggled :
ob_rr_theme->btn_desk->a_unfocused_unpressed_toggled)) :
(self->desk_press ?
ob_rr_theme->btn_desk->a_unfocused_pressed :
(self->desk_hover ?
ob_rr_theme->btn_desk->a_hover_unfocused :
ob_rr_theme->btn_desk->a_unfocused_hover :
ob_rr_theme->btn_desk->a_unfocused_unpressed))));
s = (!(self->decorations & OB_FRAME_DECOR_SHADE) ?
ob_rr_theme->btn_shade->a_disabled_unfocused :
ob_rr_theme->btn_shade->a_unfocused_disabled :
(self->client->shaded ?
(self->shade_press ?
ob_rr_theme->btn_shade->a_toggled_unfocused_pressed :
ob_rr_theme->btn_shade->a_unfocused_pressed_toggled :
(self->shade_hover ?
ob_rr_theme->btn_shade->a_toggled_hover_unfocused :
ob_rr_theme->btn_shade->a_toggled_unfocused_unpressed)) :
ob_rr_theme->btn_shade->a_unfocused_hover_toggled :
ob_rr_theme->btn_shade->a_unfocused_unpressed_toggled)) :
(self->shade_press ?
ob_rr_theme->btn_shade->a_unfocused_pressed :
(self->shade_hover ?
ob_rr_theme->btn_shade->a_hover_unfocused :
ob_rr_theme->btn_shade->a_unfocused_hover :
ob_rr_theme->btn_shade->a_unfocused_unpressed))));
c = (!(self->decorations & OB_FRAME_DECOR_CLOSE) ?
ob_rr_theme->btn_close->a_disabled_unfocused :
ob_rr_theme->btn_close->a_unfocused_disabled :
(self->close_press ?
ob_rr_theme->btn_close->a_unfocused_pressed :
(self->close_hover ?
ob_rr_theme->btn_close->a_hover_unfocused :
ob_rr_theme->btn_close->a_unfocused_hover :
ob_rr_theme->btn_close->a_unfocused_unpressed)));
}
clear = ob_rr_theme->a_clear;