From 8ac2bcff67777f2bb14c95dd92810b3f7264f83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 29 Dec 2021 18:05:00 +0100 Subject: [PATCH] =?UTF-8?q?render:=20limit=20the=20unfocused=20block=20cur?= =?UTF-8?q?sor=E2=80=99s=20outline=20width?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensure the outline width doesn’t exceed the cell width/height. --- render.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/render.c b/render.c index 392f90de..66ba1406 100644 --- a/render.c +++ b/render.c @@ -318,14 +318,15 @@ draw_unfocused_block(const struct terminal *term, pixman_image_t *pix, const pixman_color_t *color, int x, int y, int cell_cols) { const int scale = term->scale; + const int width = min(min(scale, term->cell_width), term->cell_height); pixman_image_fill_rectangles( PIXMAN_OP_SRC, pix, color, 4, (pixman_rectangle16_t []){ - {x, y, cell_cols * term->cell_width, scale}, /* top */ - {x, y, scale, term->cell_height}, /* left */ - {x + cell_cols * term->cell_width - scale, y, scale, term->cell_height}, /* right */ - {x, y + term->cell_height - scale, cell_cols * term->cell_width, scale}, /* bottom */ + {x, y, cell_cols * term->cell_width, width}, /* top */ + {x, y, width, term->cell_height}, /* left */ + {x + cell_cols * term->cell_width - width, y, width, term->cell_height}, /* right */ + {x, y + term->cell_height - width, cell_cols * term->cell_width, width}, /* bottom */ }); }