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/gui/kernel/qtouchdevice.cpp | |
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/gui/kernel/qtouchdevice.cpp')
-rw-r--r-- | src/gui/kernel/qtouchdevice.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp index 9d19fa4b92..266b5308a2 100644 --- a/src/gui/kernel/qtouchdevice.cpp +++ b/src/gui/kernel/qtouchdevice.cpp @@ -237,6 +237,17 @@ void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev) deviceList()->append(dev); } +/*! + \internal + */ +void QTouchDevicePrivate::unregisterDevice(const QTouchDevice *dev) +{ + QMutexLocker lock(&devicesMutex); + bool wasRemoved = deviceList()->removeOne(dev); + if (wasRemoved && deviceList()->isEmpty()) + qRemovePostRoutine(cleanupDevicesList); +} + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug debug, const QTouchDevice *device) { |