}
}
+static inline int
+evdev_need_touch_frame(struct evdev_device *device)
+{
+ switch (device->pending_event) {
+ case EVDEV_NONE:
+ case EVDEV_RELATIVE_MOTION:
+ break;
+ case EVDEV_ABSOLUTE_MT_DOWN:
+ case EVDEV_ABSOLUTE_MT_MOTION:
+ case EVDEV_ABSOLUTE_MT_UP:
+ case EVDEV_ABSOLUTE_TOUCH_DOWN:
+ case EVDEV_ABSOLUTE_TOUCH_UP:
+ return 1;
+ case EVDEV_ABSOLUTE_MOTION:
+ if (device->seat_caps & EVDEV_DEVICE_TOUCH)
+ return 1;
+ break;
+ }
+
+ return 0;
+}
+
static void
fallback_process(struct evdev_dispatch *dispatch,
struct evdev_device *device,
struct input_event *event,
uint32_t time)
{
+ int need_frame = 0;
+
switch (event->type) {
case EV_REL:
evdev_process_relative(device, event, time);
evdev_process_key(device, event, time);
break;
case EV_SYN:
+ need_frame = evdev_need_touch_frame(device);
evdev_flush_pending_event(device, time);
+ if (need_frame)
+ touch_notify_frame(&device->base, time);
break;
}
}
li_fixed_t y,
enum libinput_touch_type touch_type);
+void
+touch_notify_frame(struct libinput_device *device,
+ uint32_t time);
#endif /* LIBINPUT_PRIVATE_H */
case LIBINPUT_EVENT_POINTER_AXIS:
return (struct libinput_event_pointer*)event;
case LIBINPUT_EVENT_TOUCH_TOUCH:
+ case LIBINPUT_EVENT_TOUCH_FRAME:
break;
}
case LIBINPUT_EVENT_POINTER_BUTTON:
case LIBINPUT_EVENT_POINTER_AXIS:
case LIBINPUT_EVENT_TOUCH_TOUCH:
+ case LIBINPUT_EVENT_TOUCH_FRAME:
break;
}
case LIBINPUT_EVENT_POINTER_AXIS:
break;
case LIBINPUT_EVENT_TOUCH_TOUCH:
+ case LIBINPUT_EVENT_TOUCH_FRAME:
return (struct libinput_event_touch*)event;
}
case LIBINPUT_EVENT_POINTER_BUTTON:
case LIBINPUT_EVENT_POINTER_AXIS:
case LIBINPUT_EVENT_TOUCH_TOUCH:
+ case LIBINPUT_EVENT_TOUCH_FRAME:
break;
}
case LIBINPUT_EVENT_POINTER_BUTTON:
case LIBINPUT_EVENT_POINTER_AXIS:
case LIBINPUT_EVENT_TOUCH_TOUCH:
+ case LIBINPUT_EVENT_TOUCH_FRAME:
return LIBINPUT_EVENT_CLASS_DEVICE;
}
&touch_event->base);
}
+void
+touch_notify_frame(struct libinput_device *device,
+ uint32_t time)
+{
+ struct libinput_event_touch *touch_event;
+
+ touch_event = zalloc(sizeof *touch_event);
+ if (!touch_event)
+ return;
+
+ *touch_event = (struct libinput_event_touch) {
+ .time = time,
+ };
+
+ post_device_event(device,
+ LIBINPUT_EVENT_TOUCH_FRAME,
+ &touch_event->base);
+}
+
+
static void
libinput_post_event(struct libinput *libinput,
struct libinput_event *event)
* sequence down, motion, up, with the number of motion events being zero or
* greater. If a touch point was used for gesture interpretation internally
* and will not generate any further events, the touchpoint is cancelled.
- *
- * A frame event is set after a set of touchpoints that constitute one
- * logical set of points at a sampling point.
*/
enum libinput_touch_type {
LIBINPUT_TOUCH_TYPE_DOWN = 0,
LIBINPUT_TOUCH_TYPE_UP = 1,
LIBINPUT_TOUCH_TYPE_MOTION = 2,
- LIBINPUT_TOUCH_TYPE_FRAME = 3,
LIBINPUT_TOUCH_TYPE_CANCEL = 4
};
LIBINPUT_EVENT_POINTER_BUTTON,
LIBINPUT_EVENT_POINTER_AXIS,
- LIBINPUT_EVENT_TOUCH_TOUCH = 500
+ LIBINPUT_EVENT_TOUCH_TOUCH = 500,
+ /**
+ * Signals the end of a set of touchpoints at one device sample
+ * time. This event has no coordinate information attached.
+ */
+ LIBINPUT_EVENT_TOUCH_FRAME
};
struct libinput;
struct libinput_event_device_notify;
struct libinput_event_keyboard;
struct libinput_event_pointer;
+
+/**
+ * @ingroup event_touch
+ * @struct libinput_event_touch
+ *
+ * Touch event representing a touch down, move or up, as well as a touch
+ * cancel and touch frame events. Valid event types for this event are @ref
+ * LIBINPUT_EVENT_TOUCH_TOUCH and @ref LIBINPUT_EVENT_TOUCH_FRAME.
+ */
struct libinput_event_touch;
/**
* Get the currently active slot on this device. See the kernel's multitouch
* protocol B documentation for more information.
*
+ * @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
+ *
* @return The currently active slot on this multitouch device
*/
uint32_t
/**
* @ingroup event_touch
*
+ * @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
+ *
* @return the absolute X coordinate on this touch device, scaled to screen coordinates.
*/
li_fixed_t
/**
* @ingroup event_touch
*
+ * @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
+ *
* @return the absolute X coordinate on this touch device, scaled to screen coordinates.
*/
li_fixed_t
/**
* @ingroup event_touch
*
+ * @note this function should not be called for LIBINPUT_EVENT_TOUCH_FRAME.
+ *
* @return the type of touch that occured on the device
*/
enum libinput_touch_type