summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace qt_make_unique with std::make_uniqueAllan Sandfeld Jensen2020-11-231-2/+1
| | | | | | | We can depend on C++14 now. Change-Id: Iee9796cd22dbfbb70d4bdb25f0eee1662a026d6d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce QInputDevice hierarchy; replace QTouchDeviceShawn Rutledge2020-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have seen during the Qt 5 series that QMouseEvent::source() does not provide enough information: if it is synthesized, it could have come from any device for which mouse events are synthesized, not only from a touchscreen. By providing in every QInputEvent as complete information about the actual source device as possible, we will enable very fine-tuned behavior in the object that handles each event. Further, we would like to support multiple keyboards, pointing devices, and named groups of devices that are known as "seats" in Wayland. In Qt 5, QPA plugins registered each touchscreen as it was discovered. Now we extend this pattern to all input devices. This new requirement can be implemented gradually; for now, if a QTWSI input event is received wtihout a device pointer, a default "core" device will be created on-the-fly, and a warning emitted. In Qt 5, QTouchEvent::TouchPoint::id() was forced to be unique even when multiple devices were in use simultaneously. Now that each event identifies the device it came from, this hack is no longer needed. A stub of the new QPointerEvent is added; it will be developed further in subsequent patches. [ChangeLog][QtGui][QInputEvent] Every QInputEvent now carries a pointer to an instance of QInputDevice, or the subclass QPointingDevice in case of mouse, touch and tablet events. Each platform plugin is expected to create the device instances, register them, and provide valid pointers with all input events. If this is not done, warnings are emitted and default devices are created as necessary. When the device has accurate information, it provides the opportunity to fine-tune behavior depending on device type and capabilities: for example if a QMouseEvent is synthesized from a touchscreen, the recipient can see which touchscreen it came from. Each device also has a seatName to distinguish users on multi-user windowing systems. Touchpoint IDs are no longer unique on their own, but the combination of ID and device is. Fixes: QTBUG-46412 Fixes: QTBUG-72167 Task-number: QTBUG-69433 Task-number: QTBUG-52430 Change-Id: I933fb2b86182efa722037b7a33e404c5daf5292a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* evdevtouch: Fix touch device count not being updatedJohan Klokkhammer Helsing2019-10-111-1/+1
| | | | | | | | | When this was refactored in 3bc10fb9bb9 to use unique pointers, a move was added before the connection, so it would essentially always try to connect a nullptr. Change-Id: Iab7fce88bc73afd78e6b63ffaef7358f3f4ce7e3 Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
* QEvdev: remove m_deviceDiscovery membersMarc Mutz2019-06-131-5/+4
| | | | | | | | | | | | | | | | | | | They were never referenced outside the classes' ctor and, worse, remained uninitialized if the specification string contained devices. Change-Id: I977a156acf10190428da00fe128fee70cff8f98d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QEvdev: Extract Method parseSpecification()Marc Mutz2019-06-131-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | All four manager classes contained roughly the same code in their ctors that parsed out devices from a colon-separated string. Extract shared code, and port the parsing to QStringRef (later to be ported to QStringView). Saves ~2.4KiB on optimized Linux GCC 9.1 AMD64 builds across all .so's that link to libQtInputSupport.a. Change-Id: I3db826ee2b422cfc02f8d49bd21985a03b6c0935 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QEvdev: Replace manual memory management with unique_ptrMarc Mutz2019-06-121-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QEvdev: use printf-style qCDebug()/qWarning()Marc Mutz2019-06-111-6/+6
| | | | | | | | | | | | | Also use qUtf16Printable() and qErrnoWarning (removing explicit errno, where present). Saves 6.6KiB in text size on optimized Linux AMD64 GCC 9.1 build across all .so's that link to QtInputSupport.a. Change-Id: I1def2cfabd2eed65390099cd1d06f8061a9355be Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* evdev*,libinput: use functor-based connectionsGatis Paeglis2017-09-051-2/+5
| | | | | | | | | This results in less boilerplate code, among other benefits that come with functor-based connections. Simple expressions have been converted to use lambda. Change-Id: I6887980524027eada24beed95e6f9ba43f0fc8d5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* create modularized version of qtplatformsupport moduleOswald Buddenhagen2016-10-151-1/+1
| | | | | | | | | | lumping together all kinds of unrelated stuff has caused problems with spurious dependencies from the beginning. as the modularization infra is now in a state which supports many small private libraries just fine, take advantage of it. Change-Id: Ic40f47ce76a308bbfd32deae281f6f064fe1ef4c Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* platformsupport: eradicate some easy Q_FOREACH loopsMarc Mutz2016-08-261-2/+2
| | | | | | | | | | | | All loops trivially not modifying the iterated-over container. Saves ~9.4KiB in text size across all plugins and libs (statically) linking in QtPlatformSupport (optimized GCC 6.1 Linux AMD 64 build). Change-Id: I2d91da1f78d9b33d4c5e4a1627560d8e705a9b9a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix crash on process exit when the evdevtouch plugin is loadedRomain Pokrzywka2015-10-281-1/+0
| | | | | | | | | | | | | | The QGuiApplicationPrivate object is already destroyed by the time the plugins are cleaned up during the application destruction, causing a segmentation fault in updateInputDeviceCount(). There's no point in calling updateInputDeviceCount() in the destructor anyway as the whole process is on its way out that stage, and we don't support unloading plugins during the application lifetime otherwise, so the call can just be removed from the destructor. Change-Id: Id819d73cb8234ccedb6ea7c3e39950589ee680a1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Synchronize QInputDeviceManager touch device count with QTouchDeviceRomain Pokrzywka2015-09-231-6/+21
| | | | | | | | | | | | 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>
* evdevtouch: Add hotplug supportLaszlo Agocs2015-04-091-0/+122
Follow the exact same structure as evdevmouse and keyboard. We must do monitoring via device discovery just like we do for keyboards and mice. Otherwise the usage of touchscreens that connect via USB or can be turned on/off independently from the board becomes troublesome. Change-Id: I2de3b519e8d617b0612e5df486e481bbc09b9c8c Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>