mirror of
https://github.com/labwc/labwc.git
synced 2026-03-06 01:40:15 -05:00
theme: add option window.button.hover.bg.color
This commit is contained in:
parent
4f8b80700e
commit
54554f43dd
4 changed files with 24 additions and 5 deletions
|
|
@ -173,6 +173,18 @@ window.*.title.bg.colorTo.splitTo: #557485
|
||||||
Space between titlebar buttons, in pixels.
|
Space between titlebar buttons, in pixels.
|
||||||
Default is 0.
|
Default is 0.
|
||||||
|
|
||||||
|
Note: The *window.button.hover* namespace (below) relates to button hover
|
||||||
|
overlay effects which work with all buttons including svg, png and xbm.
|
||||||
|
|
||||||
|
Openbox only supports hover effects rendered behind buttons which makes sense
|
||||||
|
for the xbm format, but not for others. For reference, these are defined by
|
||||||
|
*window.active|inactive.button.STATE.bg* where *STATE* can be any of *pressed*,
|
||||||
|
*hover* and *disabled*. These are not (yet) supported by labwc and are mentioned
|
||||||
|
here for comparison only.
|
||||||
|
|
||||||
|
*window.button.hover.bg.color*
|
||||||
|
Color of the hover effect of a titlebar button. Default is #80808020.
|
||||||
|
|
||||||
*window.button.hover.bg.corner-radius*
|
*window.button.hover.bg.corner-radius*
|
||||||
Radius of the hover effect of a titlebar button, in pixels.
|
Radius of the hover effect of a titlebar button, in pixels.
|
||||||
Default is 0.
|
Default is 0.
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@ window.button.width: 26
|
||||||
window.button.height: 26
|
window.button.height: 26
|
||||||
window.button.spacing: 0
|
window.button.spacing: 0
|
||||||
|
|
||||||
# window button hover effect
|
# window button hover overlay
|
||||||
|
window.button.hover.bg.color: #80808020
|
||||||
window.button.hover.bg.corner-radius: 0
|
window.button.hover.bg.corner-radius: 0
|
||||||
|
|
||||||
# window buttons
|
# window buttons
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,8 @@ struct theme {
|
||||||
int window_button_height;
|
int window_button_height;
|
||||||
int window_button_spacing;
|
int window_button_spacing;
|
||||||
|
|
||||||
/* the corner radius of the hover effect */
|
/* button hover effect */
|
||||||
|
float window_button_hover_bg_color[4];
|
||||||
int window_button_hover_bg_corner_radius;
|
int window_button_hover_bg_corner_radius;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
11
src/theme.c
11
src/theme.c
|
|
@ -76,9 +76,7 @@ zdrop(struct lab_data_buffer **buffer)
|
||||||
static void
|
static void
|
||||||
draw_hover_overlay_on_button(cairo_t *cairo, int w, int h)
|
draw_hover_overlay_on_button(cairo_t *cairo, int w, int h)
|
||||||
{
|
{
|
||||||
/* Overlay (pre-multiplied alpha) */
|
set_cairo_color(cairo, rc.theme->window_button_hover_bg_color);
|
||||||
float overlay_color[4] = { 0.15f, 0.15f, 0.15f, 0.3f};
|
|
||||||
set_cairo_color(cairo, overlay_color);
|
|
||||||
int r = rc.theme->window_button_hover_bg_corner_radius;
|
int r = rc.theme->window_button_hover_bg_corner_radius;
|
||||||
|
|
||||||
cairo_new_sub_path(cairo);
|
cairo_new_sub_path(cairo);
|
||||||
|
|
@ -560,6 +558,8 @@ theme_builtin(struct theme *theme, struct server *server)
|
||||||
theme->window_button_width = 26;
|
theme->window_button_width = 26;
|
||||||
theme->window_button_height = 26;
|
theme->window_button_height = 26;
|
||||||
theme->window_button_spacing = 0;
|
theme->window_button_spacing = 0;
|
||||||
|
|
||||||
|
parse_hexstr("#80808020", theme->window_button_hover_bg_color);
|
||||||
theme->window_button_hover_bg_corner_radius = 0;
|
theme->window_button_hover_bg_corner_radius = 0;
|
||||||
|
|
||||||
for (enum lab_node_type type = LAB_NODE_BUTTON_FIRST;
|
for (enum lab_node_type type = LAB_NODE_BUTTON_FIRST;
|
||||||
|
|
@ -787,6 +787,11 @@ entry(struct theme *theme, const char *key, const char *value)
|
||||||
theme->window_button_spacing = get_int_if_positive(
|
theme->window_button_spacing = get_int_if_positive(
|
||||||
value, "window.button.spacing");
|
value, "window.button.spacing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* botton hover overlay */
|
||||||
|
if (match_glob(key, "window.button.hover.bg.color")) {
|
||||||
|
parse_color(value, theme->window_button_hover_bg_color);
|
||||||
|
}
|
||||||
if (match_glob(key, "window.button.hover.bg.corner-radius")) {
|
if (match_glob(key, "window.button.hover.bg.corner-radius")) {
|
||||||
theme->window_button_hover_bg_corner_radius = get_int_if_positive(
|
theme->window_button_hover_bg_corner_radius = get_int_if_positive(
|
||||||
value, "window.button.hover.bg.corner-radius");
|
value, "window.button.hover.bg.corner-radius");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue