mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render: best-effort attempt to set initial window size in chars when scale != 1
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.
This commit is contained in:
parent
51a7e44fa2
commit
fdfdbba9a0
2 changed files with 15 additions and 7 deletions
|
|
@ -48,7 +48,14 @@ in this order:
|
|||
*initial-window-size-chars*
|
||||
Initial window width and height in _characters_, on the form
|
||||
_WIDTHxHEIGHT_. Mutually exclusive to
|
||||
*initial-window-size-pixels*. Default: _not set_.
|
||||
*initial-window-size-pixels*.'
|
||||
|
||||
Note that if you have a multi-monitor setup, with different
|
||||
scaling factors, there is a possibility the window size will not
|
||||
be set correctly. If that is the case, use
|
||||
*initial-window-size-pixels* instead.
|
||||
|
||||
Default: _not set_.
|
||||
|
||||
*initial-window-mode*
|
||||
Initial window mode for each newly spawned window: *windowed*,
|
||||
|
|
|
|||
13
render.c
13
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue