From 9af5f9e0fe9d5e81d0b733b92bb399c36ca5a512 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 31 May 2013 18:09:50 +0100 Subject: [PATCH] input: Add a seat name parameter to weston_seat_init --- src/compositor-headless.c | 2 +- src/compositor-rdp.c | 7 ++++++- src/compositor-rpi.c | 2 +- src/compositor-wayland.c | 2 +- src/compositor-x11.c | 2 +- src/compositor.h | 4 +++- src/input.c | 6 +++++- src/udev-seat.c | 2 +- 8 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/compositor-headless.c b/src/compositor-headless.c index e250b989..c9194d0c 100644 --- a/src/compositor-headless.c +++ b/src/compositor-headless.c @@ -172,7 +172,7 @@ headless_compositor_create(struct wl_display *display, if (weston_compositor_init(&c->base, display, argc, argv, config) < 0) goto err_free; - weston_seat_init(&c->fake_seat, &c->base); + weston_seat_init(&c->fake_seat, &c->base, "default"); c->base.destroy = headless_destroy; c->base.restore = headless_restore; diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c index b81d7895..93c3c161 100644 --- a/src/compositor-rdp.c +++ b/src/compositor-rdp.c @@ -915,6 +915,7 @@ rdp_peer_init(freerdp_peer *client, struct rdp_compositor *c) rdpSettings *settings; rdpInput *input; RdpPeerContext *peerCtx; + char seat_name[32]; client->context_size = sizeof(RdpPeerContext); client->ContextNew = (psPeerContextNew)rdp_peer_context_new; @@ -947,7 +948,11 @@ rdp_peer_init(freerdp_peer *client, struct rdp_compositor *c) input->ExtendedMouseEvent = xf_extendedMouseEvent; input->KeyboardEvent = xf_input_keyboard_event; input->UnicodeKeyboardEvent = xf_input_unicode_keyboard_event; - weston_seat_init(&peerCtx->item.seat, &c->base); + + if (snprintf(seat_name, 32, "rdp:%d:%s", client->sockfd, client->hostname) >= 32) + seat_name[31] = '\0'; + + weston_seat_init(&peerCtx->item.seat, &c->base, seat_name); client->Initialize(client); diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c index 3d95d303..b4dc9962 100644 --- a/src/compositor-rpi.c +++ b/src/compositor-rpi.c @@ -605,7 +605,7 @@ evdev_input_create(struct weston_compositor *c, struct udev *udev, return; memset(seat, 0, sizeof *seat); - weston_seat_init(&seat->base, c); + weston_seat_init(&seat->base, c, "default"); seat->base.led_update = rpi_led_update; wl_list_init(&seat->devices_list); diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index d253d87a..9489161e 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -638,7 +638,7 @@ display_add_seat(struct wayland_compositor *c, uint32_t id) memset(input, 0, sizeof *input); - weston_seat_init(&input->base, &c->base); + weston_seat_init(&input->base, &c->base, "default"); input->compositor = c; input->seat = wl_registry_bind(c->parent.registry, id, &wl_seat_interface, 1); diff --git a/src/compositor-x11.c b/src/compositor-x11.c index 483d7999..f17edb4a 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -291,7 +291,7 @@ x11_input_create(struct x11_compositor *c, int no_input) { struct xkb_keymap *keymap; - weston_seat_init(&c->core_seat, &c->base); + weston_seat_init(&c->core_seat, &c->base, "default"); if (no_input) return 0; diff --git a/src/compositor.h b/src/compositor.h index 2fba05b2..22700b76 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -447,6 +447,7 @@ struct weston_seat { } xkb_state; struct input_method *input_method; + char *seat_name; }; enum { @@ -1031,7 +1032,8 @@ void weston_output_destroy(struct weston_output *output); void -weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec); +weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec, + const char *seat_name); void weston_seat_init_pointer(struct weston_seat *seat); int diff --git a/src/input.c b/src/input.c index 89f74f4d..ae750549 100644 --- a/src/input.c +++ b/src/input.c @@ -1466,7 +1466,8 @@ weston_seat_init_touch(struct weston_seat *seat) } WL_EXPORT void -weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec) +weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec, + const char *seat_name) { memset(seat, 0, sizeof *seat); @@ -1482,6 +1483,7 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec) seat->compositor = ec; seat->modifier_state = 0; seat->num_tp = 0; + seat->seat_name = strdup(seat_name); wl_list_insert(ec->seat_list.prev, &seat->link); @@ -1507,5 +1509,7 @@ weston_seat_release(struct weston_seat *seat) if (seat->touch) weston_touch_destroy(seat->touch); + free (seat->seat_name); + wl_signal_emit(&seat->destroy_signal, seat); } diff --git a/src/udev-seat.c b/src/udev-seat.c index 12a531cb..dbbb80c2 100644 --- a/src/udev-seat.c +++ b/src/udev-seat.c @@ -271,7 +271,7 @@ udev_seat_create(struct weston_compositor *c, struct udev *udev, return NULL; memset(seat, 0, sizeof *seat); - weston_seat_init(&seat->base, c); + weston_seat_init(&seat->base, c, "default"); seat->base.led_update = drm_led_update; wl_list_init(&seat->devices_list);