mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-18 05:34:02 -04:00
render: resize with with/height == 0 resizes to user configured dimensions
This commit is contained in:
parent
2855d06c6e
commit
ef53729242
2 changed files with 6 additions and 23 deletions
12
render.c
12
render.c
|
|
@ -1117,7 +1117,7 @@ render_search_box(struct terminal *term)
|
||||||
static bool
|
static bool
|
||||||
maybe_resize(struct terminal *term, int width, int height, bool force)
|
maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
{
|
{
|
||||||
if (!force && (width == 0 || height == 0))
|
if (term->cell_width == 0 && term->cell_height == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int scale = -1;
|
int scale = -1;
|
||||||
|
|
@ -1131,14 +1131,14 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
scale = 1;
|
scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (width == 0 && height == 0) {
|
||||||
|
width = term->conf->width;
|
||||||
|
height = term->conf->height;
|
||||||
|
}
|
||||||
|
|
||||||
width *= scale;
|
width *= scale;
|
||||||
height *= scale;
|
height *= scale;
|
||||||
|
|
||||||
if (!force && width == 0 && height == 0) {
|
|
||||||
/* Assume we're not fully up and running yet */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scaled CSD border + title bar sizes */
|
/* Scaled CSD border + title bar sizes */
|
||||||
const int csd_border = term->window->use_csd ? csd_border_size * scale : 0;
|
const int csd_border = term->window->use_csd ? csd_border_size * scale : 0;
|
||||||
const int csd_title = term->window->use_csd ? csd_title_size * scale : 0;
|
const int csd_title = term->window->use_csd ? csd_title_size * scale : 0;
|
||||||
|
|
|
||||||
17
terminal.c
17
terminal.c
|
|
@ -773,29 +773,12 @@ term_init(const struct config *conf, struct fdm *fdm, struct wayland *wayl,
|
||||||
term_set_window_title(term, "foot");
|
term_set_window_title(term, "foot");
|
||||||
|
|
||||||
/* Load fonts */
|
/* Load fonts */
|
||||||
#if 0
|
|
||||||
struct font *fonts[4];
|
|
||||||
if (!load_fonts_from_conf(term, conf, fonts))
|
|
||||||
goto err;
|
|
||||||
term_set_fonts(term, fonts);
|
|
||||||
#endif
|
|
||||||
term_font_dpi_changed(term);
|
term_font_dpi_changed(term);
|
||||||
|
|
||||||
/* Start the slave/client */
|
/* Start the slave/client */
|
||||||
if ((term->slave = slave_spawn(term->ptmx, argc, term->cwd, argv, term_env, conf->shell, login_shell)) == -1)
|
if ((term->slave = slave_spawn(term->ptmx, argc, term->cwd, argv, term_env, conf->shell, login_shell)) == -1)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (term->width == 0 && term->height == 0) {
|
|
||||||
|
|
||||||
/* Try to use user-configured window dimentions */
|
|
||||||
unsigned width = conf->width;
|
|
||||||
unsigned height = conf->height;
|
|
||||||
|
|
||||||
/* Don't go below a single cell */
|
|
||||||
width = max(width, term->cell_width);
|
|
||||||
height = max(height, term->cell_height);
|
|
||||||
render_resize(term, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
return term;
|
return term;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue