diff --git a/config.c b/config.c index 4a4a6820..e5411bed 100644 --- a/config.c +++ b/config.c @@ -486,8 +486,8 @@ parse_section_main(const char *key, const char *value, struct config *conf, } conf->size.type = CONF_SIZE_PX; - conf->size.px.width = width; - conf->size.px.height = height; + conf->size.width = width; + conf->size.height = height; } else if (strcmp(key, "initial-window-size-chars") == 0) { @@ -501,8 +501,8 @@ parse_section_main(const char *key, const char *value, struct config *conf, } conf->size.type = CONF_SIZE_CELLS; - conf->size.cells.width = width; - conf->size.cells.height = height; + conf->size.width = width; + conf->size.height = height; } else if (strcmp(key, "pad") == 0) { @@ -2016,10 +2016,8 @@ config_load(struct config *conf, const char *conf_path, .word_delimiters = xwcsdup(L",│`|:\"'()[]{}<>"), .size = { .type = CONF_SIZE_PX, - .px = { - .width = 700, - .height = 500, - }, + .width = 700, + .height = 500, }, .pad_x = 2, .pad_y = 2, diff --git a/config.h b/config.h index 2c57850c..e69e5376 100644 --- a/config.h +++ b/config.h @@ -64,16 +64,8 @@ struct config { struct { enum conf_size_type type; - union { - struct { - unsigned width; - unsigned height; - } px; - struct { - unsigned width; - unsigned height; - } cells; - }; + unsigned width; + unsigned height; } size; unsigned pad_x; diff --git a/main.c b/main.c index ebd73f20..ab595d22 100644 --- a/main.c +++ b/main.c @@ -399,18 +399,8 @@ main(int argc, char *const *argv) } if (conf_width > 0 && conf_height > 0) { conf.size.type = conf_size_type; - - switch (conf_size_type) { - case CONF_SIZE_PX: - conf.size.px.width = conf_width; - conf.size.px.height = conf_height; - break; - - case CONF_SIZE_CELLS: - conf.size.cells.width = conf_width; - conf.size.cells.height = conf_height; - break; - } + conf.size.width = conf_width; + conf.size.height = conf_height; } if (conf_server_socket_path != NULL) { free(conf.server_socket_path); diff --git a/render.c b/render.c index 53363071..dc926cc4 100644 --- a/render.c +++ b/render.c @@ -2180,8 +2180,8 @@ maybe_resize(struct terminal *term, int width, int height, bool force) } else { switch (term->conf->size.type) { case CONF_SIZE_PX: - width = term->conf->size.px.width; - height = term->conf->size.px.height; + width = term->conf->size.width; + height = term->conf->size.height; if (term->window->use_csd == CSD_YES) { /* Take CSD title bar into account */ @@ -2194,8 +2194,8 @@ maybe_resize(struct terminal *term, int width, int height, bool force) break; case CONF_SIZE_CELLS: - width = term->conf->size.cells.width * term->cell_width; - height = term->conf->size.cells.height * term->cell_height; + width = term->conf->size.width * term->cell_width; + height = term->conf->size.height * term->cell_height; width += 2 * term->conf->pad_x * scale; height += 2 * term->conf->pad_y * scale; diff --git a/server.c b/server.c index 6e2f514f..e6c3aae3 100644 --- a/server.c +++ b/server.c @@ -265,18 +265,8 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data) if (cdata.width > 0 && cdata.height > 0) { client->conf.size.type = cdata.size_type; - - switch (cdata.size_type) { - case CONF_SIZE_PX: - client->conf.size.px.width = cdata.width; - client->conf.size.px.height = cdata.height; - break; - - case CONF_SIZE_CELLS: - client->conf.size.cells.width = cdata.width; - client->conf.size.cells.height = cdata.height; - break; - } + client->conf.size.width = cdata.width; + client->conf.size.height = cdata.height; } client->term = term_init(