aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-12-29 17:05:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-12-29 17:05:00 +0000
commit8ac2bcff67777f2bb14c95dd92810b3f7264f83a (patch)
tree25f8ffa90e6f209312fff8829a5fcf65a8bc92c1
parentMerge branch 'scale-outline-of-unfocused-block-cursor' (diff)
render: limit the unfocused block cursor’s outline width
Ensure the outline width doesn’t exceed the cell width/height.
-rw-r--r--render.c9
1 files 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 */
});
}