|
|
|
@ -42,6 +42,12 @@ Event *Event::create(libinput_event *event)
|
|
|
|
|
case LIBINPUT_EVENT_POINTER_MOTION:
|
|
|
|
|
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
|
|
|
|
return new PointerEvent(event, t);
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_DOWN:
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_UP:
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_MOTION:
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_FRAME:
|
|
|
|
|
return new TouchEvent(event, t);
|
|
|
|
|
default:
|
|
|
|
|
return new Event(event, t);
|
|
|
|
|
}
|
|
|
|
@ -165,5 +171,38 @@ qreal PointerEvent::axisValue(InputRedirection::PointerAxis axis) const
|
|
|
|
|
return libinput_event_pointer_get_axis_value(m_pointerEvent, a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TouchEvent::TouchEvent(libinput_event *event, libinput_event_type type)
|
|
|
|
|
: Event(event, type)
|
|
|
|
|
, m_touchEvent(libinput_event_get_touch_event(event))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TouchEvent::~TouchEvent() = default;
|
|
|
|
|
|
|
|
|
|
quint32 TouchEvent::time() const
|
|
|
|
|
{
|
|
|
|
|
return libinput_event_touch_get_time(m_touchEvent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QPointF TouchEvent::absolutePos() const
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT(type() == LIBINPUT_EVENT_TOUCH_DOWN || type() == LIBINPUT_EVENT_TOUCH_MOTION);
|
|
|
|
|
return QPointF(libinput_event_touch_get_x(m_touchEvent),
|
|
|
|
|
libinput_event_touch_get_y(m_touchEvent));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QPointF TouchEvent::absolutePos(const QSize &size) const
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT(type() == LIBINPUT_EVENT_TOUCH_DOWN || type() == LIBINPUT_EVENT_TOUCH_MOTION);
|
|
|
|
|
return QPointF(libinput_event_touch_get_x_transformed(m_touchEvent, size.width()),
|
|
|
|
|
libinput_event_touch_get_y_transformed(m_touchEvent, size.height()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint32 TouchEvent::id() const
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT(type() != LIBINPUT_EVENT_TOUCH_CANCEL && type() != LIBINPUT_EVENT_TOUCH_FRAME);
|
|
|
|
|
return libinput_event_touch_get_slot(m_touchEvent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|