summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtGui: code tidies: use the 4-arg connect overloadGiuseppe D'Angelo2023-06-281-1/+1
| | | | | | | | The 3-arg connect is error-prone and makes the lifetime of the connection unclear. Change-Id: I99aa3575a7f901ac52f451f9ef51aa903640d097 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-111-2/+2
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Platformsupport: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-261-2/+4
| | | | | | | Task-number: QTBUG-98434 Change-Id: I4fa7ca58b4a298e81d35f19b439ed7702bd9700d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Port platformsupport to QStringViewLars Knoll2020-06-151-1/+1
| | | | | | Task-number: QTBUG-84319 Change-Id: I8032382904bc8481fe0a147ca38f3de9cfb1890f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-171-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qlogging.cpp src/gui/painting/qtextureglyphcache_p.h src/gui/text/qfontengine.cpp src/widgets/widgets/qlineedit.cpp Change-Id: Ic8798538df466b7141caa8bbf1fb7605eb56be37
| * Fix compilation with C++20Marc Mutz2019-07-061-1/+1
| | | | | | | | | | | | | | | | | | Implicit capture of 'this' in [=] is deprecated in C++20. Fix by using explicit captures. Change-Id: I1633446f4670202b0d1aca938d8c27dbc0c1411e Reviewed-by: Mårten Nordheim <marten.nordheim@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-13/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Extract Method updateDeviceCount()Marc Mutz2019-06-111-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code is noisy and repeats, so wrap it in a function. Change-Id: I5e6e924e22b0bc631eb8176de96c49066b1c9029 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QEvdev: use printf-style qCDebug()/qWarning()Marc Mutz2019-06-111-4/+4
|/ | | | | | | | | | | | | 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>
* Fix for mouse with modifiers handlingKarim Pinter2018-05-021-3/+2
| | | | | | | | | | | | Modifier keys are saved in qinputdevicemanager such way that both evdev and libinput can use it the same way, it is also handling the repeating modifier key events. Evdev support is important for VxWorks support because it is using it. Task-number: QTBUG-60694 Change-Id: I49038cb7fe2ad5134b3a37167c19953867ea31c3 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* qpa: enhance mouse event with type and button dataGatis Paeglis2017-10-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and deprecate QWSI APIs that accepts mouse event without mouse button/ type data. In the early days of Qt5 it was decided to centralize mouse button/type handling in QGuiApplication (because of limitation of some now unknown platform). This has proven to be problematic as mouse handling details differ across platforms (e.g on X11 we do not receive mouse release event when closing popup windows or ordinary windows that are closed from the mouse press event). Instead of hacking around platform specific behaviors in Qt Gui, we should move this task back to platform plugins (similar to how this was done in Qt4 with native APIs sending mouse details directly to QApplication). There are even cases where it simply is not possible to deduce (from QGuiApplication) which button caused the event (e.g. when more than one button is involved and some event goes missing). Besisdes, throwing away information which is already available at QPA level (for free) and trying to deduce it again at Qt Gui level seems impractical, fagile (as probably noticed by people fixing all the unexpected issues) and adds unnecessary complexity. Note: Removing the deprecated QWSI APIs from offscreen plugin depends on fixing autotests that rely on QOffscreenCursor::setPos() logic. For the convenience of testing use QT_QPA_DISABLE_ENHANCED_MOUSE to restore to the old code path where QGuiApplication does the mouse state deducing. Other platforms have similar issues. I do not have all supported platform available on my desk, so other platform maintainers will need to take care of porting those platforms to the new APIs. And mainly, I don't want to deal with all the hacks that other platforms have added to workaround this broken mouse logic. In Qt6 we need to remove deprecated code path from QGuiApplication. This patch: - Extends QWindowSystemInterfacePrivate::MouseEvent ctor with QEvent::Type and Qt::MouseButton. We use this extra data when processing mouse events in QGuiApplication. This actually is similar to KeyEvent, where we do pass the type (press or release) to QtGui. - Refactors QGuiApplicationPrivate::processMouseEvent and qtestlib to use the new APIs. Task-number: QTBUG-59277 Task-number: QTBUG-62329 Task-number: QTBUG-63467 Change-Id: If94fd46a7cccfea8264dcb1368804c73334558b8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* evdev*,libinput: use functor-based connectionsGatis Paeglis2017-09-051-15/+15
| | | | | | | | | 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>
* xcb,evdevmouse: don't use qpa compatibility functionsGatis Paeglis2017-06-081-3/+3
| | | | | | Change-Id: If3f474dcb6ee117c6dd26cd56fd4ad8d39e60e1f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> 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-3/+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>
* Input: Convert QScreen geometry to native pixelsMorten Johan Sørvig2015-11-181-1/+3
| | | | | | | | | | Low-level input handling uses the native coordinate system and the (device independent) coordinates from QScreen needs to be converted. Change-Id: I501dc77f5e51be01a42e533cd0609e069b8d228b Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Support QCursor::setPos() properly for eglfsLaszlo Agocs2015-03-141-10/+25
| | | | | | | | | | | | | | | | | The internal state of the input handlers need updating too. This was not possible in the past due to the one way communication from the input handlers (that are potentially loaded as interface-less generic plugins), but using our new private QInputDeviceManager in QtGui we can now easily implement "talking back" from QtGui to the input handlers, regardless of them being plugins or compiled in. The rest of setPos() is in place already for eglfs. linuxfb will be handled in follow-up patches. Task-number: QTBUG-44856 Change-Id: Id72fdb8b1ea176ddfe082e466e7a538a2a98a005 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Unify input device hotplugging support for embeddedLaszlo Agocs2015-01-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | On embedded the mouse cursor will now appear and reappear regardless of how the input handling code is loaded (via a generic plugin or compiled-in to the platform plugin). Instead of passing around QDeviceDiscovery instances that only works when compiling-in the code into the platform plugin, introduce a new internal central QInputDeviceManager. The single instance of this provides a place to store any future input device related signals and properties. Also introduce mouse hotplugging support to linuxfb. [ChangeLog][QtGui] The mouse cursor on Embedded Linux is now handling hotplugging correctly with eglfs and linuxfb regardless of how the input handling code is loaded (via a generic plugin or built in to the platform plugin). Change-Id: I147c1b04a193baf216598015264f2c06e1b20f84 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Switch to categorized logging in all the input handlersLaszlo Agocs2014-10-161-26/+7
| | | | | | | | | | | | | | | Use the rule qt.qpa.input (similarly to xcb). In addition, evdevkeyboard supports qt.qpa.input.keymap to enable keymap debug messages. For compatibility, evdevtouch retains the QT_QPA_EVDEV_DEBUG environment variable, this will simply turn on the associated logging rule. Change-Id: Ia038beb827346d2573ca9a2b69b8dcc53adcf0eb Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Risto Avila <risto.avila@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Report keyboard modifiers in evdevmouseLaszlo Agocs2014-07-021-2/+4
| | | | | | | | | | | | Mouse and wheel events have no modifiers set. This is not ideal. Pass at least QGuiApplication::keyboardModifiers() to get the modifiers from the last key event. Task-number: QTBUG-39812 Change-Id: Ica0c338c60c3e289dccfafa5aa6d602d4e111ad5 Reviewed-by: Leonard Lee <leonard.lee@digia.com> Reviewed-by: Will Wagner <willw@carallon.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Add: absolute touch screen handling in evdevmouseAndrew Gatt2014-03-241-4/+9
| | | | | | | | | | | | | | Some touch screen drivers present themselves as mice with absolute coordinates. Setting QT_QPA_EVDEV_MOUSE_PARAMETERS=abs will force qevdevmousehandler to use absolute coordinates, mapped to the screen from the hardware maximums. These maximum values are read from the driver using ioctls. This feature can be safely used with mice, as the features checks will fail and qevdevmouse will revert back to using relative coordinates. This way touch screens and mice can work together. Change-Id: Ic27bda02aa2199f008bac26db75c1f896696f9f5 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Added configuration environment variables for evdev input plugins.Libor Tomsik2013-03-201-1/+6
| | | | | | | | | | Added new environment parameters QT_QPA_EVDEV_KEYBOARD_PARAMETERS, QT_QPA_EVDEV_MOUSE_PARAMETERS and QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS to the evdevkeyboard, evdevmouse and evdevtouch input plugins. In order to get evdevkeyboard support for keyboard layout, explicit device file and more. Change-Id: I0d9139cd0d4b682ab2df7c16ebd16d4d9c0c0ab0 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Use QStringList::join(QChar) overload where applicable [QtGui]Marc Mutz2012-09-071-1/+1
| | | | | | | | | | This is an automated change performing the following replacements: join\("(.)"\) -> join('\1') join\(QLatin1String\("(.)"\)\) -> join(QLatin1Char('\1')) join\(QStringLiteral\("(.)"\)\) -> join(QLatin1Char('\1')) Change-Id: Id8d43c1b1ca9cd3aa0b4eedca6709b6287a9bc98 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Revert "Move QWindowSystemInterface out of qpa."Paul Olav Tvete2012-08-031-1/+1
| | | | | | | | | | | | | | This reverts commit 784a877d3cd9a1a75aca9c83146389503a966071. Conflicts: src/plugins/platforms/cocoa/qcocoawindow.mm src/testlib/qtestkeyboard.h src/testlib/qtestmouse.h src/testlib/qtesttouch.h Change-Id: Iebfed179b3eb7f30e4c95edcae5a8ad6fd50330e Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Move QWindowSystemInterface out of qpa.Stephen Kelly2012-07-191-1/+1
| | | | | | | | Public QtTest headers require it, so all unit tests would have to use private Qt headers otherwise, which is not practical. Change-Id: I5d4466ec30b6a57ebdfc34413e716e657eb51368 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
* input/evdevmouse: normalize signals/slotsMarc Mutz2012-07-131-2/+2
| | | | | | | | | This is the result of running util/normalize --modify from Qt 4.7 with manual review. Change-Id: I4afac23e897404ac7efb5b4a89493a2c15e3c670 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Suppress QWindowSystemInterface inclusion warnings.Girish Ramakrishnan2012-07-031-1/+1
| | | | | | | | | | | | | Since QWindowSystemInterface is now part of QPA API. The correct inclusion is: #include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface_p.h> Bulk of the work was done by: find . -type f | xargs sed -i -e 's,#include <\(QtGui/\)\?QWindowSystemInterface>,#include <qpa/qwindowsysteminterface.h>,g' Change-Id: If75fc32611e72ef1cf58505794def375b1acf74a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Add const & to foreach 'iterators'Albert Astals Cid2012-06-271-1/+1
| | | | | | | Change-Id: I8c0600dfd919f45d14a0011f2da9b9fe0b9a0df3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* evdevmouse: send correct event position for wheel eventsJohannes Zellner2012-06-101-0/+11
| | | | | | | | The current position for mouse events is synchronized in the mousemanager, thus the wheel event needs to pick the event position from there. Change-Id: I1e73a0154b596885c7092f0a74e6dd448deb428c Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
* Move evdev to platformsupportGirish Ramakrishnan2012-06-011-0/+163
Also wraps various string literals with QLatin1String. Change-Id: Ia0681bfae00006d9e9ad51f05d0e0d0f45cf2cec Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com> Reviewed-by: Donald Carr <donald.carr@nokia.com>