[PATCH weston v2] Handle wl_output.release

Neil Roberts neil at linux.intel.com
Tue May 20 04:09:23 PDT 2014


Here is a version two of the patch which is just needed so that the
patches can be reordered and this can come before the patch to handle
zombies.

------- >8 --------------- (use git am --scissors to automatically chop here)

The wl_output.release request is now handled. It just causes the
resource to be destroyed. This is also set as the destructor when
zombifying the resource.
---
 src/compositor.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 574db2d..d3a52bd 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3038,6 +3038,18 @@ weston_compositor_stack_plane(struct weston_compositor *ec,
 		wl_list_insert(&ec->plane_list, &plane->link);
 }
 
+static void
+output_release(struct wl_client *client,
+	       struct wl_resource *resource)
+{
+	wl_resource_destroy(resource);
+}
+
+static struct wl_output_interface
+output_interface = {
+	output_release
+};
+
 static void unbind_resource(struct wl_resource *resource)
 {
 	wl_list_remove(wl_resource_get_link(resource));
@@ -3052,14 +3064,15 @@ bind_output(struct wl_client *client,
 	struct wl_resource *resource;
 
 	resource = wl_resource_create(client, &wl_output_interface,
-				      MIN(version, 2), id);
+				      MIN(version, 3), id);
 	if (resource == NULL) {
 		wl_client_post_no_memory(client);
 		return;
 	}
 
 	wl_list_insert(&output->resource_list, wl_resource_get_link(resource));
-	wl_resource_set_implementation(resource, NULL, data, unbind_resource);
+	wl_resource_set_implementation(resource, &output_interface,
+				       data, unbind_resource);
 
 	wl_output_send_geometry(resource,
 				output->x,
@@ -3321,7 +3334,7 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
 	output->compositor->output_id_pool |= 1 << output->id;
 
 	output->global =
-		wl_global_create(c->wl_display, &wl_output_interface, 2,
+		wl_global_create(c->wl_display, &wl_output_interface, 3,
 				 output, bind_output);
 	wl_signal_emit(&c->output_created_signal, output);
 }
-- 
1.9.0



More information about the wayland-devel mailing list