aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-26 18:39:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-26 18:39:12 +0000
commite197368c0ffc2235da9b6b41a0d16cdb5b0b61bb (patch)
treeba893901ce1a3ae48292504e7139d85fffdb17ce /config.c
parentrender: fdm refresh handler: don't clear pending flags (diff)
config: add 'startup-mode' option
This option controls the initial window mode: windowed, maximized or fullscreen. The default is windowed.
Diffstat (limited to 'config.c')
-rw-r--r--config.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/config.c b/config.c
index 80163e2e..93b536cb 100644
--- a/config.c
+++ b/config.c
@@ -225,7 +225,7 @@ parse_section_main(const char *key, const char *value, struct config *conf,
unsigned x, y;
if (sscanf(value, "%ux%u", &x, &y) != 2) {
LOG_ERR(
- "%s: %d: expected PAD_XxPAD_Y, where both are positive integers: %s",
+ "%s:%d: expected PAD_XxPAD_Y, where both are positive integers: %s",
path, lineno, value);
return false;
}
@@ -234,6 +234,21 @@ parse_section_main(const char *key, const char *value, struct config *conf,
conf->pad_y = y;
}
+ else if (strcmp(key, "startup-mode") == 0) {
+ if (strcmp(value, "windowed") == 0)
+ conf->startup_mode = STARTUP_WINDOWED;
+ else if (strcmp(value, "maximized") == 0)
+ conf->startup_mode = STARTUP_MAXIMIZED;
+ else if (strcmp(value, "fullscreen") == 0)
+ conf->startup_mode = STARTUP_FULLSCREEN;
+ else {
+ LOG_ERR(
+ "%s:%d: expected either 'windowed', 'maximized' or 'fullscreen'",
+ path, lineno);
+ return false;
+ }
+ }
+
else if (strcmp(key, "font") == 0) {
char *copy = strdup(value);
for (const char *font = strtok(copy, ","); font != NULL; font = strtok(NULL, ",")) {
@@ -803,6 +818,7 @@ config_load(struct config *conf, const char *conf_path)
.height = 500,
.pad_x = 2,
.pad_y = 2,
+ .startup_mode = STARTUP_WINDOWED,
.fonts = tll_init(),
.scrollback_lines = 1000,