From 9699c9b8bfcbd7f9ebef5ee4ffe370cb03b1c8a2 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 2 Mar 2020 20:29:28 +0100 Subject: csd: initial implementation of minimize/maximize/close buttons --- config.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 983cda99..ef7f9a25 100644 --- a/config.c +++ b/config.c @@ -372,7 +372,7 @@ parse_section_csd(const char *key, const char *value, struct config *conf, conf->csd.color.border = color; } - else if (strcmp(key, "titlebar") == 0) { + else if (strcmp(key, "titlebar-size") == 0) { unsigned long pixels; if (!str_to_ulong(value, 10, &pixels)) { LOG_ERR("%s:%d: expected an integer: %s", path, lineno, value); @@ -382,7 +382,7 @@ parse_section_csd(const char *key, const char *value, struct config *conf, conf->csd.title_height = pixels; } - else if (strcmp(key, "border") == 0) { + else if (strcmp(key, "border-width") == 0) { unsigned long pixels; if (!str_to_ulong(value, 10, &pixels)) { LOG_ERR("%s:%d: expected an integer: %s", path, lineno, value); @@ -392,6 +392,48 @@ parse_section_csd(const char *key, const char *value, struct config *conf, conf->csd.border_width = pixels; } + else if (strcmp(key, "button-width") == 0) { + unsigned long pixels; + if (!str_to_ulong(value, 10, &pixels)) { + LOG_ERR("%s:%d: expected an integer: %s", path, lineno, value); + return false; + } + + conf->csd.button_width = pixels; + } + + else if (strcmp(key, "button-minimize-color") == 0) { + uint32_t color; + if (!str_to_color(value, &color, true, path, lineno)) { + LOG_ERR("%s:%d: invalid button-minimize-color: %s", path, lineno, value); + return false; + } + + conf->csd.color.minimize_set = true; + conf->csd.color.minimize = color; + } + + else if (strcmp(key, "button-maximize-color") == 0) { + uint32_t color; + if (!str_to_color(value, &color, true, path, lineno)) { + LOG_ERR("%s:%d: invalid button-maximize-color: %s", path, lineno, value); + return false; + } + + conf->csd.color.maximize_set = true; + conf->csd.color.maximize = color; + } + + else if (strcmp(key, "button-close-color") == 0) { + uint32_t color; + if (!str_to_color(value, &color, true, path, lineno)) { + LOG_ERR("%s:%d: invalid button-close-color: %s", path, lineno, value); + return false; + } + + conf->csd.color.close_set = true; + conf->csd.color.close = color; + } return true; } @@ -602,6 +644,7 @@ config_load(struct config *conf, const char *conf_path) .preferred = CONF_CSD_PREFER_SERVER, .title_height = 26, .border_width = 5, + .button_width = 22, .color = { .title_set = false, .border_set = false, -- cgit v1.3