summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@qt.io>2016-10-11 09:59:35 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2016-10-11 08:05:52 +0000
commit7a30dda40bd5e24235c88b610ee9e996ed910793 (patch)
tree5040aeb0f236c846d173829fed1850d98924c6c1 /src/gui/kernel
parent46804956cbe3cd5ddfb0528ae7d9fa35a031d6d3 (diff)
Revert "Combine device and point id into 32 bit point id"
The patch is good, but currently breaks touchmouse test in qtdeclarative. We need to fix the touchmouse test first, then go ahead and reapply this patch once qtdeclarative is fixed. This reverts commit cd26e66c2e8ddde06b5e22ef28d815ac1082a7c4. Change-Id: I222e6240f5ff0eff9c8a3544819499847f6b48fa Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qtouchdevice.h1
-rw-r--r--src/gui/kernel/qtouchdevice_p.h7
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp43
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h2
5 files changed, 6 insertions, 51 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 76386a30a0..d8457bc041 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -84,7 +84,6 @@
#include "private/qcursor_p.h"
#include "private/qopenglcontext_p.h"
#include "private/qinputdevicemanager_p.h"
-#include "private/qtouchdevice_p.h"
#include "private/qdnd_p.h"
#include <qpa/qplatformthemefactory_p.h>
@@ -1945,8 +1944,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
points << point;
QEvent::Type type;
- QList<QTouchEvent::TouchPoint> touchPoints =
- QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, QTouchDevicePrivate::get(m_fakeTouchDevice)->id, &type);
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, window, &type);
QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers);
fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index c98aa69236..0fb24e47bf 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -87,7 +87,6 @@ public:
private:
QTouchDevicePrivate *d;
- friend class QTouchDevicePrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchDevice::Capabilities)
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index 18d2af46a7..203d9fca74 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_p.h
@@ -64,21 +64,16 @@ public:
: type(QTouchDevice::TouchScreen),
caps(QTouchDevice::Position),
maxTouchPoints(1)
- {
- static quint8 nextId = 2; // device 0 is not used, device 1 is for mouse device
- id = nextId++;
- }
+ { }
QTouchDevice::DeviceType type;
QTouchDevice::Capabilities caps;
QString name;
int maxTouchPoints;
- quint8 id;
static void registerDevice(const QTouchDevice *dev);
static void unregisterDevice(const QTouchDevice *dev);
static bool isRegistered(const QTouchDevice *dev);
- static QTouchDevicePrivate *get(QTouchDevice *q) { return q->d; }
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index ecc84e73d7..bb778bc5fc 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -460,40 +460,9 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,
handleTouchEvent(w, time, device, points, mods);
}
-static int g_nextPointId = 1;
-
-// map from device-independent point id (arbitrary) to "Qt point" ids
-typedef QMap<quint64, int> PointIdMap;
-Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap)
-
-/*!
- This function maps potentially arbitrary point ids \a pointId in the 32 bit
- value space to start from 1 and increase incrementally for each touch point
- held down. If all touch points are released it will reset the id back to 1
- for the following touch point.
-
- We can then assume that the touch points ids will never become too large,
- and it will then put the device identifier \a deviceId in the upper 8 bits.
- This leaves us with max 255 devices, and 16.7M taps without full release
- before we run out of value space.
-*/
-static int acquireCombinedPointId(quint8 deviceId, int pointId)
-{
- quint64 combinedId64 = (quint64(deviceId) << 32) + pointId;
- auto it = g_pointIdMap->constFind(combinedId64);
- int uid;
- if (it == g_pointIdMap->constEnd()) {
- uid = g_nextPointId++;
- g_pointIdMap->insert(combinedId64, uid);
- } else {
- uid = *it;
- }
- return (deviceId << 24) + uid;
-}
-
QList<QTouchEvent::TouchPoint>
QWindowSystemInterfacePrivate::fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
- const QWindow *window, quint8 deviceId,
+ const QWindow *window,
QEvent::Type *type)
{
QList<QTouchEvent::TouchPoint> touchPoints;
@@ -504,7 +473,7 @@ QList<QTouchEvent::TouchPoint>
QList<QWindowSystemInterface::TouchPoint>::const_iterator point = points.constBegin();
QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
while (point != end) {
- p.setId(acquireCombinedPointId(deviceId, point->id));
+ p.setId(point->id);
if (point->uniqueId >= 0)
p.setUniqueId(point->uniqueId);
p.setPressure(point->pressure);
@@ -537,11 +506,6 @@ QList<QTouchEvent::TouchPoint>
*type = QEvent::TouchEnd;
}
- if (states == Qt::TouchPointReleased) {
- g_nextPointId = 1;
- g_pointIdMap->clear();
- }
-
return touchPoints;
}
@@ -576,8 +540,7 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTo
return;
QEvent::Type type;
- QList<QTouchEvent::TouchPoint> touchPoints =
- QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, tlw, QTouchDevicePrivate::get(device)->id, &type);
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::fromNativeTouchPoints(points, tlw, &type);
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods);
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index e48a77a8ea..f471e1f550 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -503,7 +503,7 @@ public:
static QList<QTouchEvent::TouchPoint>
fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
- const QWindow *window, quint8 deviceId, QEvent::Type *type = Q_NULLPTR);
+ const QWindow *window, QEvent::Type *type = Q_NULLPTR);
static QList<QWindowSystemInterface::TouchPoint>
toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
const QWindow *window);