From 1b1eed0dbdbb8fdac59a2ffa66505f7d8ed9f99e Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Thu, 10 Nov 2022 13:09:43 +0100 Subject: [PATCH] wayland/outputs: Implement wl_output v3 This version adds a release event, allowing clients to tell the server that it can clean up the related wl_resource. Part-of: --- src/wayland/meta-wayland-outputs.c | 17 +++++++++++++++-- src/wayland/meta-wayland-versions.h | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index a8fe21c85..84fb3190d 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -99,6 +99,17 @@ output_resource_destroy (struct wl_resource *res) wayland_output->resources = g_list_remove (wayland_output->resources, res); } +static void +meta_wl_output_release (struct wl_client *client, + struct wl_resource *resource) +{ + wl_resource_destroy (resource); +} + +static const struct wl_output_interface meta_wl_output_interface = { + meta_wl_output_release, +}; + static enum wl_output_subpixel cogl_subpixel_order_to_wl_output_subpixel (CoglSubpixelOrder subpixel_order) { @@ -310,8 +321,10 @@ bind_output (struct wl_client *client, wayland_output->resources = g_list_prepend (wayland_output->resources, resource); - wl_resource_set_user_data (resource, wayland_output); - wl_resource_set_destructor (resource, output_resource_destroy); + wl_resource_set_implementation (resource, + &meta_wl_output_interface, + wayland_output, + output_resource_destroy); #ifdef WITH_VERBOSE_MODE logical_monitor = meta_monitor_get_logical_monitor (monitor); diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h index 3864e0706..878ba0ee5 100644 --- a/src/wayland/meta-wayland-versions.h +++ b/src/wayland/meta-wayland-versions.h @@ -39,7 +39,7 @@ #define META_WL_DATA_DEVICE_MANAGER_VERSION 3 #define META_XDG_WM_BASE_VERSION 4 #define META_WL_SEAT_VERSION 8 -#define META_WL_OUTPUT_VERSION 2 +#define META_WL_OUTPUT_VERSION 3 #define META_XSERVER_VERSION 1 #define META_GTK_SHELL1_VERSION 5 #define META_WL_SUBCOMPOSITOR_VERSION 1