From fdfdbba9a050e36d371f7ece0310d3c62e0eb5d5 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 14 Sep 2020 17:34:04 +0200 Subject: render: best-effort attempt to set initial window size in chars when scale != 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initial window size is set *before* we’re initially mapped. This means we don’t (yet) know on which output we’ll be mapped. _That_ means we don’t know which scaling factor to use. This implements a best effort attempt, where we use the “guessed” scaling factor. This will always be correct in single-monitor configurations, but may be wrong in multi-monitor setups with different scaling factors. --- render.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 0d151ab4..2553c190 100644 --- a/render.c +++ b/render.c @@ -2023,7 +2023,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force) if (scale == -1) { /* Haven't 'entered' an output yet? */ - scale = 1; + scale = term->scale; } width *= scale; @@ -2050,18 +2050,19 @@ maybe_resize(struct terminal *term, int width, int height, bool force) assert(!term->window->is_fullscreen); height -= term->conf->csd.title_height; } + + width *= scale; + height *= scale; break; case CONF_SIZE_CELLS: - width = 2 * term->conf->pad_x; - height = 2 * term->conf->pad_y; + width = 2 * term->conf->pad_x * scale; + height = 2 * term->conf->pad_y * scale; + width += term->conf->size.cells.width * term->cell_width; height += term->conf->size.cells.height * term->cell_height; break; } - - width *= scale; - height *= scale; } } -- cgit v1.3