buffer: add addon set

This allows wlr_buffer users to extend it with tjeir own state.
master
Simon Ser 3 years ago
parent 20404ed8bb
commit 93964012e6

@ -12,6 +12,7 @@
#include <pixman.h>
#include <wayland-server-core.h>
#include <wlr/render/dmabuf.h>
#include <wlr/util/addon.h>
struct wlr_buffer;
struct wlr_renderer;
@ -67,6 +68,8 @@ struct wlr_buffer {
struct wl_signal destroy;
struct wl_signal release;
} events;
struct wlr_addon_set addons;
};
struct wlr_buffer_resource_interface {

@ -21,6 +21,7 @@ void wlr_buffer_init(struct wlr_buffer *buffer,
buffer->height = height;
wl_signal_init(&buffer->events.destroy);
wl_signal_init(&buffer->events.release);
wlr_addon_set_init(&buffer->addons);
}
static void buffer_consider_destroy(struct wlr_buffer *buffer) {
@ -31,6 +32,7 @@ static void buffer_consider_destroy(struct wlr_buffer *buffer) {
assert(!buffer->accessing_data_ptr);
wlr_signal_emit_safe(&buffer->events.destroy, NULL);
wlr_addon_set_finish(&buffer->addons);
buffer->impl->destroy(buffer);
}

Loading…
Cancel
Save