diff options
author | Mikko Harju <mikko.harju@jolla.com> | 2013-06-04 08:34:46 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-05 12:56:00 +0200 |
commit | b73ad2dd197c5f35817bb33db17777596671478b (patch) | |
tree | 210566ec5fc5d0c4f5a880f4305f6a443f4b8bfb /src/platformsupport | |
parent | c97a1bc538dea1e38dfcba6c8191ed4b35dbe133 (diff) |
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 <aaron.kennedy@jolla.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/input/evdevtouch/qevdevtouch.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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); |