From 87e50e079ea226af95699438b38ee5f4574aae68 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 2 Jun 2012 19:04:00 +0300 Subject: [PATCH] Make touch operating better on some touchpads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/platformsupport/input/evdevtouch/qevdevtouch.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 0f039a40d2..6bf9ba769e 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -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 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.