diff --git a/src/gui/kernel/qpointingdevice.cpp b/src/gui/kernel/qpointingdevice.cpp index 6ef032098f2..176a5fedf46 100644 --- a/src/gui/kernel/qpointingdevice.cpp +++ b/src/gui/kernel/qpointingdevice.cpp @@ -324,14 +324,16 @@ const QPointingDevice *QPointingDevice::primaryPointingDevice(const QString& sea If an instance matching the given \a deviceType and \a pointerType but with only a default-constructed \c uniqueId is found, it will be assumed to be - the one we're looking for, and its \c uniqueId will be updated to match the - given \a uniqueId. This is for the benefit of any platform plugin that can + the one we're looking for, its \c uniqueId will be updated to match the + given \a uniqueId, and its \c capabilities will be updated to match the + given \a capabilities. This is for the benefit of any platform plugin that can discover the tablet itself at startup, along with the supported stylus types, but then discovers specific styli later on as they come into proximity. */ const QPointingDevice *QPointingDevicePrivate::queryTabletDevice(QInputDevice::DeviceType deviceType, QPointingDevice::PointerType pointerType, QPointingDeviceUniqueId uniqueId, + QPointingDevice::Capabilities capabilities, qint64 systemId) { const auto &devices = QInputDevice::devices(); @@ -346,7 +348,9 @@ const QPointingDevice *QPointingDevicePrivate::queryTabletDevice(QInputDevice::D (devPriv->uniqueId == uniqueId || uniqueIdDiscovered)) { if (uniqueIdDiscovered) { const_cast(devPriv)->uniqueId = uniqueId; - qCDebug(lcQpaInputDevices) << "discovered unique ID of tablet tool" << pdev; + if (capabilities) + const_cast(devPriv)->capabilities = capabilities; + qCDebug(lcQpaInputDevices) << "discovered unique ID and capabilities of tablet tool" << pdev; } return pdev; } diff --git a/src/gui/kernel/qpointingdevice_p.h b/src/gui/kernel/qpointingdevice_p.h index 645c82673b8..04823a3e86b 100644 --- a/src/gui/kernel/qpointingdevice_p.h +++ b/src/gui/kernel/qpointingdevice_p.h @@ -131,6 +131,7 @@ public: static const QPointingDevice *queryTabletDevice(QInputDevice::DeviceType deviceType, QPointingDevice::PointerType pointerType, QPointingDeviceUniqueId uniqueId, + QInputDevice::Capabilities capabilities = QInputDevice::Capability::None, qint64 systemId = 0); static const QPointingDevice *pointingDeviceById(qint64 systemId); diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index f69655e4031..5c455cf2960 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -204,7 +204,8 @@ static const QPointingDevice *tabletToolInstance(QPointingDevice *master, const if (pointerTypeOverride != QPointingDevice::PointerType::Unknown) pointerType = pointerTypeOverride; const QPointingDevice *ret = QPointingDevicePrivate::queryTabletDevice(devType, pointerType, - QPointingDeviceUniqueId::fromNumericId(uniqueId), id); + QPointingDeviceUniqueId::fromNumericId(uniqueId), + caps, id); if (!ret) { ret = new QPointingDevice(tabletName, id, devType, pointerType, caps, 1, buttonCount, master ? master->seatName() : QString(),