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 <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Ulrich Ölmann 2019-10-14 12:12:24 +02:00
parent 7f0aaa88ef
commit e5078714fe

View File

@ -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')");
}