From bfa78aedc089712a2c21225b63bd58ec12d2e926 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 12 Feb 2021 09:54:28 +0100 Subject: [PATCH] Fix Wacom Art Pen detection on xcb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-91102 Change-Id: I6cd7af26153457609c1fa8fb0a9e167939d592fc Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qpointingdevice.cpp | 10 +++++++--- src/gui/kernel/qpointingdevice_p.h | 1 + src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qpointingdevice.cpp b/src/gui/kernel/qpointingdevice.cpp index 6ef032098f..176a5fedf4 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 645c82673b..04823a3e86 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 f69655e403..5c455cf296 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(),