summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface_qpa.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-09-23 11:11:10 +0300
committerQt by Nokia <qt-info@nokia.com>2011-09-23 10:42:16 +0200
commit9ee53afb32cc1bea6f60f4ca7a951330a979c04a (patch)
treee3c7d534208a9e68c0fffa7b94226a7ea437134f /src/gui/kernel/qwindowsysteminterface_qpa.cpp
parent7f9b7c478b6edaf4a7982e067ce66fb96b41d633 (diff)
Avoid crash in handleTouchEvent and remove superfluous mapping.
252d1b34b26779cbc1ac269f4af7fdb1f27038ef 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>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface_qpa.cpp')
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 898de3a425..bad1b86935 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -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);