Warning, /graphics/krita/3rdparty/ext_qt/0027-Switch-stylus-pointer-type-when-the-tablet-is-in-the.patch is written in an unsupported language. File is not indexed.

0001 From d413135bb1663e904d32481a0977e9d63b7fc129 Mon Sep 17 00:00:00 2001
0002 From: Dmitry Kazakov <dimula73@gmail.com>
0003 Date: Wed, 17 Apr 2019 17:39:10 +0300
0004 Subject: [PATCH 08/47] Switch stylus pointer type when the tablet is in the
0005  tablet proximity
0006 
0007 Some convertible tablet devices have a special stylus button that
0008 converts the stylus into an eraser. Such button can be pressed right
0009 when the stylus is in tablet surface proximity, so we should check
0010 that not only during proximity event handling, but also while parsing
0011 normal wintab packets.
0012 
0013 Make sure that we don't switch tablet pointer type while any **mapped**
0014 stylus button is pressed. Pressing the "eraser" button is reported
0015 in pkButtons, but it maps to none by CSR_SYSBTNMAP
0016 
0017 https://bugs.kde.org/show_bug.cgi?id=405747
0018 https://bugs.kde.org/show_bug.cgi?id=408454
0019 ---
0020  .../windows/qwindowstabletsupport.cpp         | 29 ++++++++++++++++---
0021  1 file changed, 25 insertions(+), 4 deletions(-)
0022 
0023 diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
0024 index 15820533c4..f013efaa15 100644
0025 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
0026 +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
0027 @@ -606,7 +606,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
0028          return false;
0029  
0030      const int currentDevice = m_devices.at(m_currentDevice).currentDevice;
0031 -    const int currentPointer = m_devices.at(m_currentDevice).currentPointerType;
0032      const qint64 uniqueId = m_devices.at(m_currentDevice).uniqueId;
0033  
0034      // The tablet can be used in 2 different modes (reflected in enum Mode),
0035 @@ -636,6 +635,31 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
0036      for (int i = 0; i < packetCount ; ++i) {
0037          const PACKET &packet = localPacketBuf[i];
0038  
0039 +        int currentPointer = m_devices.at(m_currentDevice).currentPointerType;
0040 +
0041 +        const int packetPointerType = pointerType(packet.pkCursor);
0042 +        Qt::MouseButtons buttons =
0043 +            convertTabletButtons(packet.pkButtons, m_devices.at(m_currentDevice));
0044 +
0045 +        if (buttons == Qt::NoButton && packetPointerType != currentPointer) {
0046 +
0047 +            QWindowSystemInterface::handleTabletLeaveProximityEvent(packet.pkTime,
0048 +                                                                    m_devices.at(m_currentDevice).currentDevice,
0049 +                                                                    m_devices.at(m_currentDevice).currentPointerType,
0050 +                                                                    m_devices.at(m_currentDevice).uniqueId);
0051 +
0052 +
0053 +
0054 +            m_devices[m_currentDevice].currentPointerType = packetPointerType;
0055 +
0056 +            QWindowSystemInterface::handleTabletEnterProximityEvent(packet.pkTime,
0057 +                                                                    m_devices.at(m_currentDevice).currentDevice,
0058 +                                                                    m_devices.at(m_currentDevice).currentPointerType,
0059 +                                                                    m_devices.at(m_currentDevice).uniqueId);
0060 +
0061 +            currentPointer = packetPointerType;
0062 +        }
0063 +
0064          const int z = currentDevice == QTabletEvent::FourDMouse ? int(packet.pkZ) : 0;
0065  
0066          QPointF globalPosF =
0067 @@ -709,9 +733,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
0068                  << tiltY << "tanP:" << tangentialPressure << "rotation:" << rotation;
0069          }
0070  
0071 -        Qt::MouseButtons buttons =
0072 -            convertTabletButtons(packet.pkButtons, m_devices.at(m_currentDevice));
0073 -
0074          QWindowSystemInterface::handleTabletEvent(target, packet.pkTime, QPointF(localPos), globalPosF,
0075                                                    currentDevice, currentPointer,
0076                                                    buttons,
0077 -- 
0078 2.20.1.windows.1
0079