[PATCH weston 1/2] compositor: Implement release request for input interfaces

Rob Bradford robert.bradford at intel.com
Tue Aug 13 12:11:02 PDT 2013


From: Kristian Høgsberg <krh at bitplanet.net>

v2 (Rob Bradford): Update the version numbering for this change
---
 src/input.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/src/input.c b/src/input.c
index daa6e4c..caa0fcb 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1243,8 +1243,15 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
 								weston_surface_buffer_height(surface));
 }
 
+static void
+pointer_release(struct wl_client *client, struct wl_resource *resource)
+{
+	wl_resource_destroy(resource);
+}
+
 static const struct wl_pointer_interface pointer_interface = {
-	pointer_set_cursor
+	pointer_set_cursor,
+	pointer_release
 };
 
 static void
@@ -1310,6 +1317,16 @@ seat_get_pointer(struct wl_client *client, struct wl_resource *resource,
 }
 
 static void
+keyboard_release(struct wl_client *client, struct wl_resource *resource)
+{
+	wl_resource_destroy(resource);
+}
+
+static const struct wl_keyboard_interface keyboard_interface = {
+	keyboard_release
+};
+
+static void
 seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
 		  uint32_t id)
 {
@@ -1327,7 +1344,7 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
 	}
 
 	add_client_resource(&seat->keyboard->resources, client, cr);
-	wl_resource_set_implementation(cr, NULL, seat, unbind_resource);
+	wl_resource_set_implementation(cr, &keyboard_interface, seat, unbind_resource);
 
 	if (seat->compositor->use_xkbcommon) {
 		wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
@@ -1350,6 +1367,16 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
 }
 
 static void
+touch_release(struct wl_client *client, struct wl_resource *resource)
+{
+	wl_resource_destroy(resource);
+}
+
+static const struct wl_touch_interface touch_interface = {
+	touch_release
+};
+
+static void
 seat_get_touch(struct wl_client *client, struct wl_resource *resource,
 	       uint32_t id)
 {
@@ -1367,7 +1394,7 @@ seat_get_touch(struct wl_client *client, struct wl_resource *resource,
 	}
 
 	add_client_resource(&seat->touch->resources, client, cr);
-	wl_resource_set_implementation(cr, NULL, seat, unbind_resource);
+	wl_resource_set_implementation(cr, &touch_interface, seat, unbind_resource);
 }
 
 static const struct wl_seat_interface seat_interface = {
@@ -1384,7 +1411,7 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
 	enum wl_seat_capability caps = 0;
 
 	resource = wl_resource_create(client,
-				      &wl_seat_interface, MIN(version, 2), id);
+				      &wl_seat_interface, MIN(version, 3), id);
 	wl_list_insert(&seat->base_resource_list, wl_resource_get_link(resource));
 	wl_resource_set_implementation(resource, &seat_interface, data,
 				       unbind_resource);
@@ -1651,7 +1678,7 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
 	wl_list_init(&seat->drag_resource_list);
 	wl_signal_init(&seat->destroy_signal);
 
-	seat->global = wl_global_create(ec->wl_display, &wl_seat_interface, 2,
+	seat->global = wl_global_create(ec->wl_display, &wl_seat_interface, 3,
 					seat, bind_seat);
 
 	seat->compositor = ec;
-- 
1.8.3.1



More information about the wayland-devel mailing list