Make touch operating better on some touchpads

Some MT protocol capable touchpads do not provide
ABS_MT_TOUCH_MAJOR. The calculation for touch area was meaningless in
this case and resulted in a very small area not playing nice with apps
like fingerpaint.

Change-Id: Ibe472e22e5e792059fd594f54be9be8b75287730
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Laszlo Agocs 2012-06-02 19:04:00 +03:00 committed by Qt by Nokia
parent f3f648f920
commit 87e50e079e

View File

@ -82,7 +82,7 @@ public:
Qt::TouchPointState state;
QTouchEvent::TouchPoint::InfoFlags flags;
Contact() : trackingId(-1),
x(0), y(0), maj(1), pressure(0),
x(0), y(0), maj(-1), pressure(0),
state(Qt::TouchPointPressed), flags(0) { }
};
QHash<int, Contact> m_contacts; // The key is a tracking id for type A, slot number for type B.
@ -479,7 +479,10 @@ void QEvdevTouchScreenData::reportPoints()
const qreal wx = winRect.left() + tp.normalPosition.x() * winRect.width();
const qreal wy = winRect.top() + tp.normalPosition.y() * winRect.height();
const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h);
tp.area = QRectF(0, 0, tp.area.width() * sizeRatio, tp.area.height() * sizeRatio);
if (tp.area.width() == -1) // touch major was not provided
tp.area = QRectF(0, 0, 8, 8);
else
tp.area = QRectF(0, 0, tp.area.width() * sizeRatio, tp.area.height() * sizeRatio);
tp.area.moveCenter(QPointF(wx, wy));
// Calculate normalized pressure.