summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qinputdevice.cpp
Commit message (Collapse)AuthorAgeFilesLines
* For qdebug operator<< of pointer types, always check for nullptrDaniel Trevitz2025-05-171-4/+2
| | | | | | | | Also, use a consistent syntax for when the pointer is null. Fixes: QTBUG-135856 Change-Id: I2f5c80a5650b1be6cc0d70cde7cd1e1c1990df9a Reviewed-by: Christian Ehrlicher <[email protected]>
* GUI: no need to unregister input device if list is destroyedThiago Macieira2025-02-181-0/+3
| | | | | | | | Fixes: QTBUG-133776 Pick-to: 6.9 6.8 Change-Id: If4a148e3ebf753ccd661a5ed1b321dbd7751576e Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Liang Qi <[email protected]>
* Tweak QInputDevice loggingTor Arne Vestbø2024-11-151-2/+2
| | | | | | | | | | | | | | | | | The logging category now silences QtWarningMsg and below by default, so we can be more granular in our logging. Use info logging category for registering/unregistering, to allow filtering out the detailed debug logging while still seeing when devices are registered/unregistered. Log the number of buttons for pointing devices, if there are any. Log the device for wheel events. Pick-to: 6.8 Change-Id: Ie046fee1659fc3967caf7eafbaf46f3ed22be5bb Reviewed-by: Shawn Rutledge <[email protected]>
* qpa: Add logging when registering and unregistering QInputDeviceTor Arne Vestbø2024-11-011-0/+2
| | | | | | Pick-to: 6.8 Change-Id: If2e7d106a449f3dc8ecb148540e21e1b70ec180e Reviewed-by: Shawn Rutledge <[email protected]>
* Show decimal device IDs in QInputDevice qDebug outputShawn Rutledge2023-06-201-1/+1
| | | | | | | | | | | | The lack of 0x adornment made hex confusing. `xinput list` shows device IDs as decimal, and device IDs appear in decimal in some categorized qt.qpa.input.devices log messages, so let's be consistent here too. Also fixed one more that was inconsistent in that category: "scroll event from unregistered device <x>" Change-Id: I98a39b30b1bc030611d3cfe9dd5e95886faf48ff Pick-to: 6.5 6.6 Reviewed-by: Shawn Rutledge <[email protected]>
* doc: Reduce expectations for QInputDevice::devices()Shawn Rutledge2023-05-231-0/+7
| | | | | | | | | | | | | | | | I was hoping we could get the list mostly correct and complete on most platforms; but in practice, it's proving difficult on most platforms. Hopefully we can find ways to improve it over time. Task-number: QTBUG-101648 Task-number: QTBUG-101875 Task-number: QTBUG-112432 Task-number: QTBUG-113706 Task-number: QTBUG-113711 Change-Id: I16b6900cddb54197fb7b833a513e36996de72d51 Pick-to: 6.2 6.5 Reviewed-by: Paul Wicking <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
* Move nullptr check to beginning of QInputDevice::operator<<Axel Spoerl2023-03-211-8/+13
| | | | | | | | | | | | | Nullptr check was performed after aquisition of the d-pointer. That acquisition crashes if nullptr is passed to the operator, so the actual check was never hit. This patch moves the nullptr check to the beginning of the method. Fixes: QTBUG-112174 Pick-to: 6.5 6.2 5.15 Change-Id: If339e2de9ce2e33e10d925e79ca06b3854a24f76 Reviewed-by: Friedemann Kleint <[email protected]>
* 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 <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* Fix versioning of PixelScrollKai Köhne2022-05-131-1/+1
| | | | | | | | | | \since will mark the whole enum as new in 6.2 Amends 673ed80fa42a77c Pick-to: 6.2 6.3 Change-Id: I88bd73d3bf8b0da355e3200b7a9b67fc141a2b93 Reviewed-by: Topi Reiniö <[email protected]>
* QtGui: includemocsMarc Mutz2022-04-291-0/+2
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: I1945741794c25679a9d94c0d68c8642e2c823502 Reviewed-by: Mårten Nordheim <[email protected]>
* QtGui: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-281-1/+3
| | | | | | Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <[email protected]>
* Short live Q_CONSTINIT!Marc Mutz2022-03-261-1/+1
| | | | | | | | | | | | | | | | | | It expands to the first available of - constinit (C++20) - [[clang::require_constant_initialization]] (Clang) - __constinit (GCC >= 10) Use it around the code (on and near static QBasicAtomic; this patch makes no attempt to find all statics in qtbase). [ChangeLog][QtCore][QtGlobal] Added macro Q_CONSTINIT. Fixes: QTBUG-100484 Change-Id: I11e0363a7acb3464476859d12ec7f94319d82be7 Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* gui: return first default device when seatName isNullLiang Qi2022-03-131-3/+5
| | | | | | | | | | | | | for QInputDevice::primaryKeyboard() and QPointingDevice::primaryPointingDevice(). This also reverts ae9fefe3c89fd5720ccaad0687f125e32f7c3fe6. Fixes: QTBUG-100790 Pick-to: 6.3 Change-Id: Id02f277db25f823eb29e939e25801325df8e4076 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* De-duplicate vtables, 2022 editionMarc Mutz2022-02-151-0/+3
| | | | | | | | | | | | | | | | | | | This de-inlines destuctors of classes whose vtables are proven to be duplicated even within the set of Qt libraries. Since these are all private API classes, we can pick all the way back to 6.2, and we don't need the comment that the dtor must always stay empty, like for public classes. As a drive-by, also de-inline the QPaintDeviceWindowPrivate ctor. That's just code hygiene, it doesn't partake in vtable duplicating. Pick-to: 6.3 6.2 Task-number: QTBUG-45582 Change-Id: I3477063d6f42edc9a5d352c47900366fd50c3ef6 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Giuseppe D'Angelo <[email protected]>
* gui: add QInputDevice::seatNames()Liang Qi2021-11-281-0/+19
| | | | | Change-Id: Ie6cedd62dcd684a8fd9adbc2409e5aa1f3490ede Reviewed-by: Volker Hilsheimer <[email protected]>
* doc: Add the PixelScroll device capability (new in 6.2)Shawn Rutledge2021-09-041-0/+5
| | | | | | | | | | Followup to 69c833dae91d004b48f815e0156d6caeb4cdb491 Pick-to: 6.2 Task-number: QTBUG-72167 Task-number: QTBUG-87646 Change-Id: I4ac7cbacd6dc1407ad3b565674a6d6494ec8857f Reviewed-by: Tor Arne Vestbø <[email protected]>
* QInputDevice: Parent default keyboard to core app singletonFabian Kosmale2020-12-041-1/+1
| | | | | | | | | | | With this we can avoid leaking the QInputDevice which is created when the platform plugin does not provide any. The onwership is solved in a similar way as in the plugins, except that here we have no parent which really fits, so we use QCoreApplication::instance instead. Pick-to: 6.0 Change-Id: I77a212fb592ba3d5a42b2ecd486763e3b4d3410e Reviewed-by: Shawn Rutledge <[email protected]>
* Move QEventPoint and QPointingDeviceUniqueId out of qeventVolker Hilsheimer2020-11-071-3/+1
| | | | | | | | | | | | | | | | | | | qevent.h/cpp are huge already, no need for more classes. Move QEventPoint into new qeventpoint.h/cpp files, and QPointingDeviceUniqueId into qpointingdevice.cpp; the class is already declared in qpointingdevice.h. Move the documentation of QEventPoint APIs next to the implementation, and document all APIs as properties. Add Q_PROPERTY macro where missing. QEventPoint::device needs a workaround of qdoc due to the type being a pointer-to-const; qdoc doesn't know how to tie a \property to it, but documents it correctly. While at it, move the logging category declarations to the header matching the .cpp file where they are defined. Change-Id: I096e609edbb760b5686d577e7fe47eea0807904e Reviewed-by: Shawn Rutledge <[email protected]>
* Address API review comments for QInput/QPointingDeviceVolker Hilsheimer2020-11-031-3/+3
| | | | | | | | | | | | | | - Give default constructor an optional parent, as is standard for QObjects - remove default for QObject parent from inheritance constructor - make QPointingDeviceUniqueId comparison inline, remove superfluous inline of hidden friends - mark read only properties as CONSTANT - remove bit-size from enum types; they are stored in the private, and there are just a few instances; no need to save a few bytes at the expense of performance and code cleanliness Change-Id: Ie7d4a587362714e9d3bc41447cef786bbdb382c6 Reviewed-by: Shawn Rutledge <[email protected]>
* Doc: Fix documentation issues for event and input device classesTopi Reinio2020-09-101-5/+66
| | | | | | | | | | | | | | * Document the new base classes QPointerEvent and QSinglePointEvent, and move relevant documentation to be located under them. * Replace linking to deprecated functions with their new counterparts. * Remove non-existent function and parameter documentation. * Document QEventPoint::State enum. * Prefer \obsolete over \deprecated and fix the usage. * Document the Capabilities enum in the correct location and add docs for the missing enum values. Change-Id: Ic8f2732f2e90ecbf522cd744c601cedcc574825c Reviewed-by: Shawn Rutledge <[email protected]>
* Separate QPD::tabletDevice into priv tabletDevice and queryTabletDeviceShawn Rutledge2020-07-071-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There doesn't seem to be any reason users will need to query tablet devices by their IDs, because every event comes with a complete instance already, and we have QInputDevice::devices() to list them all. QPointingDevicePrivate::tabletDevice() can create a new instance if a matching one is not found (and complains about that); it's intended for use in QtGui, as a way to find the device if it was not part of the QWSI event. Now it sets the parent of those auto-created instances to QCoreApplication to avoid a memory leak. On the other hand, queryTabletDevice() is intended for use in platform plugins that need to check whether an instance exists; but they will take care of creating new instances themselves, and thus have more control over the parent and the details being stored. Now that the systemId can also be given, the search is more likely to have a unique result, on window systems that provide device IDs. Rename id() to systemId() to clarify that it's a system-specific unique device ID of some sort, not the same as the uniqueId that a stylus has. However it seems that in practice, this will often be 0; so clarify that if it's not unique, QInputDevicePrivate::fromId() and queryTabletDevice() may not always find the right instance. Clarify the function usage via comments. Change-Id: I82bb8d1c26eeaf06f07c290828aa17ec4a31646b Reviewed-by: Volker Hilsheimer <[email protected]>
* Add QInputDevice::availableVirtualGeometry()Shawn Rutledge2020-07-061-0/+23
| | | | | | | | | | | | | | | | | | This property tells what part of the virtual desktop the input device can access. This is not a one-to-one mapping with a QScreen, because a Wacom tablet might be configured to access a whole desktop, a whole screen, or an area corresponding to the drawing area of one window; a mouse normally can access the whole desktop (so QScreen::virtualGeometry() would be identical to QInputDevice::availableVirtualGeometry()); a touchscreen normally is mapped to one screen but could be mapped differently; etc. It's possible to find the intersection of the rectangular area with the screen(s) that it overlaps, though. Task-number: QTBUG-78839 Change-Id: I9040e20fb5a3dec8a9a0dd827735826c4c1eea38 Reviewed-by: Jan Arve Sæther <[email protected]>
* Make QDebug operator<< polymorphic for QPointingDeviceShawn Rutledge2020-07-011-0/+4
| | | | | | | | | At least it will look polymorphic by doing dispatch internally. Adding pointingDeviceType avoids the need for qobject_cast, and will probably also be useful in other contexts. Change-Id: I3b6d13765bdf3add9a8208de6f0e98018e40cc42 Reviewed-by: Friedemann Kleint <[email protected]>
* Replace "no devices registered" warnings with qCDebugShawn Rutledge2020-06-221-3/+6
| | | | | | | | | | The idea was to keep nagging us to update all the platform plugins to do device registration. But besides being annoying, it would cause test failures if we start adding QTest::ignoreMessage() all over, and then some platforms start doing device registration properly. Change-Id: Ia0fbb64cf86f33532be032ec9eebe6e4ad607f20 Reviewed-by: Laszlo Agocs <[email protected]>
* Make QInputDevice::devices() return a QListShawn Rutledge2020-06-171-5/+5
| | | | | | | | | | | There was a decision to use QList consistently in public API, now that it's supposed to perform as well as QVector. Amends 6589f2ed0cf78c9b8a5bdffcdc458dc40a974c60 Task-number: QTBUG-46412 Task-number: QTBUG-72167 Change-Id: I30004792667ee0581a433409ac2e20ffc645e952 Reviewed-by: Friedemann Kleint <[email protected]>
* Introduce QInputDevice hierarchy; replace QTouchDeviceShawn Rutledge2020-06-161-0/+293
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 <[email protected]>