[PATCH weston 09/17] evdev: move seat_id into uevdev

Pekka Paalanen ppaalanen at gmail.com
Thu Jul 5 03:33:06 PDT 2012


Only udev-evdev uses seat_id, so move it there, away from evdev.c.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/evdev.c      |    5 +----
 src/evdev.h      |    4 +---
 src/udev-evdev.c |    9 ++++++---
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 1fca3b3..d6d23a6 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -60,20 +60,17 @@ evdev_led_update(struct weston_seat *seat_base, enum weston_led leds)
 }
 
 void
-evdev_seat_init(struct evdev_seat *seat, struct weston_compositor *compositor,
-		const char *seat_id)
+evdev_seat_init(struct evdev_seat *seat, struct weston_compositor *compositor)
 {
 	weston_seat_init(&seat->base, compositor);
 	seat->base.led_update = evdev_led_update;
 
 	wl_list_init(&seat->devices_list);
-	seat->seat_id = strdup(seat_id);
 }
 
 void
 evdev_seat_release(struct evdev_seat *seat)
 {
-	free(seat->seat_id);
 	weston_seat_release(&seat->base);
 }
 
diff --git a/src/evdev.h b/src/evdev.h
index 522c19d..8fe3eb8 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -30,7 +30,6 @@ struct evdev_seat {
 	struct weston_seat base;
 
 	struct wl_list devices_list;
-	char *seat_id;
 };
 
 #define MAX_SLOTS 16
@@ -112,8 +111,7 @@ struct evdev_dispatch *
 evdev_touchpad_create(struct evdev_input_device *device);
 
 void
-evdev_seat_init(struct evdev_seat *seat, struct weston_compositor *compositor,
-		const char *seat_id);
+evdev_seat_init(struct evdev_seat *seat, struct weston_compositor *compositor);
 
 void
 evdev_seat_release(struct evdev_seat *seat);
diff --git a/src/udev-evdev.c b/src/udev-evdev.c
index 426cb47..01b2509 100644
--- a/src/udev-evdev.c
+++ b/src/udev-evdev.c
@@ -34,6 +34,7 @@
 
 struct uevdev_seat {
 	struct evdev_seat evdev;
+	char *seat_id;
 
 	struct udev_monitor *udev_monitor;
 	struct wl_event_source *udev_monitor_source;
@@ -54,7 +55,7 @@ device_added(struct udev_device *udev_device, struct uevdev_seat *master)
 	if (!device_seat)
 		device_seat = default_seat;
 
-	if (strcmp(device_seat, master->evdev.seat_id))
+	if (strcmp(device_seat, master->seat_id))
 		return;
 
 	c = master->evdev.base.compositor;
@@ -233,10 +234,11 @@ uevdev_input_create(struct weston_compositor *c, struct udev *udev,
 		return;
 
 	memset(seat, 0, sizeof *seat);
-	evdev_seat_init(&seat->evdev, c, seat_id);
+	seat->seat_id = strdup(seat_id);
+	evdev_seat_init(&seat->evdev, c);
 
 	if (!uevdev_enable_udev_monitor(udev, &seat->evdev.base)) {
-		free(seat->evdev.seat_id);
+		free(seat->seat_id);
 		free(seat);
 		return;
 	}
@@ -267,5 +269,6 @@ uevdev_input_destroy(struct weston_seat *seat_base)
 	uevdev_disable_udev_monitor(&seat->evdev.base);
 
 	evdev_seat_release(&seat->evdev);
+	free(seat->seat_id);
 	free(seat);
 }
-- 
1.7.8.6



More information about the wayland-devel mailing list