Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | extern const QLoggingCategory &qLcEvdevTouch(); | - | ||||||
6 | - | |||||||
7 | QEvdevTouchManager::QEvdevTouchManager(const QString &key, const QString &specification, QObject *parent) | - | ||||||
8 | : QObject(parent) | - | ||||||
9 | { | - | ||||||
10 | (void)key;; | - | ||||||
11 | - | |||||||
12 | if (qEnvironmentVariableIsSet("QT_QPA_EVDEV_DEBUG")
| 0 | ||||||
13 | const_cast< never executed: QLoggingCategory &>(qLcEvdevTouch()).setEnabled(QtDebugMsg, true);const_cast<QLoggingCategory &>(qLcEvdevTouch()).setEnabled(QtDebugMsg, true); never executed: const_cast<QLoggingCategory &>(qLcEvdevTouch()).setEnabled(QtDebugMsg, true); | 0 | ||||||
14 | - | |||||||
15 | QString spec = QString::fromLocal8Bit(qgetenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS")); | - | ||||||
16 | - | |||||||
17 | if (spec.isEmpty()
| 0 | ||||||
18 | spec = specification; never executed: spec = specification; | 0 | ||||||
19 | - | |||||||
20 | QStringList args = spec.split(QLatin1Char(':')); | - | ||||||
21 | QStringList devices; | - | ||||||
22 | - | |||||||
23 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(args)>::type> _container_((args)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &arg = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||
24 | if (arg.startsWith(QLatin1String("/dev/"))
| 0 | ||||||
25 | devices.append(arg); | - | ||||||
26 | args.removeAll(arg); | - | ||||||
27 | } never executed: end of block | 0 | ||||||
28 | } never executed: end of block | 0 | ||||||
29 | - | |||||||
30 | - | |||||||
31 | m_spec = args.join(QLatin1Char(':')); | - | ||||||
32 | - | |||||||
33 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(devices)>::type> _container_((devices)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &device = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||
34 | addDevice(device); never executed: addDevice(device); | 0 | ||||||
35 | - | |||||||
36 | - | |||||||
37 | if (devices.isEmpty()
| 0 | ||||||
38 | for (bool qt_category_enabled = qLcEvdevTouch().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 85, __PRETTY_FUNCTION__, qLcEvdevTouch().categoryName()).debug() << "evdevtouch: Using device discovery"; | 0 | ||||||
39 | m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Touchpad | QDeviceDiscovery::Device_Touchscreen, this); | - | ||||||
40 | if (m_deviceDiscovery
| 0 | ||||||
41 | QStringList devices = m_deviceDiscovery->scanConnectedDevices(); | - | ||||||
42 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(devices)>::type> _container_((devices)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &device = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||
43 | addDevice(device); never executed: addDevice(device); | 0 | ||||||
44 | connect(m_deviceDiscovery, qFlagLocation("2""deviceDetected(QString)" "\0" __FILE__ ":" "91"), this, qFlagLocation("1""addDevice(QString)" "\0" __FILE__ ":" "91")); | - | ||||||
45 | connect(m_deviceDiscovery, qFlagLocation("2""deviceRemoved(QString)" "\0" __FILE__ ":" "92"), this, qFlagLocation("1""removeDevice(QString)" "\0" __FILE__ ":" "92")); | - | ||||||
46 | } never executed: end of block | 0 | ||||||
47 | } never executed: end of block | 0 | ||||||
48 | } never executed: end of block | 0 | ||||||
49 | - | |||||||
50 | QEvdevTouchManager::~QEvdevTouchManager() | - | ||||||
51 | { | - | ||||||
52 | qDeleteAll(m_activeDevices); | - | ||||||
53 | } never executed: end of block | 0 | ||||||
54 | - | |||||||
55 | void QEvdevTouchManager::addDevice(const QString &deviceNode) | - | ||||||
56 | { | - | ||||||
57 | for (bool qt_category_enabled = qLcEvdevTouch().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 104, __PRETTY_FUNCTION__, qLcEvdevTouch().categoryName()).debug() << "evdevtouch: Adding device at" << deviceNode; | 0 | ||||||
58 | QEvdevTouchScreenHandlerThread *handler; | - | ||||||
59 | handler = new QEvdevTouchScreenHandlerThread(deviceNode, m_spec); | - | ||||||
60 | if (handler
| 0 | ||||||
61 | m_activeDevices.insert(deviceNode, handler); | - | ||||||
62 | connect(handler, &QEvdevTouchScreenHandlerThread::touchDeviceRegistered, this, &QEvdevTouchManager::updateInputDeviceCount); | - | ||||||
63 | } never executed: else {end of block | 0 | ||||||
64 | QMessageLogger(__FILE__, 111, __PRETTY_FUNCTION__).warning("evdevtouch: Failed to open touch device %s", QString(deviceNode).toLocal8Bit().constData()); | - | ||||||
65 | } never executed: end of block | 0 | ||||||
66 | } | - | ||||||
67 | - | |||||||
68 | void QEvdevTouchManager::removeDevice(const QString &deviceNode) | - | ||||||
69 | { | - | ||||||
70 | if (m_activeDevices.contains(deviceNode)
| 0 | ||||||
71 | for (bool qt_category_enabled = qLcEvdevTouch().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 118, __PRETTY_FUNCTION__, qLcEvdevTouch().categoryName()).debug() << "evdevtouch: Removing device at" << deviceNode; | 0 | ||||||
72 | QEvdevTouchScreenHandlerThread *handler = m_activeDevices.value(deviceNode); | - | ||||||
73 | m_activeDevices.remove(deviceNode); | - | ||||||
74 | delete handler; | - | ||||||
75 | - | |||||||
76 | updateInputDeviceCount(); | - | ||||||
77 | } never executed: end of block | 0 | ||||||
78 | } never executed: end of block | 0 | ||||||
79 | - | |||||||
80 | void QEvdevTouchManager::updateInputDeviceCount() | - | ||||||
81 | { | - | ||||||
82 | int registeredTouchDevices = 0; | - | ||||||
83 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_activeDevices)>::type> _container_((m_activeDevices)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QEvdevTouchScreenHandlerThread *handler = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||
84 | if (handler->isTouchDeviceRegistered()
| 0 | ||||||
85 | ++ never executed: registeredTouchDevices;++registeredTouchDevices; never executed: ++registeredTouchDevices; | 0 | ||||||
86 | } never executed: end of block | 0 | ||||||
87 | - | |||||||
88 | for (bool qt_category_enabled = qLcEvdevTouch().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 135, __PRETTY_FUNCTION__, qLcEvdevTouch().categoryName()).debug() << "evdevtouch: Updating QInputDeviceManager device count:" << registeredTouchDevices << " touch devices," << m_activeDevices.count() - registeredTouchDevices << "pending handler(s)" ; | 0 | ||||||
89 | << m_activeDevices.count() - registeredTouchDevices << "pending handler(s)" ; never executed: QMessageLogger(__FILE__, 135, __PRETTY_FUNCTION__, qLcEvdevTouch().categoryName()).debug() << "evdevtouch: Updating QInputDeviceManager device count:" << registeredTouchDevices << " touch devices," << m_activeDevices.count() - registeredTouchDevices << "pending handler(s)" ; | 0 | ||||||
90 | - | |||||||
91 | QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount( | - | ||||||
92 | QInputDeviceManager::DeviceTypeTouch, registeredTouchDevices); | - | ||||||
93 | } never executed: end of block | 0 | ||||||
94 | - | |||||||
95 | - | |||||||
Switch to Source code | Preprocessed file |