Depend on udev 136 and clean up some code.

dev
Kristian Høgsberg 16 years ago
parent b14852d7a2
commit f13eb14711
  1. 2
      configure.ac
  2. 45
      wayland-system-compositor.c

@ -5,7 +5,7 @@ PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(FFI, [libffi]) PKG_CHECK_MODULES(FFI, [libffi])
PKG_CHECK_MODULES(EGL_COMPOSITOR, PKG_CHECK_MODULES(EGL_COMPOSITOR,
[eagle libpng cairo gdk-pixbuf-2.0 libudev libdrm]) [eagle libpng cairo gdk-pixbuf-2.0 libudev >= 136 libdrm])
PKG_CHECK_MODULES(CLIENT, [eagle cairo glib-2.0 libudev]) PKG_CHECK_MODULES(CLIENT, [eagle cairo glib-2.0 libudev])
if test $CC = gcc; then if test $CC = gcc; then

@ -781,18 +781,6 @@ post_output_geometry(struct wl_client *client, struct wl_object *global)
output->width, output->height); output->width, output->height);
} }
static const char *
get_udev_property(struct udev_device *device, const char *name)
{
struct udev_list_entry *entry;
udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(device))
if (strcmp(udev_list_entry_get_name(entry), name) == 0)
return udev_list_entry_get_value(entry);
return NULL;
}
static int static int
init_egl(struct egl_compositor *ec, struct udev_device *device) init_egl(struct egl_compositor *ec, struct udev_device *device)
{ {
@ -1084,19 +1072,9 @@ init_libudev(struct egl_compositor *ec)
struct udev_enumerate *e; struct udev_enumerate *e;
struct udev_list_entry *entry; struct udev_list_entry *entry;
struct udev_device *device; struct udev_device *device;
const char *path, *seat; const char *path;
struct wlsc_input_device *input_device; struct wlsc_input_device *input_device;
/* FIXME: Newer (version 135+) udev has two new features that
* make all this much easier: 1) we can enumerate by a
* specific property. This lets us directly iterate through
* the devices we care about. 2) We can attach properties to
* sysfs nodes without a device file, which lets us configure
* which connectors belong to a seat instead of tagging the
* overall drm node. I don't want to update my system udev,
* so I'm going to stick with this until the new version is in
* rawhide. */
ec->udev = udev_new(); ec->udev = udev_new();
if (ec->udev == NULL) { if (ec->udev == NULL) {
fprintf(stderr, "failed to initialize udev context\n"); fprintf(stderr, "failed to initialize udev context\n");
@ -1106,26 +1084,29 @@ init_libudev(struct egl_compositor *ec)
input_device = create_input_device(ec); input_device = create_input_device(ec);
e = udev_enumerate_new(ec->udev); e = udev_enumerate_new(ec->udev);
udev_enumerate_add_match_subsystem(e, "input");
udev_enumerate_add_match_property(e, "WAYLAND_SEAT", "1");
udev_enumerate_scan_devices(e); udev_enumerate_scan_devices(e);
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) { udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
path = udev_list_entry_get_name(entry); path = udev_list_entry_get_name(entry);
device = udev_device_new_from_syspath(ec->udev, path); device = udev_device_new_from_syspath(ec->udev, path);
/* FIXME: Should the property namespace be CK for console kit? */
seat = get_udev_property(device, "WAYLAND_SEAT");
if (!seat || strcmp(seat, "1") != 0)
continue;
if (strcmp(udev_device_get_subsystem(device), "input") == 0) {
evdev_input_device_create(input_device, ec->wl_display, evdev_input_device_create(input_device, ec->wl_display,
udev_device_get_devnode(device)); udev_device_get_devnode(device));
} else if (strcmp(udev_device_get_subsystem(device), "drm") == 0) { }
udev_enumerate_unref(e);
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);
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);
if (create_output(ec, device) < 0) { if (create_output(ec, device) < 0) {
fprintf(stderr, "failed to create output for %s\n", path); fprintf(stderr, "failed to create output for %s\n", path);
return -1; return -1;
} }
} }
}
udev_enumerate_unref(e); udev_enumerate_unref(e);
/* Create the pointer surface now that we have a current EGL context. */ /* Create the pointer surface now that we have a current EGL context. */

Loading…
Cancel
Save