From b73ad2dd197c5f35817bb33db17777596671478b Mon Sep 17 00:00:00 2001 From: Mikko Harju Date: Tue, 4 Jun 2013 08:34:46 +0300 Subject: Prevent touch coordinates outside target geometry Previously, normalized positions with either of coordinates equal to 1.0 would be reported outside the screen / window geometry, which would cause hit test to fail. Change-Id: Ia5e083bd52254c7e05143eedf930be3bcba7a412 Initial-patch-by: Aaron Kennedy Reviewed-by: Andy Nichols --- src/platformsupport/input/evdevtouch/qevdevtouch.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/platformsupport/input/evdevtouch/qevdevtouch.cpp') diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index ddd059c5a0..b05ea0de59 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -515,9 +515,10 @@ void QEvdevTouchScreenData::reportPoints() QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]); // Generate a screen position that is always inside the active window - // or the primary screen. - const qreal wx = winRect.left() + tp.normalPosition.x() * winRect.width(); - const qreal wy = winRect.top() + tp.normalPosition.y() * winRect.height(); + // or the primary screen. Even though we report this as a QRectF, internally + // Qt uses QRect/QPoint so we need to bound the size to winRect.size() - QSize(1, 1) + const qreal wx = winRect.left() + tp.normalPosition.x() * (winRect.width() - 1); + const qreal wy = winRect.top() + tp.normalPosition.y() * (winRect.height() - 1); const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h); if (tp.area.width() == -1) // touch major was not provided tp.area = QRectF(0, 0, 8, 8); -- cgit v1.2.3