diff options
| author | Federico Angelilli <code@fedang.net> | 2024-11-20 01:20:46 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-11-20 01:20:46 +0100 |
| commit | bb63935e63365d842fe530629387d1d2a4248042 (patch) | |
| tree | 61c3ba787bd8dfdcf5a38ba17dfcc856b2605ae2 /src/config.c | |
| parent | 30f91d7c8769a68e4bf11ed4ff0177bcf1bc9f03 (diff) | |
Refactor changes
Diffstat (limited to 'src/config.c')
| -rw-r--r-- | src/config.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/config.c b/src/config.c index e13d9b9..309ed27 100644 --- a/src/config.c +++ b/src/config.c @@ -21,12 +21,12 @@ typedef enum { } config_status_t; static const config_entry_t bar_entries[] = { - { "width", CONFIG_UINT, NULL, offsetof(config_t, width) }, - { "height", CONFIG_UINT, NULL, offsetof(config_t, height) }, - { "font", CONFIG_STRING, NULL, offsetof(config_t, font) }, - { "monitor", CONFIG_STRING, NULL, offsetof(config_t, monitor) }, - { "override-redirect", CONFIG_BOOL, NULL, offsetof(config_t, override_redirect) }, - { "background", CONFIG_COLOR, NULL, offsetof(config_t, background) }, + { "width", CONFIG_UINT, NULL, offsetof(config_t, width) }, + { "height", CONFIG_UINT, NULL, offsetof(config_t, height) }, + { "font", CONFIG_STRING, NULL, offsetof(config_t, font) }, + { "monitor", CONFIG_STRING, NULL, offsetof(config_t, monitor) }, + { "override-redirect", CONFIG_BOOL, NULL, offsetof(config_t, override_redirect) }, + { "background", CONFIG_GRADIENT, NULL, offsetof(config_t, background) }, { 0 }, }; @@ -212,20 +212,15 @@ static bool config_read_gradient(const char *value, gradient_t *result) } if (n == 1) { - result->cached = cairo_pattern_create_rgba(colors->r, colors->g, colors->b, colors->a); + result->pattern = cairo_pattern_create_rgba(colors->r, colors->g, colors->b, colors->a); return true; } - result->cached = cairo_pattern_create_linear(0, 0, 1, 0); - + result->pattern = cairo_pattern_create_linear(0, 0, 1, 0); for (size_t i = 0; i < n; i++) { double offset = i * 1.0 / (n - 1); - cairo_pattern_add_color_stop_rgba(result->cached, - offset, - colors[i].r, - colors[i].g, - colors[i].b, - colors[i].a); + cairo_pattern_add_color_stop_rgba(result->pattern, offset, + colors[i].r, colors[i].g, colors[i].b, colors[i].a); } return true; |
