Avoid crash in handleTouchEvent and remove superfluous mapping.
252d1b34b2 introduces a mapFromGlobal
call in QWindowSystemInterface::handleTouchEvent. This has two issues:
It ignores the fact that the tlw parameter can be null, resulting in
an instant crash with the touch support of some platforms, and the
mapping itself is unneccessary because
QGuiApplication::processTouchEvent() will perform the same, the
rect set via setRect() is basically ignored due to the touchPoint.d.rect
= ... just before sending the final event to the widget in qguiapplication.cpp.
Using setScreenRect instead of setRect is a valid fix from the
previous patch, but the parts for the mapping need to be removed.
Change-Id: I0bb40c7d647fb062106b151e5987f9970d6ab2c8
Reviewed-on: http://codereview.qt-project.org/5448
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bjørn Erik Nilsen <bjorn.nilsen@nokia.com>
bb10
parent
7f9b7c478b
commit
9ee53afb32
|
|
@ -235,14 +235,8 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEv
|
|||
p.setScreenPos(screenPos);
|
||||
p.setScreenRect(point->area);
|
||||
|
||||
// Map screen pos to local (QWindow) coordinates and preserve sub-pixel resolution.
|
||||
const QPointF delta = screenPos - screenPos.toPoint();
|
||||
const QPointF localPos = tlw->mapFromGlobal(screenPos.toPoint()) + delta;
|
||||
p.setPos(localPos);
|
||||
|
||||
QRectF rect(0, 0, point->area.width(), point->area.height());
|
||||
rect.moveCenter(localPos);
|
||||
p.setRect(rect);
|
||||
// The local pos and rect are not set, they will be calculated
|
||||
// when the event gets processed by QGuiApplication.
|
||||
|
||||
p.setNormalizedPos(point->normalPosition);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue