path: root/src/plugins
diff options
authorSamuel Rødal <>2012-01-12 08:53:13 +0100
committerQt by Nokia <>2012-01-13 09:38:05 +0100
commite50416066cab4be7df8382bd224d9e4ddd7a903a (patch)
tree8961d3ce0221a3cd51bd84c9606e91ba4534d8f5 /src/plugins
parentb54cfb3124a19c6f897d6b18e3285f0474fe5dc6 (diff)
Added application flags to translate between touch and mouse events.
The current way we do it of having the platform or touch plugin send both mouse and touch events is not ideal. There's no good way to write an application that works sanely both on a touch-only device and on a desktop except by restricting yourself to only handling mouse events. If you try to handle touch events you don't get any events at all on desktop, and if you try to handle both, you end up getting duplicate events on touch devices. Instead, we should get rid of the code in the plugins that automatically sends mouse events translated from touch events. This change enables that by making the behaviour fully configurable in QtGui. Two new application attributes are added to explicitly say whether unhandled touch events should be sent as synthesized mouse events and vice versa, and no duplicates are automatically sent as the current situation. Synthesized mouse events are enabled by default. We also get rid of the QTouchEvent::TouchPoint::Primary flag, which was only used to signal that the windowing system automatically generated mouse events for that touch point. Now we only generate mouse events from the first touch point in the list. Change-Id: I8e20f3480407ca8c31b42de0a4d2b319e1346b65 Reviewed-by: Laszlo Agocs <> Reviewed-by: Jocelyn Turcotte <> Reviewed-by: Tor Arne Vestbø <> Reviewed-by: Friedemann Kleint <> Reviewed-by: Lars Knoll <> Reviewed-by: Denis Dzyubenko <>
Diffstat (limited to 'src/plugins')
3 files changed, 0 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/ b/src/plugins/platforms/cocoa/
index cc85c47c58..43767b09b2 100644
--- a/src/plugins/platforms/cocoa/
+++ b/src/plugins/platforms/cocoa/
@@ -73,8 +73,6 @@ QCocoaTouch::~QCocoaTouch()
void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase)
_touchPoint.state = toTouchPointState(phase);
- if (_touchCount == 1)
- _touchPoint.flags |= QTouchEvent::TouchPoint::Primary;
// From the normalized position on the trackpad, calculate
// where on screen the touchpoint should be according to the
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 54a16d5013..e491029ea1 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -240,8 +240,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
const TOUCHINPUT &winTouchInput = winTouchInputs[i];
QTouchPoint touchPoint;
touchPoint.pressure = 1.0;
- if ((winTouchInput.dwFlags & TOUCHEVENTF_PRIMARY) != 0)
- touchPoint.flags |= QTouchEvent::TouchPoint::Primary; = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1);
if ( == -1) { = m_touchInputIDToTouchPointID.size();
diff --git a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp
index 1ac8e771fc..12b3d67b9f 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp
@@ -222,8 +222,6 @@ void QXcbConnection::handleGenericEvent(xcb_ge_event_t *event)
for (int i = 0; i < m_xinputData->xiMaxContacts; ++i) {
QWindowSystemInterface::TouchPoint tp; = i;
- if (i == 0)
- tp.flags |= QTouchEvent::TouchPoint::Primary;
tp.state = Qt::TouchPointReleased;
touchPoints << tp;