[PATCH weston 07/20] evdev: pass weston_seat to evdev_input_device_create()

Pekka Paalanen ppaalanen at gmail.com
Fri Aug 3 04:39:03 PDT 2012


in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/evdev.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 40f6080..7a46a5c 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -469,7 +469,7 @@ evdev_configure_device(struct evdev_input_device *device)
 }
 
 static struct evdev_input_device *
-evdev_input_device_create(struct evdev_seat *master,
+evdev_input_device_create(struct weston_seat *seat,
 			  const char *path, int device_fd)
 {
 	struct evdev_input_device *device;
@@ -478,12 +478,13 @@ evdev_input_device_create(struct evdev_seat *master,
 	device = malloc(sizeof *device);
 	if (device == NULL)
 		return NULL;
+	memset(device, 0, sizeof *device);
 
-	ec = master->base.compositor;
+	ec = seat->compositor;
 	device->output =
 		container_of(ec->output_list.next, struct weston_output, link);
 
-	device->seat = &master->base;
+	device->seat = seat;
 	device->is_mt = 0;
 	device->mtdev = NULL;
 	device->devnode = strdup(path);
@@ -515,8 +516,6 @@ evdev_input_device_create(struct evdev_seat *master,
 	if (device->source == NULL)
 		goto err2;
 
-	wl_list_insert(master->devices_list.prev, &device->link);
-
 	return device;
 
 err2:
@@ -575,11 +574,14 @@ device_added(struct udev_device *udev_device, struct evdev_seat *master)
 		return;
 	}
 
-	device = evdev_input_device_create(master, devnode, fd);
+	device = evdev_input_device_create(&master->base, devnode, fd);
 	if (!device) {
 		close(fd);
 		weston_log("not using input device '%s'.\n", devnode);
+		return;
 	}
+
+	wl_list_insert(master->devices_list.prev, &device->link);
 }
 
 static void
-- 
1.7.8.6



More information about the wayland-devel mailing list