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>
This commit is contained in:
parent
c97a1bc538
commit
b73ad2dd19
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user