mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
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.
This commit is contained in:
parent
9392cfbbf3
commit
607df23a92
1 changed files with 13 additions and 8 deletions
21
main.c
21
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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue