summaryrefslogtreecommitdiff
path: root/src/libinput-seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libinput-seat.c')
-rw-r--r--src/libinput-seat.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/libinput-seat.c b/src/libinput-seat.c
index b6adc76b..a38d4705 100644
--- a/src/libinput-seat.c
+++ b/src/libinput-seat.c
@@ -84,7 +84,7 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device)
wl_list_for_each(output, &c->output_list, link)
if (strcmp(output->name, device->output_name) == 0)
evdev_device_set_output(device, output);
- } else if (device->output == NULL) {
+ } else if (device->output == NULL && !wl_list_empty(&c->output_list)) {
output = container_of(c->output_list.next,
struct weston_output, link);
evdev_device_set_output(device, output);
@@ -251,14 +251,30 @@ udev_input_enable(struct udev_input *input)
return 0;
}
+static void
+libinput_log_func(enum libinput_log_priority priority, void *user_data,
+ const char *format, va_list args)
+{
+ weston_vlog(format, args);
+}
+
int
udev_input_init(struct udev_input *input, struct weston_compositor *c, struct udev *udev,
const char *seat_id)
{
+ const char *log_priority = NULL;
+
memset(input, 0, sizeof *input);
input->compositor = c;
+ libinput_log_set_handler(&libinput_log_func, NULL);
+
+ log_priority = getenv("WESTON_LIBINPUT_LOG_PRIORITY");
+ if (log_priority) {
+ libinput_log_set_priority(strtol(log_priority, NULL, 10));
+ }
+
input->libinput = libinput_udev_create_for_seat(&libinput_interface, input,
udev, seat_id);
if (!input->libinput) {
@@ -298,12 +314,15 @@ notify_output_create(struct wl_listener *listener, void *data)
struct evdev_device *device;
struct weston_output *output = data;
- wl_list_for_each(device, &seat->devices_list, link)
+ wl_list_for_each(device, &seat->devices_list, link) {
if (device->output_name &&
strcmp(output->name, device->output_name) == 0) {
evdev_device_set_output(device, output);
- break;
}
+
+ if (device->output_name == NULL && device->output == NULL)
+ evdev_device_set_output(device, output);
+ }
}
static struct udev_seat *
@@ -313,9 +332,9 @@ udev_seat_create(struct udev_input *input, const char *seat_name)
struct udev_seat *seat;
seat = zalloc(sizeof *seat);
-
if (!seat)
return NULL;
+
weston_seat_init(&seat->base, c, seat_name);
seat->base.led_update = udev_seat_led_update;