diff --git a/src/evdev.c b/src/evdev.c index d9b7d320..bc8e5efe 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -615,6 +615,11 @@ void evdev_device_set_output(struct evdev_device *device, struct weston_output *output) { + if (device->output_destroy_listener.notify) { + wl_list_remove(&device->output_destroy_listener.link); + device->output_destroy_listener.notify = NULL; + } + device->output = output; device->output_destroy_listener.notify = notify_output_destroy; wl_signal_add(&output->destroy_signal, diff --git a/src/libinput-device.c b/src/libinput-device.c index 2105aded..6a321a4c 100644 --- a/src/libinput-device.c +++ b/src/libinput-device.c @@ -259,6 +259,11 @@ void evdev_device_set_output(struct evdev_device *device, struct weston_output *output) { + if (device->output_destroy_listener.notify) { + wl_list_remove(&device->output_destroy_listener.link); + device->output_destroy_listener.notify = NULL; + } + device->output = output; device->output_destroy_listener.notify = notify_output_destroy; wl_signal_add(&output->destroy_signal, diff --git a/src/libinput-seat.c b/src/libinput-seat.c index 7aca969f..358c9fdc 100644 --- a/src/libinput-seat.c +++ b/src/libinput-seat.c @@ -84,7 +84,9 @@ 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) { + } + + if (device->output == NULL) { output = container_of(c->output_list.next, struct weston_output, link); evdev_device_set_output(device, output); diff --git a/src/udev-seat.c b/src/udev-seat.c index 7e4330a3..f875e09f 100644 --- a/src/udev-seat.c +++ b/src/udev-seat.c @@ -125,7 +125,9 @@ device_added(struct udev_device *udev_device, struct udev_input *input) 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) { + } + + if (device->output == NULL) { output = container_of(c->output_list.next, struct weston_output, link); evdev_device_set_output(device, output);