Deliver stationary touchpoints that have changed pressure
As a rule, we don't deliver touch events containing only stationary
touchpoints. To fix QTBUG-52510 we added an exception in
1bd0ab7050 : if the velocity changed,
deliver it anyway. Now we need to do the same if the pressure changed.
Also, on the customer's hardware, pressure is indicated via ABS_MT_PRESSURE.
Change-Id: If7f7088df055d686cdd86967b999e38024f8170f
Fixes: QTBUG-77142
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
bb10
parent
98c5f22161
commit
1b0c45f683
|
|
@ -2695,7 +2695,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
|
|||
QWindow *window = e->window.data();
|
||||
typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
|
||||
QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents;
|
||||
bool stationaryTouchPointChangedVelocity = false;
|
||||
bool stationaryTouchPointChangedProperty = false;
|
||||
|
||||
for (int i = 0; i < e->points.count(); ++i) {
|
||||
QTouchEvent::TouchPoint touchPoint = e->points.at(i);
|
||||
|
|
@ -2775,7 +2775,11 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
|
|||
if (touchPoint.state() == Qt::TouchPointStationary) {
|
||||
if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) {
|
||||
touchInfo.touchPoint.setVelocity(touchPoint.velocity());
|
||||
stationaryTouchPointChangedVelocity = true;
|
||||
stationaryTouchPointChangedProperty = true;
|
||||
}
|
||||
if (!qFuzzyCompare(touchInfo.touchPoint.pressure(), touchPoint.pressure())) {
|
||||
touchInfo.touchPoint.setPressure(touchPoint.pressure());
|
||||
stationaryTouchPointChangedProperty = true;
|
||||
}
|
||||
} else {
|
||||
touchInfo.touchPoint = touchPoint;
|
||||
|
|
@ -2816,7 +2820,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
|
|||
break;
|
||||
case Qt::TouchPointStationary:
|
||||
// don't send the event if nothing changed
|
||||
if (!stationaryTouchPointChangedVelocity)
|
||||
if (!stationaryTouchPointChangedProperty)
|
||||
continue;
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
|||
m_currentData.state = Qt::TouchPointReleased;
|
||||
if (m_typeB)
|
||||
m_contacts[m_currentSlot].maj = m_currentData.maj;
|
||||
} else if (data->code == ABS_PRESSURE) {
|
||||
} else if (data->code == ABS_PRESSURE || data->code == ABS_MT_PRESSURE) {
|
||||
m_currentData.pressure = qBound(hw_pressure_min, data->value, hw_pressure_max);
|
||||
if (m_typeB || m_singleTouch)
|
||||
m_contacts[m_currentSlot].pressure = m_currentData.pressure;
|
||||
|
|
|
|||
Loading…
Reference in New Issue