input: Re-pair touch screen when monitor is plugged in

https://bugs.freedesktop.org/show_bug.cgi?id=73442
parent 70f29019
......@@ -658,6 +658,7 @@ evdev_device_destroy(struct evdev_device *device)
close(device->fd);
free(device->devname);
free(device->devnode);
free(device->output_name);
free(device);
}
......
......@@ -55,6 +55,7 @@ struct evdev_device {
struct evdev_dispatch *dispatch;
char *devnode;
char *devname;
char *output_name;
int fd;
struct {
int min_x, max_x, min_y, max_y;
......
......@@ -123,8 +123,9 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
output_name = udev_device_get_property_value(udev_device, "WL_OUTPUT");
if (output_name) {
device->output_name = strdup(output_name);
wl_list_for_each(output, &c->output_list, link)
if (strcmp(output->name, output_name) == 0)
if (strcmp(output->name, device->output_name) == 0)
device->output = output;
}
......@@ -343,6 +344,20 @@ drm_led_update(struct weston_seat *seat_base, enum weston_led leds)
evdev_led_update(device, leds);
}
static void
notify_output_create(struct wl_listener *listener, void *data)
{
struct udev_seat *seat = container_of(listener, struct udev_seat,
output_create_listener);
struct evdev_device *device;
struct weston_output *output = data;
wl_list_for_each(device, &seat->devices_list, link)
if (device->output_name &&
strcmp(output->name, device->output_name) == 0)
device->output = output;
}
static struct udev_seat *
udev_seat_create(struct weston_compositor *c, const char *seat_name)
{
......@@ -355,6 +370,10 @@ udev_seat_create(struct weston_compositor *c, const char *seat_name)
weston_seat_init(&seat->base, c, seat_name);
seat->base.led_update = drm_led_update;
seat->output_create_listener.notify = notify_output_create;
wl_signal_add(&c->output_created_signal,
&seat->output_create_listener);
wl_list_init(&seat->devices_list);
return seat;
}
......@@ -363,6 +382,7 @@ static void
udev_seat_destroy(struct udev_seat *seat)
{
weston_seat_release(&seat->base);
wl_list_remove(&seat->output_create_listener.link);
free(seat);
}
......
......@@ -32,6 +32,7 @@
struct udev_seat {
struct weston_seat base;
struct wl_list devices_list;
struct wl_listener output_create_listener;
};
struct udev_input {
......@@ -42,7 +43,6 @@ struct udev_input {
int enabled;
};
int udev_input_enable(struct udev_input *input, struct udev *udev);
void udev_input_disable(struct udev_input *input);
int udev_input_init(struct udev_input *input,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment