Patch against 1.2 to support non-mt touchscreens

Rusty Lynch rusty.lynch at intel.com
Wed Jul 31 08:52:43 PDT 2013


>From 32b686d4cb3b9297e9054d497727a6f7cdbaf9ac Mon Sep 17 00:00:00 2001
From: Rusty Lynch <rusty.lynch at intel.com>
Date: Thu, 25 Jul 2013 11:24:20 -0700
Subject: [PATCH 1/2] Add support for old style non-multitouch touchscreens

---
 src/evdev.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/evdev.c b/src/evdev.c
index 08aa727..b3c99b3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -83,6 +83,11 @@ evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
 					 WL_POINTER_BUTTON_STATE_RELEASED);
 		break;
 
+	case BTN_TOUCH:
+		if (e->value == 0 && !device->is_mt)
+			notify_touch(device->seat, time, device->mt.slot, 0, 0,
+				     WL_TOUCH_UP);
+		break;
 	default:
 		notify_key(device->seat,
 			   time, e->code,
@@ -292,7 +297,14 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time)
 		weston_output_transform_coordinate(device->output,
 						   device->abs.x,
 						   device->abs.y, &x, &y);
-		notify_motion_absolute(master, time, x, y);
+		if (device->caps & EVDEV_TOUCH) {
+			if (master->num_tp == 0)
+				notify_touch(master, time, 0, x, y, WL_TOUCH_DOWN);
+			else
+				notify_touch(master, time, 0, x, y, WL_TOUCH_MOTION);
+		} else
+			notify_motion_absolute(master, time, x, y);
+
 		device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
 	}
 }
@@ -479,6 +491,11 @@ evdev_handle_device(struct evdev_device *device)
 				break;
 			}
 		}
+		if (TEST_BIT(key_bits, BTN_TOUCH)) {
+			device->caps |= EVDEV_TOUCH;
+			device->caps &= ~EVDEV_MOTION_ABS;
+		}
+
 	}
 	if (TEST_BIT(ev_bits, EV_LED)) {
 		device->caps |= EVDEV_KEYBOARD;
-- 
1.8.3.1





More information about the wayland-devel mailing list