diff options
Diffstat (limited to 'src/platform/x11')
| -rw-r--r-- | src/platform/x11/window.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/platform/x11/window.c b/src/platform/x11/window.c index 724987f..765d83c 100644 --- a/src/platform/x11/window.c +++ b/src/platform/x11/window.c @@ -473,6 +473,8 @@ static bool resize(struct x11_surface *s, struct yasl_vector2i size) return true; } uint64_t start = yasl_loop_now_ns(); + /* The presented frame goes with the old pixels. */ + s->presented = false; if (s->shm_active) { XShmDetach(d->native, &s->shm_info); @@ -1883,6 +1885,15 @@ static int double_click_ms(const struct yasl_display *base) return portal_double_click_ms(); } +static bool read_pixels(struct yasl_surface *base, uint32_t *out, size_t cap, + struct yasl_vector2i *size) +{ + struct x11_surface *s = (struct x11_surface *)base; + /* presented stays set from the last draw until the next one starts. */ + if (s->destroyed || s->drawing || !s->presented || !s->pixels) return false; + return yasl_copy_frame(s->pixels, s->size, out, cap, size); +} + static bool bell(struct yasl_surface *base) { struct x11_surface *s = (struct x11_surface *)base; @@ -2138,6 +2149,7 @@ const struct yasl_backend_ops yasl_x11_backend = { .surface_drag_carry = drag_carry, .surface_place_under_pointer = place, .surface_bell = bell, + .surface_read_pixels = read_pixels, .display_double_click_ms = double_click_ms, .surface_start_interactive_move = interactive_move, .surface_start_interactive_resize = interactive_resize, |
