Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowstabletsupport.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWINDOWSTABLETSUPPORT_H
6#define QWINDOWSTABLETSUPPORT_H
7
9#include <QtGui/qtguiglobal.h>
10#include <QtGui/qpointingdevice.h>
11
12#include <QtCore/qhash.h>
13#include <QtCore/qlist.h>
14#include <QtCore/qpoint.h>
15#include <QtCore/qsharedpointer.h>
16
17#include <wintab.h>
18
20
21QT_BEGIN_NAMESPACE
22
23class QDebug;
24class QWindow;
25class QRect;
26
28{
29 bool init();
30
31 typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL);
32 typedef BOOL (API *PtrWTClose)(HCTX);
33 typedef UINT (API *PtrWTInfo)(UINT, UINT, LPVOID);
36 typedef int (API *PtrWTPacketsGet)(HCTX, int, LPVOID);
38 typedef int (API *PtrWTQueueSizeGet)(HCTX);
39 typedef BOOL (API *PtrWTQueueSizeSet)(HCTX, int);
40
41 PtrWTOpen wTOpen = nullptr;
43 PtrWTInfo wTInfo = nullptr;
47 PtrWTGet wTGet = nullptr;
50};
51
52// Data associated with a physical cursor (system ID) which is shared between
53// devices of varying device type/pointer type.
55{
56 QPointF scaleCoordinates(int coordX, int coordY,const QRect &targetArea) const;
57 qreal scalePressure(qreal p) const { return p / qreal(maxPressure - minPressure); }
58 qreal scaleTangentialPressure(qreal p) const { return p / qreal(maxTanPressure - minTanPressure); }
59
60 int minPressure = 0;
61 int maxPressure = 0;
64 int minX = 0;
65 int maxX = 0;
66 int minY = 0;
67 int maxY = 0;
68 int minZ = 0;
69 int maxZ = 0;
71 bool zCapability = false;
72 bool tiltCapability = false;
74};
75
77{
78public:
80
81 explicit QWinTabPointingDevice(const DeviceDataPtr &data,
82 const QString &name, qint64 systemId,
83 QInputDevice::DeviceType devType,
84 PointerType pType, Capabilities caps, int maxPoints,
85 int buttonCount, const QString &seatName = QString(),
86 QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(),
87 QObject *parent = nullptr);
88
89 const DeviceDataPtr &deviceData() const { return m_deviceData; }
90
91private:
92 DeviceDataPtr m_deviceData;
93};
94
95#ifndef QT_NO_DEBUG_STREAM
96QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t);
97#endif
98
100{
102
104
105public:
108
109 enum Mode
110 {
113 };
114
121
123
125
126 void notifyActivate();
127 QString description() const;
128
129 bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam);
131
132 static int absoluteRange() { return m_absoluteRange; }
133 static void setAbsoluteRange(int a) { m_absoluteRange = a; }
134
135private:
136 unsigned options() const;
137 QWindowsTabletDeviceData tabletInit(qint64 uniqueId, UINT cursorType) const;
138 void updateData(QWindowsTabletDeviceData *data) const;
139 void updateButtons(unsigned currentCursor, QWindowsTabletDeviceData *data) const;
140 void enterProximity(ulong time = 0, QWindow *window = nullptr);
141 void leaveProximity(ulong time = 0, QWindow *window = nullptr);
142 void enterLeaveProximity(bool enter, ulong time, QWindow *window = nullptr);
143 DevicePtr findDevice(qint64 systemId) const;
144 DevicePtr findDevice(qint64 systemId,
145 QInputDevice::DeviceType deviceType,
146 QPointingDevice::PointerType pointerType) const;
147 DevicePtr clonePhysicalDevice(qint64 systemId,
148 QInputDevice::DeviceType deviceType,
149 QPointingDevice::PointerType pointerType);
150
151 static QWindowsWinTab32DLL m_winTab32DLL;
152 const HWND m_window;
153 const HCTX m_context;
154 static int m_absoluteRange;
155 bool m_tiltSupport = false;
156 Devices m_devices;
157 DevicePtr m_currentDevice;
158 Mode m_mode = PenMode;
159 State m_state = PenUp;
160 ulong m_eventTime = 0;
161};
162
163QT_END_NAMESPACE
164
165#endif // QWINDOWSTABLETSUPPORT_H
\inmodule QtCore\reentrant
Definition qpoint.h:30
QWinTabPointingDevice(const DeviceDataPtr &data, const QString &name, qint64 systemId, QInputDevice::DeviceType devType, PointerType pType, Capabilities caps, int maxPoints, int buttonCount, const QString &seatName=QString(), QPointingDeviceUniqueId uniqueId=QPointingDeviceUniqueId(), QObject *parent=nullptr)
const DeviceDataPtr & deviceData() const
Singleton container for all relevant information.
QPlatformKeyMapper * keyMapper() const
static QWindowsContext * instance()
Windows screen.
static QWindow * windowAt(const QPoint &point, unsigned flags)
Tablet support for Windows.
static void setAbsoluteRange(int a)
bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam)
static QWindowsTabletSupport * create()
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(liburing)
Qt::MouseButtons convertTabletButtons(DWORD btnNew, const QWindowsTabletDeviceData &tdd)
@ CursorTypeBitMask
@ TabletPacketQSize
static QPointingDevice::PointerType pointerType(unsigned currentCursor)
#define PACKETDATA
QWinTabPointingDevice * createInputDevice(const QSharedPointer< QWindowsTabletDeviceData > &d, QInputDevice::DeviceType devType, QPointingDevice::PointerType pointerType)
Qt::MouseButton buttonValueToEnum(DWORD button, const QWindowsTabletDeviceData &tdd)
static QInputDevice::DeviceType deviceType(const UINT cursorType)
static int sign(int x)
static void formatOptions(Stream &str, unsigned options)
QPointF scaleCoordinates(int coordX, int coordY, const QRect &targetArea) const
qreal scalePressure(qreal p) const
qreal scaleTangentialPressure(qreal p) const
QHash< quint8, quint8 > buttonsMap
Functions from wintabl32.dll shipped with WACOM tablets used by QWindowsTabletSupport.
PtrWTQueueSizeSet wTQueueSizeSet
UINT(API * PtrWTInfo)(UINT, UINT, LPVOID)
BOOL(API * PtrWTClose)(HCTX)
int(API * PtrWTPacketsGet)(HCTX, int, LPVOID)
PtrWTQueueSizeGet wTQueueSizeGet
HCTX(API * PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL)