diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-11-30 15:48:54 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-09 16:35:43 +0100 |
commit | 5da5230ab29743b63bf238a379891c98ac9d5038 (patch) | |
tree | 0bb74cdeff26e7b42ff882007143cc4ea2e5a548 /src/gui | |
parent | b986131c6d1243725134285dfc94581f80c00746 (diff) |
Remove event type parameter from handleTouchEvent.
Requiring platform and generic plug-ins to pass TouchBegin,
TouchUpdate, or TouchEnd is unnecessary. The type can be easily
deduced from the touch point states. In fact handleTouchEvent already
collected the combined point states, it was just not utilized until
now.
Change-Id: Icf3c787fefdebc51609a763bc4286c18a0b6aac2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.h | 4 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 016446780b..874ceb426a 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -219,16 +219,15 @@ void QWindowSystemInterface::registerTouchDevice(QTouchDevice *device) QTouchDevicePrivate::registerDevice(device); } -void QWindowSystemInterface::handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device, - const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods) +void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device, + const QList<TouchPoint> &points, Qt::KeyboardModifiers mods) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); - handleTouchEvent(w, time, type, device, points, mods); + handleTouchEvent(w, time, device, points, mods); } -void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, - QTouchDevice *device, - const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods) +void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTouchDevice *device, + const QList<TouchPoint> &points, Qt::KeyboardModifiers mods) { if (!points.size()) // Touch events must have at least one point return; @@ -268,6 +267,13 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEv ++point; } + // Determine the event type based on the combined point states. + QEvent::Type type = QEvent::TouchUpdate; + if (states == Qt::TouchPointPressed) + type = QEvent::TouchBegin; + else if (states == Qt::TouchPointReleased) + type = QEvent::TouchEnd; + QWindowSystemInterfacePrivate::TouchEvent *e = new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 423281955c..bcd4de944c 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -99,9 +99,9 @@ public: }; static void registerTouchDevice(QTouchDevice *device); - static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device, + static void handleTouchEvent(QWindow *w, QTouchDevice *device, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchDevice *device, + static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleGeometryChange(QWindow *w, const QRect &newRect); |