diff options
author | Simon Ser <contact@emersion.fr> | 2021-04-14 19:11:35 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-06-07 09:22:56 -0400 |
commit | 7c263458268bc0013f243c589a9ced125d225db4 (patch) | |
tree | c031d3df096bf9370c0bb39c9f335360538a8c68 /include | |
parent | 625c66ef75c5538f4e5820a850a84d80d6abcffb (diff) |
buffer: introduce wlr_shm_client_buffer
Introduce wlr_shm_client_buffer, which provides a wlr_buffer wrapper
around wl_shm_buffer.
Because the client can destroy the wl_buffer while we still are using
it, we need to do some libwayland tricks to still be able to continue
accessing its underlying storage. We need to reference the wl_shm_pool
and save the data pointer.
Diffstat (limited to 'include')
-rw-r--r-- | include/types/wlr_buffer.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/types/wlr_buffer.h b/include/types/wlr_buffer.h index 56b50f3d..8abb68d6 100644 --- a/include/types/wlr_buffer.h +++ b/include/types/wlr_buffer.h @@ -3,6 +3,28 @@ #include <wlr/types/wlr_buffer.h> +struct wlr_shm_client_buffer { + struct wlr_buffer base; + + uint32_t format; + size_t stride; + + // The following fields are NULL if the client has destroyed the wl_buffer + struct wl_resource *resource; + struct wl_shm_buffer *shm_buffer; + + // This is used to keep the backing storage alive after the client has + // destroyed the wl_buffer + struct wl_shm_pool *saved_shm_pool; + void *saved_data; + + struct wl_listener resource_destroy; + struct wl_listener release; +}; + +struct wlr_shm_client_buffer *shm_client_buffer_create( + struct wl_resource *resource); + /** * Buffer capabilities. * |