diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-25 10:21:12 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-25 10:53:22 +0000 |
commit | b1a9787f01c381f5a40000c57c1f5d13c6a44ce7 (patch) | |
tree | d3717529aad3c3ab3af952c72837bd1380c3240d /src/platformsupport | |
parent | 0809a922a0da6008fb32feaf7bd4fcd0996a6b1c (diff) |
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>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/input/libinput/qlibinputtouch.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
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; } } |