From: Rob Bradford <[email protected]>

Since we bump the version we ask for from the compositor it is also
necessary to implement the new "name" event in the seat listener.
---
 clients/window.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/clients/window.c b/clients/window.c
index 3410354..325d184 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -130,6 +130,7 @@ struct display {
        void *dummy_surface_data;
 
        int has_rgb565;
+       int seat_version;
 };
 
 enum {
@@ -3377,8 +3378,16 @@ seat_handle_capabilities(void *data, struct wl_seat 
*seat,
        }
 }
 
+static void
+seat_handle_name(void *data, struct wl_seat *seat,
+                const char *name)
+{
+
+}
+
 static const struct wl_seat_listener seat_listener = {
        seat_handle_capabilities,
+       seat_handle_name
 };
 
 void
@@ -4915,6 +4924,8 @@ fini_xkb(struct input *input)
        xkb_map_unref(input->xkb.keymap);
 }
 
+#define MAX(a,b) ((a) > (b) ? a : b)
+
 static void
 display_add_input(struct display *d, uint32_t id)
 {
@@ -4925,7 +4936,8 @@ display_add_input(struct display *d, uint32_t id)
                return;
 
        input->display = d;
-       input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 1);
+       input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface,
+                                      MAX(d->seat_version, 3));
        input->pointer_focus = NULL;
        input->keyboard_focus = NULL;
        wl_list_init(&input->touch_point_list);
@@ -4962,6 +4974,14 @@ input_destroy(struct input *input)
                data_offer_destroy(input->selection_offer);
 
        wl_data_device_destroy(input->data_device);
+
+       if (input->display->seat_version >= 3) {
+               if (input->pointer)
+                       wl_pointer_release(input->pointer);
+               if (input->keyboard)
+                       wl_keyboard_release(input->keyboard);
+       }
+
        fini_xkb(input);
 
        wl_surface_destroy(input->pointer_surface);
@@ -5016,6 +5036,7 @@ registry_handle_global(void *data, struct wl_registry 
*registry, uint32_t id,
        } else if (strcmp(interface, "wl_output") == 0) {
                display_add_output(d, id);
        } else if (strcmp(interface, "wl_seat") == 0) {
+               d->seat_version = version;
                display_add_input(d, id);
        } else if (strcmp(interface, "wl_shell") == 0) {
                d->shell = wl_registry_bind(registry,
-- 
1.8.3.1

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to