[PATCH weston 01/10] input: Add a seat name parameter to weston_seat_init

Rob Bradford robert.bradford at intel.com
Fri May 31 10:09:50 PDT 2013


From: Rob Bradford <rob at linux.intel.com>

---
 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 e250b98..c9194d0 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 e855ba6..defc6ab 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -898,6 +898,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;
@@ -930,7 +931,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 3d95d30..b4dc996 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 d253d87..9489161 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 483d799..f17edb4 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 2fba05b..22700b7 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 89f74f4..ae75054 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 7e62429..93dea2a 100644
--- a/src/udev-seat.c
+++ b/src/udev-seat.c
@@ -270,7 +270,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);
-- 
1.8.1.4



More information about the wayland-devel mailing list