{
int32_t cx, cy;
int slot;
+ int seat_slot;
struct libinput_device *base = &device->base;
+ struct libinput_seat *seat = base->seat;
slot = device->mt.slot;
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
break;
+ seat_slot = ffs(~seat->slot_map) - 1;
+ device->mt.slots[slot].seat_slot = seat_slot;
+
+ if (seat_slot == -1)
+ break;
+
+ seat->slot_map |= 1 << seat_slot;
+
touch_notify_touch(base,
time,
slot,
+ seat_slot,
li_fixed_from_int(device->mt.slots[slot].x),
li_fixed_from_int(device->mt.slots[slot].y),
LIBINPUT_TOUCH_TYPE_DOWN);
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
break;
+ seat_slot = device->mt.slots[slot].seat_slot;
+
+ if (seat_slot == -1)
+ break;
+
touch_notify_touch(base,
time,
slot,
+ seat_slot,
li_fixed_from_int(device->mt.slots[slot].x),
li_fixed_from_int(device->mt.slots[slot].y),
LIBINPUT_TOUCH_TYPE_MOTION);
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
break;
+ seat_slot = device->mt.slots[slot].seat_slot;
+
+ if (seat_slot == -1)
+ break;
+
+ seat->slot_map &= ~(1 << seat_slot);
+
touch_notify_touch(base,
time,
slot,
+ seat_slot,
0, 0,
LIBINPUT_TOUCH_TYPE_UP);
break;
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
break;
+ seat_slot = ffs(~seat->slot_map) - 1;
+ device->abs.seat_slot = seat_slot;
+
+ if (seat_slot == -1)
+ break;
+
+ seat->slot_map |= 1 << seat_slot;
+
transform_absolute(device, &cx, &cy);
touch_notify_touch(base,
time,
-1,
+ seat_slot,
li_fixed_from_int(cx),
li_fixed_from_int(cy),
LIBINPUT_TOUCH_TYPE_DOWN);
case EVDEV_ABSOLUTE_MOTION:
transform_absolute(device, &cx, &cy);
if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
+ seat_slot = device->abs.seat_slot;
+
+ if (seat_slot == -1)
+ break;
+
touch_notify_touch(base,
time,
-1,
+ seat_slot,
li_fixed_from_int(cx),
li_fixed_from_int(cy),
LIBINPUT_TOUCH_TYPE_DOWN);
if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
break;
+ seat_slot = device->abs.seat_slot;
+
+ if (seat_slot == -1)
+ break;
+
+ seat->slot_map &= ~(1 << seat_slot);
+
touch_notify_touch(base,
time,
-1,
+ seat_slot,
0, 0,
LIBINPUT_TOUCH_TYPE_UP);
break;
struct libinput_event base;
uint32_t time;
int32_t slot;
+ int32_t seat_slot;
li_fixed_t x;
li_fixed_t y;
enum libinput_touch_type touch_type;
return event->slot;
}
+LIBINPUT_EXPORT int32_t
+libinput_event_touch_get_seat_slot(struct libinput_event_touch *event)
+{
+ return event->seat_slot;
+}
+
LIBINPUT_EXPORT li_fixed_t
libinput_event_touch_get_x(struct libinput_event_touch *event)
{
touch_notify_touch(struct libinput_device *device,
uint32_t time,
int32_t slot,
+ int32_t seat_slot,
li_fixed_t x,
li_fixed_t y,
enum libinput_touch_type touch_type)
*touch_event = (struct libinput_event_touch) {
.time = time,
.slot = slot,
+ .seat_slot = seat_slot,
.x = x,
.y = y,
.touch_type = touch_type,
/**
* @ingroup event_touch
*
+ * Get the seat slot of the touch event. A seat slot is a non-negative seat
+ * wide unique identifier of an active touch point.
+ *
+ * Events from single touch devices will be represented as one individual
+ * touch point per device.
+ *
+ * @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
+ *
+ * @return The seat slot of the touch event
+ */
+int32_t
+libinput_event_touch_get_seat_slot(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
* Return the current absolute x coordinate of the touch event.
*
* The coordinate is in a device specific coordinate space; to get the
print_event_time(libinput_event_touch_get_time(t));
- printf("%6s %d %5.2f/%5.2f\n",
+ printf("%6s %d (%d) %5.2f/%5.2f\n",
type,
libinput_event_touch_get_slot(t),
+ libinput_event_touch_get_seat_slot(t),
li_fixed_to_double(x),
li_fixed_to_double(y));
}