mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-21 06:20:09 +01:00
input: fix input device map to output if it doesn't exist.
If an input device wants to map to an output that does not exist, then just map it to the first output. Also, if a device is mapped to an output that gets unplugged then it gets default mapped to the first output in the output destroy listener. However, the original output destroy listener needs to be removed before adding the new listener for the first output, otherwise the list gets corrupted. Later if the other output is plugged back in, we remap the device to it. In that case, we should remove the destroy listener for the first output. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77341 Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
This commit is contained in:
parent
cd9e54537a
commit
161c6c5694
4 changed files with 16 additions and 2 deletions
|
|
@ -615,6 +615,11 @@ void
|
||||||
evdev_device_set_output(struct evdev_device *device,
|
evdev_device_set_output(struct evdev_device *device,
|
||||||
struct weston_output *output)
|
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 = output;
|
||||||
device->output_destroy_listener.notify = notify_output_destroy;
|
device->output_destroy_listener.notify = notify_output_destroy;
|
||||||
wl_signal_add(&output->destroy_signal,
|
wl_signal_add(&output->destroy_signal,
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,11 @@ void
|
||||||
evdev_device_set_output(struct evdev_device *device,
|
evdev_device_set_output(struct evdev_device *device,
|
||||||
struct weston_output *output)
|
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 = output;
|
||||||
device->output_destroy_listener.notify = notify_output_destroy;
|
device->output_destroy_listener.notify = notify_output_destroy;
|
||||||
wl_signal_add(&output->destroy_signal,
|
wl_signal_add(&output->destroy_signal,
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,9 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device)
|
||||||
wl_list_for_each(output, &c->output_list, link)
|
wl_list_for_each(output, &c->output_list, link)
|
||||||
if (strcmp(output->name, device->output_name) == 0)
|
if (strcmp(output->name, device->output_name) == 0)
|
||||||
evdev_device_set_output(device, output);
|
evdev_device_set_output(device, output);
|
||||||
} else if (device->output == NULL) {
|
}
|
||||||
|
|
||||||
|
if (device->output == NULL) {
|
||||||
output = container_of(c->output_list.next,
|
output = container_of(c->output_list.next,
|
||||||
struct weston_output, link);
|
struct weston_output, link);
|
||||||
evdev_device_set_output(device, output);
|
evdev_device_set_output(device, output);
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,9 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
|
||||||
wl_list_for_each(output, &c->output_list, link)
|
wl_list_for_each(output, &c->output_list, link)
|
||||||
if (strcmp(output->name, device->output_name) == 0)
|
if (strcmp(output->name, device->output_name) == 0)
|
||||||
evdev_device_set_output(device, output);
|
evdev_device_set_output(device, output);
|
||||||
} else if (device->output == NULL) {
|
}
|
||||||
|
|
||||||
|
if (device->output == NULL) {
|
||||||
output = container_of(c->output_list.next,
|
output = container_of(c->output_list.next,
|
||||||
struct weston_output, link);
|
struct weston_output, link);
|
||||||
evdev_device_set_output(device, output);
|
evdev_device_set_output(device, output);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue