34 Q_DECLARE_PUBLIC(QPointingDevice)
36 QPointingDevicePrivate(
const QString &name, qint64 id, QInputDevice::DeviceType type,
37 QPointingDevice::PointerType pType, QPointingDevice::Capabilities caps,
38 int maxPoints,
int buttonCount,
39 const QString &seatName = QString(),
40 QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId())
41 : QInputDevicePrivate(name, id, type, caps, seatName),
43 maximumTouchPoints(qint8(maxPoints)), buttonCount(qint8(buttonCount)),
46 pointingDeviceType =
true;
47 activePoints.reserve(maxPoints);
49 ~QPointingDevicePrivate() override;
51 void sendTouchCancelEvent(QTouchEvent *cancelEvent);
54
55
56 struct EventPointData {
57 QEventPoint eventPoint;
58 QPointer<QObject> exclusiveGrabber;
59 QPointer<QObject> exclusiveGrabberContext;
60 QList<QPointer <QObject> > passiveGrabbers;
61 QList<QPointer <QObject> > passiveGrabbersContext;
63 EventPointData *queryPointById(
int id)
const;
64 EventPointData *pointById(
int id)
const;
65 void removePointById(
int id);
66 QObject *firstActiveTarget()
const;
67 QWindow *firstActiveWindow()
const;
69 QObject *firstPointExclusiveGrabber()
const;
70 void setExclusiveGrabber(
const QPointerEvent *event,
const QEventPoint &point, QObject *exclusiveGrabber);
71 bool removeExclusiveGrabber(
const QPointerEvent *event,
const QObject *grabber);
72 bool addPassiveGrabber(
const QPointerEvent *event,
const QEventPoint &point, QObject *grabber);
73 static bool setPassiveGrabberContext(EventPointData *epd, QObject *grabber, QObject *context);
74 bool removePassiveGrabber(
const QPointerEvent *event,
const QEventPoint &point, QObject *grabber);
75 void clearPassiveGrabbers(
const QPointerEvent *event,
const QEventPoint &point);
76 void removeGrabber(QObject *grabber,
bool cancel =
false);
78 using EventPointMap = QVarLengthFlatMap<
int, EventPointData, 20>;
79 mutable EventPointMap activePoints;
81 QPointingDeviceUniqueId uniqueId;
83 qint8 maximumTouchPoints = 0;
84 qint8 buttonCount = 0;
85 QPointingDevice::PointerType pointerType = QPointingDevice::PointerType::Unknown;
86 bool toolProximity =
false;
88 inline static QPointingDevicePrivate *get(QPointingDevice *q)
90 return static_cast<QPointingDevicePrivate *>(QObjectPrivate::get(q));
93 inline static const QPointingDevicePrivate *get(
const QPointingDevice *q)
95 return static_cast<
const QPointingDevicePrivate *>(QObjectPrivate::get(q));
98 static const QPointingDevice *tabletDevice(QInputDevice::DeviceType deviceType,
99 QPointingDevice::PointerType pointerType,
100 QPointingDeviceUniqueId uniqueId);
102 static const QPointingDevice *queryTabletDevice(QInputDevice::DeviceType deviceType,
103 QPointingDevice::PointerType pointerType,
104 QPointingDeviceUniqueId uniqueId,
105 QInputDevice::Capabilities capabilities = QInputDevice::Capability::None,
106 qint64 systemId = 0);
108 static const QPointingDevice *pointingDeviceById(qint64 systemId);