Multitouch on hwcomposer
REVIEW: 123796
This commit is contained in:
parent
cea4b7faeb
commit
5115d54926
1 changed files with 31 additions and 19 deletions
|
@ -60,10 +60,17 @@ HwcomposerBackend::~HwcomposerBackend()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static QPointF eventPosition(Event *event)
|
static uint eventTouchId(Event *event, uint index)
|
||||||
{
|
{
|
||||||
return QPointF(event->details.motion.pointer_coordinates[0].x,
|
Q_ASSERT(index < event->details.motion.pointer_count);
|
||||||
event->details.motion.pointer_coordinates[0].y);
|
return event->details.motion.pointer_coordinates[index].id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QPointF eventTouchPosition(Event *event, uint index)
|
||||||
|
{
|
||||||
|
Q_ASSERT(index < event->details.motion.pointer_count);
|
||||||
|
return QPointF(event->details.motion.pointer_coordinates[index].x,
|
||||||
|
event->details.motion.pointer_coordinates[index].y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static qint32 translateKey(qint32 key)
|
static qint32 translateKey(qint32 key)
|
||||||
|
@ -336,28 +343,33 @@ void HwcomposerBackend::inputEvent(Event *event, void *context)
|
||||||
case ISCL_MOTION_EVENT_ACTION_DOWN:
|
case ISCL_MOTION_EVENT_ACTION_DOWN:
|
||||||
case ISCL_MOTION_EVENT_ACTION_POINTER_DOWN:
|
case ISCL_MOTION_EVENT_ACTION_POINTER_DOWN:
|
||||||
QMetaObject::invokeMethod(backend, "touchDown", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(backend, "touchDown", Qt::QueuedConnection,
|
||||||
Q_ARG(qint32, buttonIndex),
|
Q_ARG(qint32, eventTouchId(event, buttonIndex)),
|
||||||
Q_ARG(QPointF, eventPosition(event)),
|
Q_ARG(QPointF, eventTouchPosition(event, buttonIndex)),
|
||||||
Q_ARG(quint32, event->details.motion.event_time));
|
|
||||||
break;
|
|
||||||
case ISCL_MOTION_EVENT_ACTION_UP:
|
|
||||||
case ISCL_MOTION_EVENT_ACTION_POINTER_UP:
|
|
||||||
// first update position - up events can contain additional motion events
|
|
||||||
QMetaObject::invokeMethod(backend, "touchMotion", Qt::QueuedConnection,
|
|
||||||
Q_ARG(qint32, buttonIndex),
|
|
||||||
Q_ARG(QPointF, eventPosition(event)),
|
|
||||||
Q_ARG(quint32, event->details.motion.event_time));
|
Q_ARG(quint32, event->details.motion.event_time));
|
||||||
QMetaObject::invokeMethod(backend, "touchFrame", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(backend, "touchFrame", Qt::QueuedConnection);
|
||||||
|
break;
|
||||||
|
case ISCL_MOTION_EVENT_ACTION_UP:
|
||||||
|
case ISCL_MOTION_EVENT_ACTION_POINTER_UP: {
|
||||||
|
// first update position - up events can contain additional motion events
|
||||||
|
QMetaObject::invokeMethod(backend, "touchMotion", Qt::QueuedConnection,
|
||||||
|
Q_ARG(qint32, eventTouchId(event, buttonIndex)),
|
||||||
|
Q_ARG(QPointF, eventTouchPosition(event, buttonIndex)),
|
||||||
|
Q_ARG(quint32, event->details.motion.event_time));
|
||||||
|
QMetaObject::invokeMethod(backend, "touchFrame", Qt::QueuedConnection);
|
||||||
|
|
||||||
QMetaObject::invokeMethod(backend, "touchUp", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(backend, "touchUp", Qt::QueuedConnection,
|
||||||
Q_ARG(qint32, buttonIndex),
|
Q_ARG(qint32, eventTouchId(event, buttonIndex)),
|
||||||
Q_ARG(quint32, event->details.motion.event_time));
|
Q_ARG(quint32, event->details.motion.event_time));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ISCL_MOTION_EVENT_ACTION_MOVE:
|
case ISCL_MOTION_EVENT_ACTION_MOVE:
|
||||||
// it's always for the first index, other touch points seem not to be provided
|
//move events affect all pointers
|
||||||
|
for (uint i = 0 ; i < event->details.motion.pointer_count ; i++) {
|
||||||
QMetaObject::invokeMethod(backend, "touchMotion", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(backend, "touchMotion", Qt::QueuedConnection,
|
||||||
Q_ARG(qint32, 0),
|
Q_ARG(qint32, eventTouchId(event, i)),
|
||||||
Q_ARG(QPointF, eventPosition(event)),
|
Q_ARG(QPointF, eventTouchPosition(event, i)),
|
||||||
Q_ARG(quint32, event->details.motion.event_time));
|
Q_ARG(quint32, event->details.motion.event_time));
|
||||||
|
}
|
||||||
QMetaObject::invokeMethod(backend, "touchFrame", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(backend, "touchFrame", Qt::QueuedConnection);
|
||||||
break;
|
break;
|
||||||
case ISCL_MOTION_EVENT_ACTION_CANCEL:
|
case ISCL_MOTION_EVENT_ACTION_CANCEL:
|
||||||
|
|
Loading…
Reference in a new issue