aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-02 10:51:43 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-02 10:51:43 +0000
commit607df23a92ca904a14b8858d5128703b144d4be1 (patch)
treed4d559665bd1eac3c9654784ddc2a5b92d1bd708
parentrender: draw pre-rendered glyph OVER background (diff)
render: fix cursor not always being rendered
In case the only difference between this and the last frame was cursor movement, the cursor was not rendered.
-rw-r--r--main.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/main.c b/main.c
index 81cd4656..feaa7f25 100644
--- a/main.c
+++ b/main.c
@@ -369,18 +369,27 @@ grid_render_scroll_reverse(struct context *c, struct buffer *buf,
static void
grid_render(struct context *c)
{
- struct buffer *buf = shm_get_buffer(c->wl.shm, c->width, c->height);
- cairo_set_operator(buf->cairo, CAIRO_OPERATOR_SOURCE);
+ static struct cursor last_cursor = {.linear = 0, .col = 0, .row = 0};
if (tll_length(c->term.grid->damage) == 0 &&
- tll_length(c->term.grid->scroll_damage) == 0)
+ tll_length(c->term.grid->scroll_damage) == 0 &&
+ last_cursor.linear == c->term.cursor.linear)
{
- goto render_cursor;
+ return;
}
assert(c->width > 0);
assert(c->height > 0);
+ struct buffer *buf = shm_get_buffer(c->wl.shm, c->width, c->height);
+ cairo_set_operator(buf->cairo, CAIRO_OPERATOR_SOURCE);
+
+ static struct buffer *last_buf = NULL;
+ if (last_buf != buf) {
+ if (last_buf != NULL)
+ LOG_WARN("new buffer");
+ last_buf = buf;
+ }
tll_foreach(c->term.grid->scroll_damage, it) {
@@ -416,12 +425,8 @@ grid_render(struct context *c)
tll_remove(c->term.grid->damage, it);
}
-render_cursor:
- ;
-
/* TODO: break out to function */
/* Re-render last cursor cell and current cursor cell */
- static struct cursor last_cursor = {.linear = 0, .col = 0, .row = 0};
if (last_cursor.linear != c->term.cursor.linear) {
struct damage prev_cursor = {