diff options
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.h | 4 | ||||
-rw-r--r-- | src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp | 5 | ||||
-rw-r--r-- | src/plugins/generic/touchscreen/qtoucheventsenderqpa.h | 2 | ||||
-rw-r--r-- | src/plugins/generic/touchscreen/qtouchscreen.cpp | 2 | ||||
-rw-r--r-- | src/plugins/generic/touchscreen/qtouchscreen.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 8 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsmousehandler.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_maemo.cpp | 2 | ||||
-rw-r--r-- | src/testlib/qtesttouch.h | 2 |
10 files changed, 27 insertions, 23 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); diff --git a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp index 08db058e10..f8dc84373d 100644 --- a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp +++ b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp @@ -66,8 +66,7 @@ void QTouchEventSenderQPA::touch_configure(int x_min, int x_max, int y_min, int hw_range_y_max = y_max; } -void QTouchEventSenderQPA::touch_point(QEvent::Type state, - const QList<QWindowSystemInterface::TouchPoint> &points) +void QTouchEventSenderQPA::touch_point(const QList<QWindowSystemInterface::TouchPoint> &points) { QRect winRect; if (m_forceToActiveWindow) { @@ -107,7 +106,7 @@ void QTouchEventSenderQPA::touch_point(QEvent::Type state, #endif } - QWindowSystemInterface::handleTouchEvent(0, state, m_device, touchPoints); + QWindowSystemInterface::handleTouchEvent(0, m_device, touchPoints); } QT_END_NAMESPACE diff --git a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h index b6e1613b24..f0e923b3a0 100644 --- a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h +++ b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.h @@ -55,7 +55,7 @@ class QTouchEventSenderQPA : public QTouchScreenObserver public: QTouchEventSenderQPA(const QString &spec = QString()); void touch_configure(int x_min, int x_max, int y_min, int y_max); - void touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points); + void touch_point(const QList<QWindowSystemInterface::TouchPoint> &points); private: bool m_forceToActiveWindow; diff --git a/src/plugins/generic/touchscreen/qtouchscreen.cpp b/src/plugins/generic/touchscreen/qtouchscreen.cpp index fd2de62d6b..fd73bffd4f 100644 --- a/src/plugins/generic/touchscreen/qtouchscreen.cpp +++ b/src/plugins/generic/touchscreen/qtouchscreen.cpp @@ -291,7 +291,7 @@ void QTouchScreenData::processInputEvent(input_event *data) if (!skip && !(m_state == m_prevState && m_state == QEvent::TouchEnd)) for (int i = 0; i < m_observers.count(); ++i) - m_observers.at(i)->touch_point(m_state, m_touchPoints); + m_observers.at(i)->touch_point(m_touchPoints); m_prevState = m_state; if (m_state == QEvent::TouchBegin) diff --git a/src/plugins/generic/touchscreen/qtouchscreen.h b/src/plugins/generic/touchscreen/qtouchscreen.h index 3c35b0012f..6127cdba32 100644 --- a/src/plugins/generic/touchscreen/qtouchscreen.h +++ b/src/plugins/generic/touchscreen/qtouchscreen.h @@ -59,7 +59,7 @@ class QTouchScreenObserver { public: virtual void touch_configure(int x_min, int x_max, int y_min, int y_max) = 0; - virtual void touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points) = 0; + virtual void touch_point(const QList<QWindowSystemInterface::TouchPoint> &points) = 0; }; class QTouchScreenHandler : public QObject diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 4ae268dda5..a0a5a2e5cf 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -295,28 +295,28 @@ static QTouchDevice *touchDevice = 0; { const NSTimeInterval timestamp = [event timestamp]; const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false); - QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchBegin, touchDevice, points); + QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points); } - (void)touchesMovedWithEvent:(NSEvent *)event { const NSTimeInterval timestamp = [event timestamp]; const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false); - QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchUpdate, touchDevice, points); + QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points); } - (void)touchesEndedWithEvent:(NSEvent *)event { const NSTimeInterval timestamp = [event timestamp]; const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false); - QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, touchDevice, points); + QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points); } - (void)touchesCancelledWithEvent:(NSEvent *)event { const NSTimeInterval timestamp = [event timestamp]; const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false); - QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, touchDevice, points); + QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, touchDevice, points); } #ifndef QT_NO_WHEELEVENT diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index a2b6aa8d68..608230e6e0 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -280,14 +280,13 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, if (!m_touchDevice) { m_touchDevice = new QTouchDevice; + // TODO: Device used to be hardcoded to screen in previous code. m_touchDevice->setType(QTouchDevice::TouchScreen); m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition); QWindowSystemInterface::registerTouchDevice(m_touchDevice); } - // TODO: Device used to be hardcoded to screen in previous code. - // What is the correct event type? Which parts of translateRawTouchEvent() are required? - QWindowSystemInterface::handleTouchEvent(window, QEvent::TouchBegin, + QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints); return true; diff --git a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp index 719fc85ae2..23421e59d2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp @@ -288,7 +288,7 @@ void QXcbConnection::handleGenericEvent(xcb_ge_event_t *event) QWindowSystemInterface::registerTouchDevice(dev); m_xinputData->qtTouchDevice = dev; } - QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xideviceevent->time, (QEvent::Type)0 /*None*/, dev, touchPoints); + QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xideviceevent->time, dev, touchPoints); } if (xideviceevent->evtype == XI_ButtonRelease) { diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h index 6a9909b617..4ebbd37c27 100644 --- a/src/testlib/qtesttouch.h +++ b/src/testlib/qtesttouch.h @@ -136,7 +136,7 @@ namespace QTest if (!points.isEmpty()) { if (targetWindow) { - QWindowSystemInterface::handleTouchEvent(targetWindow,QEvent::None, device, touchPointList(points.values())); + QWindowSystemInterface::handleTouchEvent(targetWindow, device, touchPointList(points.values())); QTest::qWait(10); } #ifdef QT_WIDGETS_LIB |