Add output scaling (#34)

* feat: output scaling

* chore: update man file

* fix: message when scaling
This commit is contained in:
Oliver Friedmann 2022-11-28 15:23:41 -05:00 committed by GitHub
commit 29943b50e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 7 deletions

14
parse.c
View file

@ -532,6 +532,7 @@ parse_output_config(char **saveptr, char **errstr) {
cfg->output_name = NULL;
cfg->refresh_rate = 0;
cfg->priority = -1;
cfg->scale = NULL;
char *name = strtok_r(NULL, " ", saveptr);
if(name == NULL) {
*errstr =
@ -619,6 +620,19 @@ parse_output_config(char **saveptr, char **errstr) {
goto error;
}
char *scale_str = strtok_r(NULL, " ", saveptr);
if(scale_str != NULL && strcmp(scale_str, "scale") == 0) {
cfg->scale = malloc(sizeof(float));
*cfg->scale = parse_float(saveptr, " ");
if(*cfg->scale <= 0.0) {
*errstr =
log_error("Error parsing scale of output configuration for "
"output %s, expected positive float",
name);
goto error;
}
}
cfg->output_name = strdup(name);
return cfg;
error: