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
4#ifndef QWINDOWSTABLETSUPPORT_H
5#define QWINDOWSTABLETSUPPORT_H
6
8#include <QtGui/qtguiglobal.h>
9#include <QtGui/qpointingdevice.h>
10
11#include <QtCore/qhash.h>
12#include <QtCore/qlist.h>
13#include <QtCore/qpoint.h>
14#include <QtCore/qsharedpointer.h>
15
16#include <wintab.h>
17
19
20QT_BEGIN_NAMESPACE
21
22class QDebug;
23class QWindow;
24class QRect;
25
27{
28 bool init();
29
30 typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL);
31 typedef BOOL (API *PtrWTClose)(HCTX);
32 typedef UINT (API *PtrWTInfo)(UINT, UINT, LPVOID);
35 typedef int (API *PtrWTPacketsGet)(HCTX, int, LPVOID);
37 typedef int (API *PtrWTQueueSizeGet)(HCTX);
38 typedef BOOL (API *PtrWTQueueSizeSet)(HCTX, int);
39
40 PtrWTOpen wTOpen = nullptr;
42 PtrWTInfo wTInfo = nullptr;
46 PtrWTGet wTGet = nullptr;
49};
50
51// Data associated with a physical cursor (system ID) which is shared between
52// devices of varying device type/pointer type.
54{
55 QPointF scaleCoordinates(int coordX, int coordY,const QRect &targetArea) const;
56 qreal scalePressure(qreal p) const { return p / qreal(maxPressure - minPressure); }
57 qreal scaleTangentialPressure(qreal p) const { return p / qreal(maxTanPressure - minTanPressure); }
58
59 int minPressure = 0;
60 int maxPressure = 0;
63 int minX = 0;
64 int maxX = 0;
65 int minY = 0;
66 int maxY = 0;
67 int minZ = 0;
68 int maxZ = 0;
70 bool zCapability = false;
71 bool tiltCapability = false;
73};
74
76{
77public:
79
80 explicit QWinTabPointingDevice(const DeviceDataPtr &data,
81 const QString &name, qint64 systemId,
82 QInputDevice::DeviceType devType,
83 PointerType pType, Capabilities caps, int maxPoints,
84 int buttonCount, const QString &seatName = QString(),
85 QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(),
86 QObject *parent = nullptr);
87
88 const DeviceDataPtr &deviceData() const { return m_deviceData; }
89
90private:
91 DeviceDataPtr m_deviceData;
92};
93
94#ifndef QT_NO_DEBUG_STREAM
95QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t);
96#endif
97
99{
101
103
104public:
107
108 enum Mode
109 {
112 };
113
120
122
124
125 void notifyActivate();
126 QString description() const;
127
128 bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam);
130
131 static int absoluteRange() { return m_absoluteRange; }
132 static void setAbsoluteRange(int a) { m_absoluteRange = a; }
133
134private:
135 unsigned options() const;
136 QWindowsTabletDeviceData tabletInit(qint64 uniqueId, UINT cursorType) const;
137 void updateData(QWindowsTabletDeviceData *data) const;
138 void updateButtons(unsigned currentCursor, QWindowsTabletDeviceData *data) const;
139 void enterProximity(ulong time = 0, QWindow *window = nullptr);
140 void leaveProximity(ulong time = 0, QWindow *window = nullptr);
141 void enterLeaveProximity(bool enter, ulong time, QWindow *window = nullptr);
142 DevicePtr findDevice(qint64 systemId) const;
143 DevicePtr findDevice(qint64 systemId,
144 QInputDevice::DeviceType deviceType,
145 QPointingDevice::PointerType pointerType) const;
146 DevicePtr clonePhysicalDevice(qint64 systemId,
147 QInputDevice::DeviceType deviceType,
148 QPointingDevice::PointerType pointerType);
149
150 static QWindowsWinTab32DLL m_winTab32DLL;
151 const HWND m_window;
152 const HCTX m_context;
153 static int m_absoluteRange;
154 bool m_tiltSupport = false;
155 Devices m_devices;
156 DevicePtr m_currentDevice;
157 Mode m_mode = PenMode;
158 State m_state = PenUp;
159 ulong m_eventTime = 0;
160};
161
162QT_END_NAMESPACE
163
164#endif // QWINDOWSTABLETSUPPORT_H
\inmodule QtCore\reentrant
Definition qpoint.h:29
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()
Tablet support for Windows.
static void setAbsoluteRange(int a)
bool translateTabletProximityEvent(WPARAM wParam, LPARAM lParam)
static QWindowsTabletSupport * create()
QT_REQUIRE_CONFIG(thread)
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)