commit 9e936d909df5586f15568e76e85c82ca36cdcbf5
parent 8ea2a241bb848d3c8d5ef7ce277b46d9d8fa072e
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 14 Mar 2017 13:02:18 -0700
seat: Use netlink seat from my libinput branch
Diffstat:
M | libswc/seat.c | | | 49 | ++++++------------------------------------------- |
1 file changed, 6 insertions(+), 43 deletions(-)
diff --git a/libswc/seat.c b/libswc/seat.c
@@ -324,7 +324,7 @@ initialize_libinput(const char *seat_name)
seat.libinput = libinput_udev_create_context(&libinput_interface, NULL, seat.udev);
#else
- seat.libinput = libinput_path_create_context(&libinput_interface, NULL);
+ seat.libinput = libinput_netlink_create_context(&libinput_interface, NULL);
#endif
if (!seat.libinput) {
@@ -337,6 +337,11 @@ initialize_libinput(const char *seat_name)
ERROR("Failed to assign seat to libinput context\n");
goto error2;
}
+#else
+ if (libinput_netlink_assign_seat(seat.libinput, seat_name) != 0) {
+ ERROR("Failed to assign seat to libinput context\n");
+ goto error2;
+ }
#endif
seat.libinput_source = wl_event_loop_add_fd
@@ -363,43 +368,6 @@ error0:
return false;
}
-#ifndef ENABLE_LIBUDEV
-static int
-select_device(const struct dirent *entry)
-{
- unsigned num;
- return sscanf(entry->d_name, "event%u", &num) == 1;
-}
-
-static bool
-add_devices(void)
-{
- struct dirent **devices;
- int i, n;
- char path[64];
- struct libinput_device *device;
-
- n = scandir("/dev/input", &devices, &select_device, &alphasort);
-
- if (n == -1) {
- ERROR("Failed to scan /dev/input for event devices\n");
- return false;
- }
-
- for (i = 0; i < n; ++i) {
- snprintf(path, sizeof path, "/dev/input/%s", devices[i]->d_name);
- free(devices[i]);
- device = libinput_path_add_device(seat.libinput, path);
- if (device)
- update_capabilities(device_capabilities(device));
- }
-
- free(devices);
-
- return true;
-}
-#endif
-
bool
seat_initialize(const char *seat_name)
{
@@ -440,11 +408,6 @@ seat_initialize(const char *seat_name)
if (!initialize_libinput(seat.name))
goto error5;
-#ifndef ENABLE_LIBUDEV
- if (!add_devices())
- goto error5;
-#endif
-
return true;
error5: