mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
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.
This commit is contained in:
parent
625c66ef75
commit
7c26345826
2 changed files with 125 additions and 0 deletions
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue