aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-10-05 06:53:11 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-10-05 06:55:48 +0000
commitce38f5b41395963bd17f9f998802945db4987a2b (patch)
treee5d5ffc99bec43200d7904abe8e3cbd533e68e88
parentchangelog: #1715: "ghost" lines when selecting text (diff)
render: sixels: update damage region when rendering sixels
This fixes flickering when foot is forced to double-buffer (e.g when running under KDE, or smithay based compositors). Since the damage region isn't updated, the sixel images aren't included in the memcpy that is done to transfer the last frame's updated regions to the next frame. As a result, every other frame will have the sixels, while the others don't. Closes #1851
-rw-r--r--CHANGELOG.md4
-rw-r--r--render.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 109125a8..e18f6f95 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -103,9 +103,13 @@
* Occasional visual glitches when selecting text, when foot is running
under a compositor that forces foot to double buffer
(e.g. KDE/KWin) ([#1715][1715]).
+* Sixels flickering when foot is running under a compositor that
+ forces foot to double buffer (e.g. KDE, or Smithay based
+ compositors) ([#1851][1851]).
[1828]: https://codeberg.org/dnkl/foot/issues/1828
[1715]: https://codeberg.org/dnkl/foot/issues/1715
+[1851]: https://codeberg.org/dnkl/foot/issues/1851
### Security
diff --git a/render.c b/render.c
index f951cc7d..9f039f97 100644
--- a/render.c
+++ b/render.c
@@ -1390,7 +1390,8 @@ grid_render_scroll_reverse(struct terminal *term, struct buffer *buf,
}
static void
-render_sixel_chunk(struct terminal *term, pixman_image_t *pix, const struct sixel *sixel,
+render_sixel_chunk(struct terminal *term, pixman_image_t *pix,
+ pixman_region32_t *damage, const struct sixel *sixel,
int term_start_row, int img_start_row, int count)
{
/* Translate row/column to x/y pixel values */
@@ -1427,6 +1428,9 @@ render_sixel_chunk(struct terminal *term, pixman_image_t *pix, const struct sixe
x, y,
width, height);
+ if (damage != NULL)
+ pixman_region32_union_rect(damage, damage, x, y, width, height);
+
wl_surface_damage_buffer(term->window->surface.surf, x, y, width, height);
}
@@ -1450,7 +1454,7 @@ render_sixel(struct terminal *term, pixman_image_t *pix,
#define maybe_emit_sixel_chunk_then_reset() \
if (chunk_row_count != 0) { \
render_sixel_chunk( \
- term, pix, sixel, \
+ term, pix, damage, sixel, \
chunk_term_start, chunk_img_start, chunk_row_count); \
chunk_term_start = chunk_img_start = -1; \
chunk_row_count = 0; \