compositor: Use systemd seats for input devices as well

dev
Kristian Høgsberg 14 years ago
parent 8d51f141ca
commit 86ec8e80d8
  1. 2
      compositor/compositor-drm.c
  2. 3
      compositor/compositor.h
  3. 17
      compositor/evdev.c

@ -805,7 +805,7 @@ drm_compositor_create(struct wl_display *display,
return NULL;
}
evdev_input_add_devices(&ec->base, ec->udev);
evdev_input_add_devices(&ec->base, ec->udev, seat);
loop = wl_display_get_event_loop(ec->base.wl_display);
ec->drm_source =

@ -366,7 +366,8 @@ void
wlsc_switcher_init(struct wlsc_compositor *compositor);
void
evdev_input_add_devices(struct wlsc_compositor *c, struct udev *udev);
evdev_input_add_devices(struct wlsc_compositor *c,
struct udev *udev, const char *seat);
enum {
TTY_ENTER_VT,

@ -210,13 +210,17 @@ evdev_input_device_create(struct evdev_input *master,
return device;
}
static const char default_seat[] = "seat0";
void
evdev_input_add_devices(struct wlsc_compositor *c, struct udev *udev)
evdev_input_add_devices(struct wlsc_compositor *c,
struct udev *udev, const char *seat)
{
struct evdev_input *input;
struct udev_enumerate *e;
struct udev_list_entry *entry;
struct udev_device *device;
const char *device_seat;
const char *path;
input = malloc(sizeof *input);
@ -228,14 +232,23 @@ evdev_input_add_devices(struct wlsc_compositor *c, struct udev *udev)
e = udev_enumerate_new(udev);
udev_enumerate_add_match_subsystem(e, "input");
udev_enumerate_add_match_property(e, "WAYLAND_SEAT", "1");
udev_enumerate_scan_devices(e);
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
path = udev_list_entry_get_name(entry);
device = udev_device_new_from_syspath(udev, path);
device_seat =
udev_device_get_property_value(device, "ID_SEAT");
if (!device_seat)
device_seat = default_seat;
if (strcmp(device_seat, seat) == 0) {
evdev_input_device_create(input, c->wl_display,
udev_device_get_devnode(device));
}
udev_device_unref(device);
}
udev_enumerate_unref(e);
c->input_device = &input->base.input_device;

Loading…
Cancel
Save