From e5078714febaa72bf2f43b3a8ac9caec1c324129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20=C3=96lmann?= Date: Mon, 14 Oct 2019 12:12:24 +0200 Subject: qlibinputtouch: bugfix: do not skip touch events Having a platform with Texas Instruments's ADS7846 touch screen controller (NXP i.MX6 DualLite SoC) and a LOGIC Technologies Inc. LTTD800x480 L2RT 7" (800x480 pixels) TFT LCD panel attached to it (resistive touch) using Linux v5.2.17 and libinput-1.12.6 a single one finger touch starts with a LIBINPUT_EVENT_TOUCH_ DOWN directly followed by a LIBINPUT_EVENT_TOUCH_MOTION both having the same touch position. Now Qt's code for touch input processing compressed both into one touch point with state Qt::TouchPointStationary which resulted in QGuiApplicationPrivate:: processTouchEvent() seeing no touch points with state Qt::TouchPointPressed anymore. As a consequence processTouchEvent()'s local container windowsNeeding- Events stayed empty and the whole touch frame was skipped. Fix this by still compressing into one touch point, but keeping its state as Qt::TouchPointPressed. Fixes: QTBUG-79212 Change-Id: Ia571d79ec5c1d6143e923ed69b378503b53e5992 Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs --- src/platformsupport/input/libinput/qlibinputtouch.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/platformsupport/input/libinput/qlibinputtouch.cpp') diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index a65bc91c39..ad85360b0e 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -113,16 +113,16 @@ void QLibInputTouch::processTouchMotion(libinput_event_touch *e) DeviceState *state = deviceState(e); QWindowSystemInterface::TouchPoint *tp = state->point(slot); if (tp) { + Qt::TouchPointState tmpState = Qt::TouchPointMoved; const QPointF p = getPos(e); - if (tp->area.center() != p) { + if (tp->area.center() == p) + tmpState = Qt::TouchPointStationary; + else tp->area.moveCenter(p); - // 'down' may be followed by 'motion' within the same "frame". - // Handle this by compressing and keeping the Pressed state until the 'frame'. - if (tp->state != Qt::TouchPointPressed) - tp->state = Qt::TouchPointMoved; - } else { - tp->state = Qt::TouchPointStationary; - } + // 'down' may be followed by 'motion' within the same "frame". + // Handle this by compressing and keeping the Pressed state until the 'frame'. + if (tp->state != Qt::TouchPointPressed && tp->state != Qt::TouchPointReleased) + tp->state = tmpState; } else { qWarning("Inconsistent touch state (got 'motion' without 'down')"); } -- cgit v1.2.3