libinput: Reorganize touch frame handler

Avoid showing unnecessary "TouchFrame without registered device"
warnings. That should be reserved only for not having a device ready.
The touch point list's emptyiness is a different story - there we
should stop silently as that is not an error.

Change-Id: Icdb8b352351b70a7e1af2d3a1de3001dfb751aae
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Laszlo Agocs 2015-03-25 10:21:12 +01:00
parent 0809a922a0
commit b1a9787f01

View File

@ -147,18 +147,22 @@ void QLibInputTouch::processTouchCancel(libinput_event_touch *e)
void QLibInputTouch::processTouchFrame(libinput_event_touch *e)
{
DeviceState *state = deviceState(e);
if (state->m_touchDevice && !state->m_points.isEmpty()) {
QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, state->m_touchDevice, state->m_points,
QGuiApplication::keyboardModifiers());
for (int i = 0; i < state->m_points.count(); ++i) {
QWindowSystemInterface::TouchPoint &tp(state->m_points[i]);
if (tp.state == Qt::TouchPointReleased)
state->m_points.removeAt(i--);
else if (tp.state == Qt::TouchPointPressed)
tp.state = Qt::TouchPointStationary;
}
} else {
if (!state->m_touchDevice) {
qWarning("TouchFrame without registered device");
return;
}
if (state->m_points.isEmpty())
return;
QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, state->m_touchDevice, state->m_points,
QGuiApplication::keyboardModifiers());
for (int i = 0; i < state->m_points.count(); ++i) {
QWindowSystemInterface::TouchPoint &tp(state->m_points[i]);
if (tp.state == Qt::TouchPointReleased)
state->m_points.removeAt(i--);
else if (tp.state == Qt::TouchPointPressed)
tp.state = Qt::TouchPointStationary;
}
}