qt_handleTouchEvent(): Scale coordinates when converting touch points.

Remove outdated static functions to convert touch points and use
QWindowSystemInterfacePrivate::fromNativeTouchPoints().

Fix tst_QWidget::underMouse() to pass when High DPI scaling is in effect.

.\tst_qwidget.cpp(9000) : failure location
FAIL!  : tst_QWidget::underMouse() 'childWidget1.underMouse()' returned FALSE. ()
.\tst_qwidget.cpp(10161) : failure location

Task-number: QTBUG-46615
Change-Id: Ie73dba610da357e7be396f2ea0229987f7503462
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
bb10
Friedemann Kleint 2016-02-26 13:24:05 +01:00
parent d345783e4d
commit 837d75eed5
1 changed files with 2 additions and 24 deletions

View File

@ -906,36 +906,14 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int
#endif
}
static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
{
QWindowSystemInterface::TouchPoint p;
p.id = pt.id();
p.flags = pt.flags();
p.normalPosition = pt.normalizedPos();
p.area = pt.screenRect();
p.pressure = pt.pressure();
p.state = pt.state();
p.velocity = pt.velocity();
p.rawPositions = pt.rawScreenPositions();
return p;
}
static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
{
QList<struct QWindowSystemInterface::TouchPoint> newList;
Q_FOREACH (QTouchEvent::TouchPoint p, pointList)
newList.append(touchPoint(p));
return newList;
}
Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &points,
Qt::KeyboardModifiers mods = Qt::NoModifier)
{
bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
QWindowSystemInterface::handleTouchEvent(w, device, touchPointList(points), mods);
QWindowSystemInterface::handleTouchEvent(w, device,
QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods);
QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
}