summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-06-08 12:00:05 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-06-12 13:43:52 +0200
commit3bc10fb9bb930c4e1baf52f9d0ba97616e8e77f6 (patch)
treeb6b3c30e5d0be24fb9e694020478e318b8f93656 /src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
parent12938ba70b1277c15cf58eb7f56b58ab37e08849 (diff)
QEvdev: Replace manual memory management with unique_ptr
Make create() return, and m_mice/m_keyboards/etc store, handlers by unique_ptr. In most cases, we can't use qt_make_unique(), since the ctor we're calling is marked as private. Since QHash can't hold move-only types, use a std::vector<{QString, unique_ptr}> instead. As this pattern repeats in all four QEvdev*Manager classes, create a small class template. Saves almost 6KiB on optimized Linux AMD64 GCC 9.1 builds across all .so's that link to QtInputSupport.a. Change-Id: I8f62b6b629d6e1855314c0a4fb4fc069db9ae0ce Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h')
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
index 62b3c1beea..1d547da1e8 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
@@ -53,6 +53,8 @@
#include "qevdevmousehandler_p.h"
+#include <QtInputSupport/private/devicehandlerlist_p.h>
+
#include <QObject>
#include <QHash>
#include <QSocketNotifier>
@@ -80,7 +82,7 @@ private:
void updateDeviceCount();
QString m_spec;
- QHash<QString,QEvdevMouseHandler*> m_mice;
+ QtInputSupport::DeviceHandlerList<QEvdevMouseHandler> m_mice;
QDeviceDiscovery *m_deviceDiscovery;
int m_x;
int m_y;