33 Q_DECLARE_PUBLIC(QPointingDevice)
35 QPointingDevicePrivate(
const QString &name, qint64 id, QInputDevice::DeviceType type,
36 QPointingDevice::PointerType pType, QPointingDevice::Capabilities caps,
37 int maxPoints,
int buttonCount,
38 const QString &seatName = QString(),
39 QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId())
40 : QInputDevicePrivate(name, id, type, caps, seatName),
42 maximumTouchPoints(qint8(maxPoints)), buttonCount(qint8(buttonCount)),
45 pointingDeviceType =
true;
46 activePoints.reserve(maxPoints);
48 ~QPointingDevicePrivate() override;
50 void sendTouchCancelEvent(QTouchEvent *cancelEvent);
53
54
55 struct EventPointData {
56 QEventPoint eventPoint;
57 QPointer<QObject> exclusiveGrabber;
58 QPointer<QObject> exclusiveGrabberContext;
59 QList<QPointer <QObject> > passiveGrabbers;
60 QList<QPointer <QObject> > passiveGrabbersContext;
62 EventPointData *queryPointById(
int id)
const;
63 EventPointData *pointById(
int id)
const;
64 void removePointById(
int id);
65 QObject *firstActiveTarget()
const;
66 QWindow *firstActiveWindow()
const;
68 QObject *firstPointExclusiveGrabber()
const;
69 void setExclusiveGrabber(
const QPointerEvent *event,
const QEventPoint &point, QObject *exclusiveGrabber);
70 bool removeExclusiveGrabber(
const QPointerEvent *event,
const QObject *grabber);
71 bool addPassiveGrabber(
const QPointerEvent *event,
const QEventPoint &point, QObject *grabber);
72 static bool setPassiveGrabberContext(EventPointData *epd, QObject *grabber, QObject *context);
73 bool removePassiveGrabber(
const QPointerEvent *event,
const QEventPoint &point, QObject *grabber);
74 void clearPassiveGrabbers(
const QPointerEvent *event,
const QEventPoint &point);
75 void removeGrabber(QObject *grabber,
bool cancel =
false);
77 using EventPointMap = QVarLengthFlatMap<
int, EventPointData, 20>;
78 mutable EventPointMap activePoints;
80 QPointingDeviceUniqueId uniqueId;
82 qint8 maximumTouchPoints = 0;
83 qint8 buttonCount = 0;
84 QPointingDevice::PointerType pointerType = QPointingDevice::PointerType::Unknown;
85 bool toolProximity =
false;
87 inline static QPointingDevicePrivate *get(QPointingDevice *q)
89 return static_cast<QPointingDevicePrivate *>(QObjectPrivate::get(q));
92 inline static const QPointingDevicePrivate *get(
const QPointingDevice *q)
94 return static_cast<
const QPointingDevicePrivate *>(QObjectPrivate::get(q));
97 static const QPointingDevice *tabletDevice(QInputDevice::DeviceType deviceType,
98 QPointingDevice::PointerType pointerType,
99 QPointingDeviceUniqueId uniqueId);
101 static const QPointingDevice *queryTabletDevice(QInputDevice::DeviceType deviceType,
102 QPointingDevice::PointerType pointerType,
103 QPointingDeviceUniqueId uniqueId,
104 QInputDevice::Capabilities capabilities = QInputDevice::Capability::None,
105 qint64 systemId = 0);
107 static const QPointingDevice *pointingDeviceById(qint64 systemId);