diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-26 16:38:55 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-12-15 19:03:24 +0100 |
commit | ac210c73e43621f942d3cb947eef036fc5e7646e (patch) | |
tree | 4dd3a8b435525a520d6a0176ad6078fbbdbfdd2f /src/gui/kernel/qpointingdevice.cpp | |
parent | 50e1976437f645e9d6571d4498e9d44388e59c19 (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/kernel/qpointingdevice.cpp')
-rw-r--r-- | src/gui/kernel/qpointingdevice.cpp | 19 |
1 files changed, 19 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. |