commit 9e936d9
Michael Forney
·
2017-03-14 20:02:18 +0000 UTC
parent 8ea2a24
seat: Use netlink seat from my libinput branch
1 files changed,
+6,
-43
+6,
-43
1@@ -324,7 +324,7 @@ initialize_libinput(const char *seat_name)
2
3 seat.libinput = libinput_udev_create_context(&libinput_interface, NULL, seat.udev);
4 #else
5- seat.libinput = libinput_path_create_context(&libinput_interface, NULL);
6+ seat.libinput = libinput_netlink_create_context(&libinput_interface, NULL);
7 #endif
8
9 if (!seat.libinput) {
10@@ -337,6 +337,11 @@ initialize_libinput(const char *seat_name)
11 ERROR("Failed to assign seat to libinput context\n");
12 goto error2;
13 }
14+#else
15+ if (libinput_netlink_assign_seat(seat.libinput, seat_name) != 0) {
16+ ERROR("Failed to assign seat to libinput context\n");
17+ goto error2;
18+ }
19 #endif
20
21 seat.libinput_source = wl_event_loop_add_fd
22@@ -363,43 +368,6 @@ error0:
23 return false;
24 }
25
26-#ifndef ENABLE_LIBUDEV
27-static int
28-select_device(const struct dirent *entry)
29-{
30- unsigned num;
31- return sscanf(entry->d_name, "event%u", &num) == 1;
32-}
33-
34-static bool
35-add_devices(void)
36-{
37- struct dirent **devices;
38- int i, n;
39- char path[64];
40- struct libinput_device *device;
41-
42- n = scandir("/dev/input", &devices, &select_device, &alphasort);
43-
44- if (n == -1) {
45- ERROR("Failed to scan /dev/input for event devices\n");
46- return false;
47- }
48-
49- for (i = 0; i < n; ++i) {
50- snprintf(path, sizeof path, "/dev/input/%s", devices[i]->d_name);
51- free(devices[i]);
52- device = libinput_path_add_device(seat.libinput, path);
53- if (device)
54- update_capabilities(device_capabilities(device));
55- }
56-
57- free(devices);
58-
59- return true;
60-}
61-#endif
62-
63 bool
64 seat_initialize(const char *seat_name)
65 {
66@@ -440,11 +408,6 @@ seat_initialize(const char *seat_name)
67 if (!initialize_libinput(seat.name))
68 goto error5;
69
70-#ifndef ENABLE_LIBUDEV
71- if (!add_devices())
72- goto error5;
73-#endif
74-
75 return true;
76
77 error5: