[PATCH libinput 4/5] evdev: Use -1 to represent touch events slots from single touch devices

Jonas Ådahl jadahl at gmail.com
Wed Feb 12 12:36:41 PST 2014


Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 src/evdev.c    | 8 +++++---
 src/libinput.h | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index d8dff65..3fe28e4 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -163,7 +163,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
 		transform_absolute(device, &cx, &cy);
 		touch_notify_touch(base,
 				   time,
-				   slot,
+				   -1,
 				   li_fixed_from_int(cx),
 				   li_fixed_from_int(cy),
 				   LIBINPUT_TOUCH_TYPE_DOWN);
@@ -173,7 +173,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
 		if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
 			touch_notify_touch(base,
 					   time,
-					   slot,
+					   -1,
 					   li_fixed_from_int(cx),
 					   li_fixed_from_int(cy),
 					   LIBINPUT_TOUCH_TYPE_DOWN);
@@ -190,7 +190,9 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
 
 		touch_notify_touch(base,
 				   time,
-				   0, 0, 0, LIBINPUT_TOUCH_TYPE_UP);
+				   -1,
+				   0, 0,
+				   LIBINPUT_TOUCH_TYPE_UP);
 		break;
 	default:
 		assert(0 && "Unknown pending event type");
diff --git a/src/libinput.h b/src/libinput.h
index b5e881a..30b6011 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -558,6 +558,9 @@ libinput_event_touch_get_time(struct libinput_event_touch *event);
  * Get the slot of this touch event. See the kernel's multitouch
  * protocol B documentation for more information.
  *
+ * If the touch event has no assigned slot, for example if it is from a
+ * single touch device, this function returns -1.
+ *
  * @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
  *
  * @return The slot of this touch event
-- 
1.8.3.2



More information about the wayland-devel mailing list