csd: initial implementation of minimize/maximize/close buttons

This commit is contained in:
Daniel Eklöf 2020-03-02 20:29:28 +01:00
parent c845c90835
commit 9699c9b8bf
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
11 changed files with 268 additions and 21 deletions

View file

@ -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,