From 93964012e66116e66a2efb2ef4d395f1141b9f13 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 11 Aug 2021 10:00:07 +0200 Subject: [PATCH] buffer: add addon set This allows wlr_buffer users to extend it with tjeir own state. --- include/wlr/types/wlr_buffer.h | 3 +++ types/wlr_buffer.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h index 5dc8271d..b4be3226 100644 --- a/include/wlr/types/wlr_buffer.h +++ b/include/wlr/types/wlr_buffer.h @@ -12,6 +12,7 @@ #include #include #include +#include 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 { diff --git a/types/wlr_buffer.c b/types/wlr_buffer.c index 94b42d4a..21c274c0 100644 --- a/types/wlr_buffer.c +++ b/types/wlr_buffer.c @@ -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); }