aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-12-06 18:03:42 -0500
committerGitHub <noreply@github.com>2018-12-06 18:03:42 -0500
commite75075dfa20250e80a41402ec91d648516087f39 (patch)
tree10e2f6e2f9b20ed2caea33e2e30df355c7515dd0
parent20f5fc9e2e17b8973adbe54e9c2dd28c98ce19da (diff)
parent1256314afe32c259fc21f6965f034a353512f126 (diff)
Merge pull request #1422 from emersion/dmabuf-export-destroy
export-dmabuf-v1: add missing destroy request handler
-rw-r--r--include/wlr/types/wlr_export_dmabuf_v1.h26
-rw-r--r--types/wlr_export_dmabuf_v1.c11
2 files changed, 22 insertions, 15 deletions
diff --git a/include/wlr/types/wlr_export_dmabuf_v1.h b/include/wlr/types/wlr_export_dmabuf_v1.h
index 8669574d..204da985 100644
--- a/include/wlr/types/wlr_export_dmabuf_v1.h
+++ b/include/wlr/types/wlr_export_dmabuf_v1.h
@@ -13,12 +13,22 @@
#include <wayland-server.h>
#include <wlr/render/dmabuf.h>
-struct wlr_export_dmabuf_manager_v1;
+struct wlr_export_dmabuf_manager_v1 {
+ struct wl_global *global;
+ struct wl_list resources; // wl_resource_get_link
+ struct wl_list frames; // wlr_export_dmabuf_frame_v1::link
+
+ struct wl_listener display_destroy;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+};
struct wlr_export_dmabuf_frame_v1 {
struct wl_resource *resource;
struct wlr_export_dmabuf_manager_v1 *manager;
- struct wl_list link;
+ struct wl_list link; // wlr_export_dmabuf_manager_v1::frames
struct wlr_dmabuf_attributes attribs;
struct wlr_output *output;
@@ -28,18 +38,6 @@ struct wlr_export_dmabuf_frame_v1 {
struct wl_listener output_swap_buffers;
};
-struct wlr_export_dmabuf_manager_v1 {
- struct wl_global *global;
- struct wl_list resources;
- struct wl_list frames;
-
- struct wl_listener display_destroy;
-
- struct {
- struct wl_signal destroy;
- } events;
-};
-
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
struct wl_display *display);
void wlr_export_dmabuf_manager_v1_destroy(
diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c
index 85ccf1eb..3af7e69f 100644
--- a/types/wlr_export_dmabuf_v1.c
+++ b/types/wlr_export_dmabuf_v1.c
@@ -5,8 +5,9 @@
#include <wlr/render/dmabuf.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_output.h>
-#include "wlr-export-dmabuf-unstable-v1-protocol.h"
#include <wlr/util/log.h>
+#include "util/signal.h"
+#include "wlr-export-dmabuf-unstable-v1-protocol.h"
#define EXPORT_DMABUF_MANAGER_VERSION 1
@@ -146,8 +147,14 @@ static void manager_handle_capture_output(struct wl_client *client,
frame->output_swap_buffers.notify = frame_output_handle_swap_buffers;
}
+static void manager_handle_destroy(struct wl_client *client,
+ struct wl_resource *manager_resource) {
+ wl_resource_destroy(manager_resource);
+}
+
static const struct zwlr_export_dmabuf_manager_v1_interface manager_impl = {
.capture_output = manager_handle_capture_output,
+ .destroy = manager_handle_destroy,
};
static void manager_handle_resource_destroy(struct wl_resource *resource) {
@@ -185,6 +192,7 @@ struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
}
wl_list_init(&manager->resources);
wl_list_init(&manager->frames);
+ wl_signal_init(&manager->events.destroy);
manager->global = wl_global_create(display,
&zwlr_export_dmabuf_manager_v1_interface, EXPORT_DMABUF_MANAGER_VERSION,
@@ -205,6 +213,7 @@ void wlr_export_dmabuf_manager_v1_destroy(
if (manager == NULL) {
return;
}
+ wlr_signal_emit_safe(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global);
struct wl_resource *resource, *resource_tmp;