WinTab: Switch stylus pointer type when the tablet is in the tablet proximity
Some convertible tablet devices have a special stylus button that converts the stylus into an eraser. Such button can be pressed right when the stylus is in tablet surface proximity, so we should check that not only during proximity event handling, but also while parsing normal wintab packets. Make sure that we don't switch tablet pointer type while any **mapped** stylus button is pressed. Pressing the "eraser" button is reported in pkButtons, but it maps to none by CSR_SYSBTNMAP https://bugs.kde.org/show_bug.cgi?id=405747 https://bugs.kde.org/show_bug.cgi?id=408454 Pick-to: 5.15 Change-Id: I1d254f0cf79be6ceb194b1c4b314a11831f50170 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>bb10
parent
f80026ef9a
commit
f4442d4670
|
|
@ -529,7 +529,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
|
|||
return false;
|
||||
|
||||
const auto currentDevice = m_devices.at(m_currentDevice).currentDevice;
|
||||
const auto currentPointer = m_devices.at(m_currentDevice).currentPointerType;
|
||||
const qint64 uniqueId = m_devices.at(m_currentDevice).uniqueId;
|
||||
|
||||
// The tablet can be used in 2 different modes (reflected in enum Mode),
|
||||
|
|
@ -561,6 +560,27 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
|
|||
|
||||
const int z = m_devices.at(m_currentDevice).zCapability ? int(packet.pkZ) : 0;
|
||||
|
||||
const auto currentPointer = m_devices.at(m_currentDevice).currentPointerType;
|
||||
const auto packetPointerType = pointerType(packet.pkCursor);
|
||||
|
||||
const Qt::MouseButtons buttons =
|
||||
convertTabletButtons(packet.pkButtons, m_devices.at(m_currentDevice));
|
||||
|
||||
if (buttons == Qt::NoButton && packetPointerType != currentPointer) {
|
||||
|
||||
QWindowSystemInterface::handleTabletLeaveProximityEvent(packet.pkTime,
|
||||
int(currentDevice),
|
||||
int(currentPointer),
|
||||
uniqueId);
|
||||
|
||||
m_devices[m_currentDevice].currentPointerType = packetPointerType;
|
||||
|
||||
QWindowSystemInterface::handleTabletEnterProximityEvent(packet.pkTime,
|
||||
int(currentDevice),
|
||||
int(packetPointerType),
|
||||
uniqueId);
|
||||
}
|
||||
|
||||
QPointF globalPosF =
|
||||
m_devices.at(m_currentDevice).scaleCoordinates(packet.pkX, packet.pkY, virtualDesktopArea);
|
||||
|
||||
|
|
@ -627,9 +647,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
|
|||
<< tiltY << "tanP:" << tangentialPressure << "rotation:" << rotation;
|
||||
}
|
||||
|
||||
Qt::MouseButtons buttons =
|
||||
convertTabletButtons(packet.pkButtons, m_devices.at(m_currentDevice));
|
||||
|
||||
QWindowSystemInterface::handleTabletEvent(target, packet.pkTime, QPointF(localPos), globalPosF,
|
||||
int(currentDevice), int(currentPointer),
|
||||
buttons,
|
||||
|
|
|
|||
Loading…
Reference in New Issue