From b1a9787f01c381f5a40000c57c1f5d13c6a44ce7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 25 Mar 2015 10:21:12 +0100 Subject: 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 --- .../input/libinput/qlibinputtouch.cpp | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index 72cafb0ff7..c3eb8eac87 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -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; } } -- cgit v1.2.3