xcb: Use QWSI::handleTabletEnterLeaveProximityEvent(.. QPointingDev* ..)
We want to pass the QPointingDevice* because we've already identified it by its "system ID" (xinput device number). The other versions of handleTabletEnterProximityEvent and handleTabletLeaveProximityEvent try to identify the stylus by only its deviceType, pointerType and unique ID, which can go wrong if there are multiple tablet devices and the unique ID is not provided (as with N-trig and Wacom tablets being used at the same time). Anyway this fixes a TODO comment from 6589f2ed0cf78c9b8a5bdffcdc458dc40a974c60 Leave a "deprecated" comment by the QWSI functions that should not be used. Task-number: QTBUG-104878 Change-Id: Id9f19c60b54b7900b02d5f87b5d12f9a9189721d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 1a49eae776f1c40b5e22f668e30107ccbde0238b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
745e7583d0
commit
bc2ba337dc
@ -230,6 +230,8 @@ public:
|
||||
Qt::MouseButtons buttons = {}, int xTilt = 0, int yTilt = 0,
|
||||
qreal tangentialPressure = 0, qreal rotation = 0, int z = 0,
|
||||
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
|
||||
|
||||
// The following 4 functions are deprecated (QTBUG-114560)
|
||||
static bool handleTabletEnterProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid);
|
||||
static void handleTabletEnterProximityEvent(int deviceType, int pointerType, qint64 uid);
|
||||
static bool handleTabletLeaveProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid);
|
||||
|
@ -1529,6 +1529,7 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD
|
||||
if (!tool && ptr[_WACSER_TOOL_SERIAL])
|
||||
tool = ptr[_WACSER_TOOL_SERIAL];
|
||||
|
||||
QWindow *win = nullptr; // TODO QTBUG-111400 get the position somehow, then the window
|
||||
// The property change event informs us which tool is in proximity or which one left proximity.
|
||||
if (tool) {
|
||||
const QPointingDevice *dev = tabletToolInstance(nullptr, tabletData->name,
|
||||
@ -1537,22 +1538,19 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD
|
||||
tabletData->inProximity = true;
|
||||
tabletData->tool = dev->type();
|
||||
tabletData->serialId = qint64(ptr[_WACSER_TOOL_SERIAL]);
|
||||
QWindowSystemInterface::handleTabletEnterProximityEvent(ev->time,
|
||||
int(tabletData->tool), int(tabletData->pointerType), tabletData->serialId);
|
||||
QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(win, ev->time, dev, true); // enter
|
||||
} else {
|
||||
tool = ptr[_WACSER_LAST_TOOL_ID];
|
||||
// Workaround for http://sourceforge.net/p/linuxwacom/bugs/246/
|
||||
// e.g. on Thinkpad Helix, tool ID will be 0 and serial will be 1
|
||||
if (!tool)
|
||||
tool = ptr[_WACSER_LAST_TOOL_SERIAL];
|
||||
const QInputDevice *dev = QInputDevicePrivate::fromId(tabletData->deviceId);
|
||||
auto *dev = qobject_cast<const QPointingDevice *>(QInputDevicePrivate::fromId(tabletData->deviceId));
|
||||
Q_ASSERT(dev);
|
||||
tabletData->tool = dev->type();
|
||||
tabletData->inProximity = false;
|
||||
tabletData->serialId = qint64(ptr[_WACSER_LAST_TOOL_SERIAL]);
|
||||
// TODO why doesn't it just take QPointingDevice*
|
||||
QWindowSystemInterface::handleTabletLeaveProximityEvent(ev->time,
|
||||
int(tabletData->tool), int(tabletData->pointerType), tabletData->serialId);
|
||||
QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(win, ev->time, dev, false); // leave
|
||||
}
|
||||
// TODO maybe have a hash of tabletData->deviceId to device data so we can
|
||||
// look up the tablet name here, and distinguish multiple tablets
|
||||
|
Loading…
x
Reference in New Issue
Block a user