[PATCH weston 2/4] evdev: Discard events from a touchscreen paired with an unplugged output

Ander Conselvan de Oliveira conselvan2 at gmail.com
Thu Apr 24 05:11:15 PDT 2014


From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>

Commit 17bccaed intended to make the events coming from a touchscreen
paired with an unplugged output to be discarded, while an unpaired one
would just choose a different output. However, the logic was inverted
causing the opposite to happen.

Later in commit 161c6c56, the default behavior was changed to map an
output to a default output if the one specified via udev is not
present. This change is reverted by this patch.

v2: undo the change from commit 161c6c56.

v3: deal with libinput too.
---
 src/evdev.c           | 2 +-
 src/libinput-device.c | 2 +-
 src/libinput-seat.c   | 4 +---
 src/udev-seat.c       | 4 +---
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index bc8e5ef..9d97c87 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 a67c119..753583a 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 8bf538c..6e83717 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 5e018de..dfeb17f 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);
-- 
1.8.3.2



More information about the wayland-devel mailing list