From ae7ed795730398d50e6408575a1edfbd5c34bd3c Mon Sep 17 00:00:00 2001 From: Christoph Gysin Date: Sun, 29 Nov 2015 23:17:42 +0200 Subject: [PATCH] config: Store 'enabled' as int --- include/config.h | 2 +- sway/commands.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/config.h b/include/config.h index 9caadec8..631c8178 100644 --- a/include/config.h +++ b/include/config.h @@ -40,7 +40,7 @@ struct sway_mode { */ struct output_config { char *name; - bool enabled; + int enabled; int width, height; int x, y; char *background; diff --git a/sway/commands.c b/sway/commands.c index ba42a9ae..f891792f 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -719,7 +719,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) { struct output_config *output = calloc(1, sizeof(struct output_config)); output->x = output->y = output->width = output->height = -1; output->name = strdup(name); - output->enabled = true; + output->enabled = -1; // TODO: atoi doesn't handle invalid numbers // TODO: Check missing params after each sub-command @@ -729,7 +729,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) { const char *command = argv[i]; if (strcasecmp(command, "disable") == 0) { - output->enabled = false; + output->enabled = 0; } else if (strcasecmp(command, "resolution") == 0 || strcasecmp(command, "res") == 0) { char *res = argv[++i]; char *x = strchr(res, 'x'); @@ -811,8 +811,8 @@ static struct cmd_results *cmd_output(int argc, char **argv) { } list_add(config->output_configs, output); - sway_log(L_DEBUG, "Config stored for output %s (%s) (%d x %d @ %d, %d) (bg %s %s)", - output->name, output->enabled ? "enable" : "disable", output->width, + sway_log(L_DEBUG, "Config stored for output %s (enabled:%d) (%d x %d @ %d, %d) (bg %s %s)", + output->name, output->enabled, output->width, output->height, output->x, output->y, output->background, output->background_option);