diff options
author | Romain Pokrzywka <romain.pokrzywka@bluescape.com> | 2015-09-22 11:38:09 -0700 |
---|---|---|
committer | Romain Pokrzywka <romain.pokrzywka@gmail.com> | 2015-09-23 16:29:30 +0000 |
commit | 68ea2f7e9bb2d4ea6182101521325dbfd9b74abb (patch) | |
tree | 567634fce8b3e51cdd8fee16eef6048b9359c561 /src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h | |
parent | 29bc68cf169b8cf87d306a1c72e12eb9b6fbfce7 (diff) |
Synchronize QInputDeviceManager touch device count with QTouchDevice
This ensures that the values and signals reported by QInputDeviceManager
for touch devices always have corresponding entries in the list returned
by QTouchDevice::devices().
It also adds proper QTouchDevice unregistration when the underlying
input device gets removed by the evdevtouch QPA plugin.
Change-Id: I7bdf2f7435c775d15bddce8ba1e731afdc1d948a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h')
-rw-r--r-- | src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h index 8e7dfe59bb..ca9756d5de 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h @@ -66,16 +66,22 @@ class QEvdevTouchScreenHandler : public QObject Q_OBJECT public: - explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = 0); + explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = Q_NULLPTR); ~QEvdevTouchScreenHandler(); + QTouchDevice *touchDevice() const; + private slots: void readData(); private: + void registerTouchDevice(); + void unregisterTouchDevice(); + QSocketNotifier *m_notify; int m_fd; QEvdevTouchScreenData *d; + QTouchDevice *m_device; #if !defined(QT_NO_MTDEV) mtdev *m_mtdev; #endif @@ -83,16 +89,24 @@ private: class QEvdevTouchScreenHandlerThread : public QDaemonThread { + Q_OBJECT public: - explicit QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent = 0); + explicit QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent = Q_NULLPTR); ~QEvdevTouchScreenHandlerThread(); void run() Q_DECL_OVERRIDE; - QEvdevTouchScreenHandler *handler() { return m_handler; } + + bool isTouchDeviceRegistered() const; + +signals: + void touchDeviceRegistered(); private: + Q_INVOKABLE void notifyTouchDeviceRegistered(); + QString m_device; QString m_spec; QEvdevTouchScreenHandler *m_handler; + bool m_touchDeviceRegistered; }; QT_END_NAMESPACE |