From 8d51f141caf94e273802e4978a97f811355a90e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 15 Jul 2011 21:28:38 -0400 Subject: [PATCH] compositor: Use systemd seat configuration conventions http://www.freedesktop.org/wiki/Software/systemd/multiseat --- compositor/70-wayland.rules | 7 ------- compositor/Makefile.am | 5 ----- compositor/compositor-drm.c | 39 +++++++++++++++++++++++++++++---------- 3 files changed, 29 insertions(+), 22 deletions(-) delete mode 100644 compositor/70-wayland.rules diff --git a/compositor/70-wayland.rules b/compositor/70-wayland.rules deleted file mode 100644 index 1b7ca66..0000000 --- a/compositor/70-wayland.rules +++ /dev/null @@ -1,7 +0,0 @@ -KERNEL=="event*", ENV{ID_INPUT_KEYBOARD}=="1", ENV{WAYLAND_SEAT}="1" -KERNEL=="event*", ENV{ID_INPUT_MOUSE}=="1", ENV{WAYLAND_SEAT}="1" -KERNEL=="event*", ENV{ID_INPUT_TOUCHPAD}=="1", ENV{WAYLAND_SEAT}="1" -KERNEL=="event*", ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{WAYLAND_SEAT}="1" -KERNEL=="event*", ENV{ID_INPUT_TABLET}=="1", ENV{WAYLAND_SEAT}="1" -KERNEL=="card0", ENV{WAYLAND_SEAT}="1" - diff --git a/compositor/Makefile.am b/compositor/Makefile.am index 1e89822..a5b0078 100644 --- a/compositor/Makefile.am +++ b/compositor/Makefile.am @@ -26,11 +26,6 @@ xserver_launcher_sources = \ xserver-server-protocol.h endif -udevrulesddir = $(sysconfdir)/udev/rules.d - -dist_udevrulesd_DATA = \ - 70-wayland.rules - moduledir = @libdir@/wayland module_LTLIBRARIES = \ $(desktop_shell) \ diff --git a/compositor/compositor-drm.c b/compositor/compositor-drm.c index 12f4391..5e62d4c 100644 --- a/compositor/compositor-drm.c +++ b/compositor/compositor-drm.c @@ -730,14 +730,17 @@ vt_func(struct wlsc_compositor *compositor, int event) }; } +static const char default_seat[] = "seat0"; + static struct wlsc_compositor * -drm_compositor_create(struct wl_display *display, int connector) +drm_compositor_create(struct wl_display *display, + int connector, const char *seat) { struct drm_compositor *ec; struct udev_enumerate *e; struct udev_list_entry *entry; - struct udev_device *device; - const char *path; + struct udev_device *device, *drm_device; + const char *path, *device_seat; struct wl_event_loop *loop; ec = malloc(sizeof *ec); @@ -753,27 +756,38 @@ drm_compositor_create(struct wl_display *display, int connector) e = udev_enumerate_new(ec->udev); udev_enumerate_add_match_subsystem(e, "drm"); - udev_enumerate_add_match_property(e, "WAYLAND_SEAT", "1"); + udev_enumerate_scan_devices(e); - device = NULL; + drm_device = NULL; udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) { path = udev_list_entry_get_name(entry); device = udev_device_new_from_syspath(ec->udev, path); - break; + device_seat = + udev_device_get_property_value(device, "ID_SEAT"); + if (!device_seat) + device_seat = default_seat; + if (strcmp(device_seat, seat) == 0) { + drm_device = device; + break; + } + udev_device_unref(device); } + udev_enumerate_unref(e); - if (device == NULL) { + if (drm_device == NULL) { fprintf(stderr, "no drm device found\n"); return NULL; } ec->base.wl_display = display; - if (init_egl(ec, device) < 0) { + if (init_egl(ec, drm_device) < 0) { fprintf(stderr, "failed to initialize egl\n"); return NULL; } + udev_device_unref(drm_device); + ec->base.destroy = drm_destroy; ec->base.create_cursor_image = drm_compositor_create_cursor_image; @@ -825,18 +839,23 @@ WL_EXPORT struct wlsc_compositor * backend_init(struct wl_display *display, char *options) { int connector = 0, i; + const char *seat; char *p, *value; - static char * const tokens[] = { "connector", NULL }; + static char * const tokens[] = { "connector", "seat", NULL }; p = options; + seat = default_seat; while (i = getsubopt(&p, tokens, &value), i != -1) { switch (i) { case 0: connector = strtol(value, NULL, 0); break; + case 1: + seat = value; + break; } } - return drm_compositor_create(display, connector); + return drm_compositor_create(display, connector, seat); } -- 2.7.4