diff --git a/src/evdev.c b/src/evdev.c index bc8e5efe..9d97c87c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -602,7 +602,7 @@ notify_output_destroy(struct wl_listener *listener, void *data) struct weston_compositor *c = device->seat->compositor; struct weston_output *output; - if (device->output_name) { + if (!device->output_name) { output = container_of(c->output_list.next, struct weston_output, link); evdev_device_set_output(device, output); diff --git a/src/libinput-device.c b/src/libinput-device.c index a67c1199..753583a0 100644 --- a/src/libinput-device.c +++ b/src/libinput-device.c @@ -264,7 +264,7 @@ notify_output_destroy(struct wl_listener *listener, void *data) struct weston_compositor *c = device->seat->compositor; struct weston_output *output; - if (device->output_name) { + if (!device->output_name) { output = container_of(c->output_list.next, struct weston_output, link); evdev_device_set_output(device, output); diff --git a/src/libinput-seat.c b/src/libinput-seat.c index acb29d78..e92834f9 100644 --- a/src/libinput-seat.c +++ b/src/libinput-seat.c @@ -84,9 +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); - } - - if (device->output == NULL) { + } else 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 cd2f6a90..c8468989 100644 --- a/src/udev-seat.c +++ b/src/udev-seat.c @@ -125,9 +125,7 @@ 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); - } - - if (device->output == NULL) { + } else if (device->output == NULL) { output = container_of(c->output_list.next, struct weston_output, link); evdev_device_set_output(device, output);