diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 8cb4e5d603..74280a2508 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -1550,6 +1550,9 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD double pressure = 0, rotation = 0, tangentialPressure = 0; int xTilt = 0, yTilt = 0; static const bool useValuators = !qEnvironmentVariableIsSet("QT_XCB_TABLET_LEGACY_COORDINATES"); + const QPointingDevice *dev = QPointingDevicePrivate::tabletDevice(QInputDevice::DeviceType(tabletData->tool), + QPointingDevice::PointerType(tabletData->pointerType), + QPointingDeviceUniqueId::fromNumericId(tabletData->serialId)); // Valuators' values are relative to the physical size of the current virtual // screen. Therefore we cannot use QScreen/QWindow geometry and should use @@ -1597,7 +1600,8 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD tangentialPressure = normalizedValue * 2.0 - 1.0; // Convert 0..1 range to -1..+1 range break; case QInputDevice::DeviceType::Stylus: - rotation = normalizedValue * 360.0 - 180.0; // Convert 0..1 range to -180..+180 degrees + if (dev->capabilities().testFlag(QInputDevice::Capability::Rotation)) + rotation = normalizedValue * 360.0 - 180.0; // Convert 0..1 range to -180..+180 degrees break; default: // Other types of styli do not use this valuator break; @@ -1616,11 +1620,10 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD local.x(), local.y(), global.x(), global.y(), (int)tabletData->buttons, pressure, xTilt, yTilt, rotation, (int)modifiers); - QWindowSystemInterface::handleTabletEvent(window, ev->time, local, global, - int(tabletData->tool), int(tabletData->pointerType), + QWindowSystemInterface::handleTabletEvent(window, ev->time, dev, local, global, tabletData->buttons, pressure, xTilt, yTilt, tangentialPressure, - rotation, 0, tabletData->serialId, modifiers); + rotation, 0, modifiers); } QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id)