summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-11-26 16:38:55 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-12-15 19:03:24 +0100
commitac210c73e43621f942d3cb947eef036fc5e7646e (patch)
tree4dd3a8b435525a520d6a0176ad6078fbbdbfdd2f /src/gui
parent50e1976437f645e9d6571d4498e9d44388e59c19 (diff)
xcb: report wheel events from the correct device instance
Until now, all wheel events came from one "core pointer". It's useful in Qt Quick to tell the devices apart, because some support smooth scrolling and some don't. Also remove the QHash storing legacy ScrollingDevice structs, and use a subclass of QPointingDevicePrivate instead. Task-number: QTBUG-46412 Task-number: QTBUG-72167 Task-number: QTBUG-69433 Change-Id: Ie6a3d8dd494f981e8706b9a66a1021dfb51baec4 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qpointingdevice.cpp19
-rw-r--r--src/gui/kernel/qpointingdevice_p.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/kernel/qpointingdevice.cpp b/src/gui/kernel/qpointingdevice.cpp
index eba17f52ee..6ef032098f 100644
--- a/src/gui/kernel/qpointingdevice.cpp
+++ b/src/gui/kernel/qpointingdevice.cpp
@@ -356,6 +356,25 @@ const QPointingDevice *QPointingDevicePrivate::queryTabletDevice(QInputDevice::D
/*!
\internal
+ Finds the device instance identified by its \a systemId.
+ Returns the device found, or \c nullptr if none was found.
+*/
+const QPointingDevice *QPointingDevicePrivate::pointingDeviceById(qint64 systemId)
+{
+ const auto &devices = QInputDevice::devices();
+ for (const QInputDevice *dev : devices) {
+ if (dev->type() >= QPointingDevice::DeviceType::Keyboard)
+ continue;
+ const QPointingDevice *pdev = static_cast<const QPointingDevice *>(dev);
+ const auto devPriv = QPointingDevicePrivate::get(pdev);
+ if (devPriv->systemId == systemId)
+ return pdev;
+ }
+ return nullptr;
+}
+
+/*!
+ \internal
First, ensure that the \a cancelEvent's QTouchEvent::points() list contains
all points that have exclusive grabs. Then send the event to each object
that has an exclusive grab of any of the points.
diff --git a/src/gui/kernel/qpointingdevice_p.h b/src/gui/kernel/qpointingdevice_p.h
index 6f787b4159..645c82673b 100644
--- a/src/gui/kernel/qpointingdevice_p.h
+++ b/src/gui/kernel/qpointingdevice_p.h
@@ -132,6 +132,8 @@ public:
QPointingDevice::PointerType pointerType,
QPointingDeviceUniqueId uniqueId,
qint64 systemId = 0);
+
+ static const QPointingDevice *pointingDeviceById(qint64 systemId);
};
QT_END_NAMESPACE