Merge branch 'master' into releases/1.16

This commit is contained in:
Daniel Eklöf 2023-10-12 16:35:37 +02:00
commit ee7e6e7234
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 47 additions and 16 deletions

View file

@ -1,5 +1,6 @@
# Changelog # Changelog
* [Unreleased](#unreleased)
* [1.16.0](#1-16-0) * [1.16.0](#1-16-0)
* [1.15.3](#1-15-3) * [1.15.3](#1-15-3)
* [1.15.2](#1-15-2) * [1.15.2](#1-15-2)
@ -46,13 +47,31 @@
* [1.2.0](#1-2-0) * [1.2.0](#1-2-0)
## Unreleased
### Added
### Changed
### Deprecated
### Removed
### Fixed
* Foot not starting on linux kernels before 6.3 ([#1514][1514]).
* Cells underneath erased sixels not being repainted ([#1515][1515]).
[1514]: https://codeberg.org/dnkl/foot/issues/1514
[1515]: https://codeberg.org/dnkl/foot/issues/1515
### Security
### Contributors
## 1.16.0 ## 1.16.0
### Added ### Added
* Support for building with _wayland-protocols_ as a subproject. * Support for building with _wayland-protocols_ as a subproject.
* Mouse wheel scrolls can now be used in `mouse-bindings` * Mouse wheel scrolls can now be used in `mouse-bindings`
([#1077](1077)). ([#1077][1077]).
* New mouse bindings: `scrollback-up-mouse` and * New mouse bindings: `scrollback-up-mouse` and
`scrollback-down-mouse`, bound to `BTN_BACK` and `BTN_FORWARD` `scrollback-down-mouse`, bound to `BTN_BACK` and `BTN_FORWARD`
respectively. respectively.

View file

@ -1199,7 +1199,8 @@ render_sixel_chunk(struct terminal *term, pixman_image_t *pix, const struct sixe
static void static void
render_sixel(struct terminal *term, pixman_image_t *pix, render_sixel(struct terminal *term, pixman_image_t *pix,
const struct coord *cursor, const struct sixel *sixel) pixman_region32_t *damage, const struct coord *cursor,
const struct sixel *sixel)
{ {
xassert(sixel->pix != NULL); xassert(sixel->pix != NULL);
xassert(sixel->width >= 0); xassert(sixel->width >= 0);
@ -1293,8 +1294,7 @@ render_sixel(struct terminal *term, pixman_image_t *pix,
*/ */
if (!sixel->opaque) { if (!sixel->opaque) {
/* TODO: multithreading */ /* TODO: multithreading */
int cursor_col = cursor->row == term_row_no ? cursor->col : -1; render_row(term, pix, damage, row, term_row_no, cursor_col);
render_row(term, pix, NULL, row, term_row_no, cursor_col);
} else { } else {
for (int col = sixel->pos.col; for (int col = sixel->pos.col;
col < min(sixel->pos.col + sixel->cols, term->cols); col < min(sixel->pos.col + sixel->cols, term->cols);
@ -1309,7 +1309,7 @@ render_sixel(struct terminal *term, pixman_image_t *pix,
if ((last_row_needs_erase && last_row) || if ((last_row_needs_erase && last_row) ||
(last_col_needs_erase && last_col)) (last_col_needs_erase && last_col))
{ {
render_cell(term, pix, NULL, row, term_row_no, col, cursor_col == col); render_cell(term, pix, damage, row, term_row_no, col, cursor_col);
} else { } else {
cell->attrs.clean = 1; cell->attrs.clean = 1;
cell->attrs.confined = 1; cell->attrs.confined = 1;
@ -1333,6 +1333,7 @@ render_sixel(struct terminal *term, pixman_image_t *pix,
static void static void
render_sixel_images(struct terminal *term, pixman_image_t *pix, render_sixel_images(struct terminal *term, pixman_image_t *pix,
pixman_region32_t *damage,
const struct coord *cursor) const struct coord *cursor)
{ {
if (likely(tll_length(term->grid->sixel_images)) == 0) if (likely(tll_length(term->grid->sixel_images)) == 0)
@ -1370,7 +1371,7 @@ render_sixel_images(struct terminal *term, pixman_image_t *pix,
} }
sixel_sync_cache(term, &it->item); sixel_sync_cache(term, &it->item);
render_sixel(term, pix, cursor, &it->item); render_sixel(term, pix, damage, cursor, &it->item);
} }
} }
@ -2974,7 +2975,10 @@ grid_render(struct terminal *term)
} }
} }
render_sixel_images(term, buf->pix[0], &cursor); pixman_region32_t damage;
pixman_region32_init(&damage);
render_sixel_images(term, buf->pix[0], &damage, &cursor);
if (term->render.workers.count > 0) { if (term->render.workers.count > 0) {
mtx_lock(&term->render.workers.lock); mtx_lock(&term->render.workers.lock);
@ -2985,9 +2989,6 @@ grid_render(struct terminal *term)
xassert(tll_length(term->render.workers.queue) == 0); xassert(tll_length(term->render.workers.queue) == 0);
} }
pixman_region32_t damage;
pixman_region32_init(&damage);
for (int r = 0; r < term->rows; r++) { for (int r = 0; r < term->rows; r++) {
struct row *row = grid_row_in_view(term->grid, r); struct row *row = grid_row_in_view(term->grid, r);

21
shm.c
View file

@ -27,10 +27,8 @@
#define MAP_UNINITIALIZED 0 #define MAP_UNINITIALIZED 0
#endif #endif
#if defined(MFD_NOEXEC_SEAL) #if !defined(MFD_NOEXEC_SEAL)
#define FOOT_MFD_FLAGS (MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_NOEXEC_SEAL) #define MFD_NOEXEC_SEAL 0
#else
#define FOOT_MFD_FLAGS (MFD_CLOEXEC | MFD_ALLOW_SEALING)
#endif #endif
#define TIME_SCROLL 0 #define TIME_SCROLL 0
@ -339,7 +337,20 @@ get_new_buffers(struct buffer_chain *chain, size_t count,
/* Backing memory for SHM */ /* Backing memory for SHM */
#if defined(MEMFD_CREATE) #if defined(MEMFD_CREATE)
pool_fd = memfd_create("foot-wayland-shm-buffer-pool", FOOT_MFD_FLAGS); /*
* Older kernels reject MFD_NOEXEC_SEAL with EINVAL. Try first
* *with* it, and if that fails, try again *without* it.
*/
errno = 0;
pool_fd = memfd_create(
"foot-wayland-shm-buffer-pool",
MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_NOEXEC_SEAL);
if (pool_fd < 0 && errno == EINVAL) {
pool_fd = memfd_create(
"foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
}
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
// memfd_create on FreeBSD 13 is SHM_ANON without sealing support // memfd_create on FreeBSD 13 is SHM_ANON without sealing support
pool_fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600); pool_fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);

View file

@ -180,7 +180,7 @@ sixel_erase(struct terminal *term, struct sixel *sixel)
row->dirty = true; row->dirty = true;
for (int c = sixel->pos.col; c < min(sixel->cols, term->cols); c++) for (int c = sixel->pos.col; c < min(sixel->pos.col + sixel->cols, term->cols); c++)
row->cells[c].attrs.clean = 0; row->cells[c].attrs.clean = 0;
} }