From fd25018cdd423f1a2fe4c87d607903ac40a8cedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 5 Jul 2019 15:53:53 +0200 Subject: [PATCH] render: fill area outside the cell grid with default bg color --- render.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/render.c b/render.c index 38fa4d86..6f70309b 100644 --- a/render.c +++ b/render.c @@ -369,7 +369,26 @@ grid_render(struct terminal *term) if (last_buf != NULL) { LOG_WARN("new buffer"); - /* Force a full refresh */ + /* Fill area outside the cell grid with the default background color */ + int rmargin = term->cols * term->cell_width; + int bmargin = term->rows * term->cell_height; + int rmargin_width = term->width - rmargin; + int bmargin_height = term->height - bmargin; + + cairo_set_source_rgba( + buf->cairo, term->background.r, term->background.g, + term->background.b, term->background.a); + + cairo_rectangle(buf->cairo, rmargin, 0, rmargin_width, term->height); + cairo_rectangle(buf->cairo, 0, bmargin, term->width, bmargin_height); + cairo_fill(buf->cairo); + + wl_surface_damage_buffer( + term->wl.surface, rmargin, 0, rmargin_width, term->height); + wl_surface_damage_buffer( + term->wl.surface, 0, bmargin, term->width, bmargin_height); + + /* Force a full grid refresh */ term_damage_all(term); } last_buf = buf; @@ -553,7 +572,6 @@ render_update_cursor_surface(struct terminal *term) term->wl.pointer.surface, image->hotspot_x / scale, image->hotspot_y / scale); - wl_surface_damage_buffer( term->wl.pointer.surface, 0, 0, INT32_MAX, INT32_MAX);