diff options
Diffstat (limited to 'src/gui/kernel/qpointingdevice_p.h')
-rw-r--r-- | src/gui/kernel/qpointingdevice_p.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gui/kernel/qpointingdevice_p.h b/src/gui/kernel/qpointingdevice_p.h index 7a2f3761f4..811f5ba01b 100644 --- a/src/gui/kernel/qpointingdevice_p.h +++ b/src/gui/kernel/qpointingdevice_p.h @@ -51,14 +51,17 @@ // We mean it. // +#include <QtGui/private/qevent_p.h> +#include <QtGui/qpointingdevice.h> #include <QtGui/private/qtguiglobal_p.h> #include <QtGui/private/qinputdevice_p.h> -#include <QtGui/qpointingdevice.h> +#include <QtCore/private/qflatmap_p.h> QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QPointingDevicePrivate : public QInputDevicePrivate { + Q_DECLARE_PUBLIC(QPointingDevice) public: QPointingDevicePrivate(const QString &name, qint64 id, QInputDevice::DeviceType type, QPointingDevice::PointerType pType, QPointingDevice::Capabilities caps, @@ -71,8 +74,31 @@ public: pointerType(pType) { pointingDeviceType = true; + activePoints.reserve(maxPoints); } + /*! \internal + This struct (stored in activePoints) holds persistent state between event deliveries. + */ + struct EventPointData { + QEventPoint eventPoint; + QPointer<QObject> exclusiveGrabber; + QList<QPointer <QObject> > passiveGrabbers; + }; + EventPointData *queryPointById(int id) const; + EventPointData *pointById(int id) const; + void removePointById(int id); + QObject *firstActiveTarget() const; + QWindow *firstActiveWindow() const; + + void setExclusiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *exclusiveGrabber); + bool addPassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber); + bool removePassiveGrabber(const QPointerEvent *event, const QEventPoint &point, QObject *grabber); + void clearPassiveGrabbers(const QPointerEvent *event, const QEventPoint &point); + + using EventPointMap = QFlatMap<int, EventPointData>; + mutable EventPointMap activePoints; + void * extra = nullptr; // QPA plugins can store platform-specific stuff here QPointingDeviceUniqueId uniqueId; quint32 toolId = 0; // only for Wacom tablets |