From 521bd84a99ee154af2866511774c1f6c8c2a2467 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 22 Dec 2021 20:21:46 +0100 Subject: config: csd.border_width now always reflects the full/total width --- render.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 34a4da3a..ca411c14 100644 --- a/render.c +++ b/render.c @@ -1528,8 +1528,7 @@ get_csd_data(const struct terminal *term, enum csd_surface surf_idx) /* Only title bar is rendered in maximized mode */ const int border_width = !term->window->is_maximized - ? max(term->conf->csd.border_width, - term->conf->csd.border_width_visible) * term->scale : 0; + ? term->conf->csd.border_width * term->scale : 0; const int title_height = term->window->is_fullscreen ? 0 @@ -1756,10 +1755,11 @@ render_csd_border(struct terminal *term, enum csd_surface surf_idx, * The “visible” border. */ - int bwidth = max(term->conf->csd.border_width, - term->conf->csd.border_width_visible); /* Full border size */ + int bwidth = term->conf->csd.border_width; int vwidth = term->conf->csd.border_width_visible; /* Visibls size */ + xassert(bwidth >= vwidth); + if (vwidth > 0) { const struct config *conf = term->conf; -- cgit v1.3 From 41f7f8b7fad601422cf9b458928b73b210ba994a Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 22 Dec 2021 20:31:38 +0100 Subject: render: make sure ‘maximized’ button doesn’t use negative coordinates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ render.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'render.c') diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a972955..e2febfff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,8 @@ (https://codeberg.org/dnkl/foot/issues/844). * Crash when setting a key- or mouse binding to the empty string (https://codeberg.org/dnkl/foot/issues/851). +* Crash when maximizing the window and `[csd].size=1` + (https://codeberg.org/dnkl/foot/issues/857). ### Security diff --git a/render.c b/render.c index ca411c14..b21b23ce 100644 --- a/render.c +++ b/render.c @@ -1887,11 +1887,15 @@ render_csd_button_maximize_maximized( const int max_width = buf->width / 3; int width = min(max_height, max_width); - int thick = 1 * term->scale; + int thick = min(width / 2, 1 * term->scale); const int x_margin = (buf->width - width) / 2; const int y_margin = (buf->height - width) / 2; + xassert(x_margin + width - thick >= 0); + xassert(width - 2 * thick >= 0); + xassert(y_margin + width - thick >= 0); + pixman_image_fill_rectangles( PIXMAN_OP_SRC, buf->pix[0], &color, 4, (pixman_rectangle16_t[]){ -- cgit v1.3