Commit Graph

59 Commits

Author SHA1 Message Date
Johan Solbakken 39bbb8049f Expand scope of QtGamepad to QtUniversalInput
This patch transforms the QtGamepad module from Qt 5 into a new
module that expands the scope to include all forms of exotic input.

The majority of the previous QtGamepad functionality and APIs are
preserved, but now there is also a more general API for getting
the state of input devices like joysticks, flight yokes, and
any other devices that define themselves in terms of buttons and
axes.

In addition to being able to receive input, it is also now possible
to output feedback in devices that support it.

Experimental input mapping functionality has been added to facilitate
mapping an arbitrary input to a predefined action.

Change-Id: Ic35b73282944cfd4eea9defbcf82c4abc55d7237
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2024-06-09 19:22:21 +02:00
Allan Sandfeld Jensen 69b95376a1 Update dependencies
Change-Id: I855e722f8be4c43b1243860d272c26d20647ef5b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-18 14:57:49 +01:00
Assam Boudjelthia 54e48f16bb Android: rename Android's package name for Qt 6
Rename Android package name org.qtproject.qt5.android to
org.qtproject.qt.android to avoid inconsistency with Qt 6 name.
Also, we include the major version number in the jar target.

Task-number: QTBUG-86969
Change-Id: If2c7e014ed52dd97e86c5a179dfbcbcce915ee83
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-10-05 09:51:51 +03:00
Lars Schmertmann 5d9b4f172f Add ; to Q_UNUSED
This is required to remove the ; from the macro with Qt 6.

Task-number: QTBUG-82978
Change-Id: I70a100dc04d1178af4b60e42bb69b123a95164d6
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2020-06-30 09:49:39 +02:00
Jarek Kobus 8213bc7dcf Use QList instead of QVector
Task-number: QTBUG-84469
Change-Id: Ib8ba9561a5fd34c86df534e4383e2c65e80e6a55
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-06-25 07:55:25 +02:00
Alexander Volkov 4944c0e8bf Add missing override
Change-Id: I785bbebea724b71ae44f67f833644f1117982827
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-05-26 14:07:04 +03:00
Sona Kurazyan 0a08df18e0 Remove usages of deprecated QLatin1Literal
Task-number: QTBUG-76491
Change-Id: I541179bcf59886ab0759d566e203decdf0ed2ce0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-06-25 09:50:06 +02:00
Tony Sarajärvi 45feea99ef Define BTN_TRIGGER_HAPPY definitions when they are missing from kernel
With some old kernel versions (i.e. 2.6.32) used by RHEL 6.10 for
example, these definitions are simply missing. They reappear in later
distros. If they are missing from the distro, let's define them
our selves.

Task-number: QTBUG-74219
Change-Id: Id2a1e24097fc6710b28288d6144b761790156251
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-03-08 15:44:01 +00:00
Oliver Wolff c683f8feb6 Remove wince check as it is not supported
Change-Id: Ie91a95808c3e4319815bc3e760c3450bd69665cd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-11-22 07:17:49 +00:00
Liang Qi ac1910ab4b Clean up our Objective-C usage
Following ba871065e0f40e9197fa4ee0ffe76530bb6fca11 in qtbase.

- Move ivars into @implementation
- Use instancetype where applicable

Change-Id: I33be9b380e3bea6bd54be1d0bfd7e3e7072fc82a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-08 12:28:15 +00:00
Jake Petroules dd85775b20 Remove obsolete code paths
Change-Id: Ib8c26b7697d03f24b4efe18f2e8a4a2573e1bd3b
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2018-02-12 21:20:06 +00:00
Liang Qi 4ca89439b3 Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: Id3a493d6e7366b9c17d4af94b42d7b6f10973835
2017-11-20 13:17:05 +01:00
Andrea Odetti 5f5cebfa1b SDL Controllers: report the Joystick name
The controller name is a generic "XInput Controller",
while the joystick is more meaningful (e.g.)
"Microsoft X-Box 360 pad", the same as evdev.

Change-Id: If93acdadb20f0601cc08069efed4718b4320d3a3
Reviewed-by: Andy Maloney <asmaloney@gmail.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-10-16 19:37:20 +00:00
Andy Maloney 6f53e8b7d9 Fix header include guards to reflect the actual file names
Change-Id: I125a5e3f77649e6c9e8f18ebcfaa23599dc79b84
Reviewed-by: Andrea Odetti <mariofutire@gmail.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-10-09 08:49:18 +00:00
Andrea Odetti 0cea22b644 Propagate the gamepad name from the backend to QGamepad
Added signals and slots to forward the name to QGamepad.
Previously the property name and signal nameChanged in QGamepad
were never used.

Now the plumbing is done and the 2 linux backends (evdev and SDL2)
forward the name.

Change-Id: I97261769524ddb23a31789e362e6de7bb30694f3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-10-06 18:23:20 +00:00
Kevin Funk e673d453e7 Replace Q_NULLPTR with nullptr
Change-Id: I91a5ea5ace5fb8116ce6d369b9c3c5fb5bdaae83
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-26 17:14:23 +00:00
Jake Petroules 614a535f42 Android: remove support for local/debug deployment
This removes the pre-dexed JAR files activated by the absence of the
bundled_jar_file CONFIG option, as versions of Android >= 5 no longer
support this deployment mechanism.

Now, the "bundled" JARs simply become normal JARs containing class
files, and are neither activated by a bundled_jar_file CONFIG entry nor
do they have a -bundled suffix in the file's base name.

Task-number: QTBUG-62995
Change-Id: I940eaf71a55c589b740489660f49ef30feb79cab
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-09-06 18:22:00 +00:00
BogDan Vatra 1fc40deed6 Android: Fix compile with clang and unified headers
Change-Id: I73c57348329628f2f7b1923332a9831ed0b64363
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2017-08-17 10:03:44 +00:00
Thiago Macieira 431641fb66 Disable senseless GCC 7 warning about maybe-uninitialized fields
The GCC 7 output makes no sense because it doesn't explain where the
problem was. It only lists what fields were maybe uninitialized.

 In file included from qevdevgamepadbackend.cpp:37:0:
qevdevgamepadbackend_p.h: In member function ‘T& QHash<K, V>::operator[](const Key&) [with Key = int; T = QEvdevGamepadDevice::EvdevAxisInfo]’:
 qevdevgamepadbackend_p.h:82:12: error: ‘<anonymous>.QEvdevGamepadDevice::EvdevAxisInfo::flat’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     struct EvdevAxisInfo : public QGamepadBackend::AxisInfo<int>
            ^~~~~~~~~~~~~
 qevdevgamepadbackend_p.h:82:12: error: ‘<anonymous>.QEvdevGamepadDevice::EvdevAxisInfo::gamepadMinButton’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 qevdevgamepadbackend_p.h:82:12: error: ‘<anonymous>.QEvdevGamepadDevice::EvdevAxisInfo::gamepadMaxButton’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 qevdevgamepadbackend_p.h:82:12: error: ‘<anonymous>.QEvdevGamepadDevice::EvdevAxisInfo::gamepadLastButton’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Change-Id: Ia3e896da908f42939148fffd14c4b1ac4a7f6943
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-30 06:04:57 +00:00
Andy Nichols fcffc32b64 Fix SDL plugin building on PPC64le
SDL.h redefines bool, which breaks the build.

Task-number: QTBUG-60679
Change-Id: I1ae833b26e867c0127000d8b09eb53fe8cdac0b8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-23 09:35:35 +00:00
Otto Ryynänen 015add9d08 Support for Q_OS_ANDROID_EMBEDDED and android-embedded builds
The Embedded Android build (Boot to Qt Android injection) is defined by
having both Q_OS_ANDROID and Q_OS_ANDROID_EMBEDDED flags defined,
as well as having Qt config android-embedded.
This commit enables the possibility to build embedded Android builds.
(i.e. Qt build for Android baselayer only, without JNI)

Change-Id: I27602edbe6895215a640a25bc1427732d9a8d550
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-04-24 11:50:59 +00:00
Liang Qi 951b5fb5e3 Merge remote-tracking branch 'origin/5.8' into 5.9
Change-Id: Ic7edff3a9f06ae205a5944e423d9ecbbfa321896
2017-03-10 10:27:08 +01:00
Andy Nichols 38c99df556 General Module Cleanups
Removed reference to bsquask
nullptr instead of 0
explicit override keyword for virtuals
Q_SLOTS and Q_SIGNALS instead of keywords

Change-Id: I7dd96fa66003c52fe2d26decca73224b70896baa
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-01-31 10:49:42 +00:00
Roland Winklmeier 72be0422f9 Fix -Wsign-compare warning
Change-Id: I936c06df1c75f03c57b4f34b67c76ca50db64ee0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-01-26 12:32:34 +00:00
BogDan Vatra 13bbe6ea37 Android: add override to fix warnings
Change-Id: Iab3c25d019f707b90d6cd36028c3192f47293976
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-11-29 12:16:47 +00:00
Lars Knoll 56b101c01c Convert the module to the new configuration system
... and clean up the SDL detection. This also enables SDL use on
non-macOS Darwin platforms, per the library's documentation.

Change-Id: I4111fc8cb75b30662fe93b90e76a0c5563140656
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-31 10:54:34 +00:00
Oswald Buddenhagen 095d854f18 use modularized platformsupport modules
Change-Id: Ia86969ea365700629a1ccc04f94d3cafc756645b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-10-21 09:26:57 +00:00
Marc Mutz 5a149c75d7 Eradicate Q_FOREACH loops and mark the module as Q_FOREACH-free and warning_clean
Change-Id: I67813e8d2d27d39d772099b2d9d77bbe9bfa476e
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2016-09-22 11:10:38 +00:00
Liang Qi e10ce3bfa5 Fix compilation after feature modularization in qtbase
Change-Id: Iffe6d9ba611aa6a4a3e48e7206bbdf4b96465fc1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-09-20 07:04:15 +00:00
Lars Knoll f4bd1e2687 Adjust to qtConfig() changes in qtbase
Change-Id: I1020ca26211e151c3a8e3bf766caa5ae90a01f83
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 13:49:25 +00:00
Jake Petroules 7e6f9516c3 Disable darwin plugin on watchOS
The dependent frameworks are not available on that platform.

Change-Id: I17a48c7e3136b647a3ec7f258e6979ee5dd8c9b7
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-08-18 09:23:09 +00:00
Liang Qi 914f113067 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	.qmake.conf

Change-Id: I3d0c6ed292b1f3aa7c24d0c39a4ecfdd8f380d6c
2016-08-02 10:20:50 +02:00
BogDan Vatra f9be94cb60 Make sure JNI_OnLoad is not called more than once
Since Android 5.0 Google introduce a nasty bug[1] which calls
JNI_OnLoad more than once.
Basically every time when a library is loaded JNI_OnLoad is
called if found, but it calls *again* JNI_OnLoad of its .so
dependencies!

[1] Workaround https://code.google.com/p/android/issues/detail?id=215069

Change-Id: Id04f7e55ee93ec5adef791809eca481fdfdbab4e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-07-20 13:04:20 +00:00
Andy Nichols 3e83ebbc26 Darwin: Fix when building in namespace
Change-Id: I9b58ce00f24c76a2353c2818143d28f6bbe50cd9
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-05-31 12:55:51 +00:00
Mike Krus c64fa3b36b Added support to tvOS remote (microGamepad)
Play/Pause buttons is X
Menu button is play/pause (don’t ask)
Press touch area is A
Touch area is left thumbstick

Change-Id: Idd51e8e4e8f20397475df801af42b82865f4c328
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-05-31 12:55:48 +00:00
Mike Krus ecd0a55a0b Rename iOS backend to darwin as it applies to iOS, OS X and tvOS
Change-Id: Ie58d8aeb862d632e48611d23ff2cec7f0b9ce36c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-05-31 12:55:46 +00:00
Mike Krus 4e8538d5a4 Fix iOS < 9.0 and OSX < 10.11 builds
GCControllerPlayerIndex type was introduced in iOS 9 and OSX 10.11
respectively. Previously was just an int.

Was breaking CI builds which uses 10.10 (despite policy of using
latest OSX for builds).

Change-Id: Ic876daddd261fb4719f604c51d19ab9dcb790fa1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-05-31 12:55:43 +00:00
BogDan Vatra 742cb1e356 Fix compile
use qAbs instead of fabs

Change-Id: Ic0426fd105c45dd09aad31bea74012fa4f5d6699
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-05-06 08:22:19 +00:00
Andy Nichols 57b578485a Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I091e2a9c4f5c65affd4b5b32c1c3e38b7c9076d9
2016-03-17 15:46:51 +01:00
Marc Mutz bb53183d40 QEvdevGamepadDevice: use std::abs() instead of fabs()
Both includes were missing, so GCC complained that fabs() was not
declared.

Fix by including <cmath> and using std::abs() instead.

Change-Id: Ifc717bd68d3572e114937712c867c3d004c1fa2e
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2016-03-08 08:42:35 +00:00
BogDan Vatra 10eafcb750 Android: Android gamepads doesn't really need configuration.
The default values seems to be enough for all Android gamepads

Change-Id: I6e3d3b046cf4d0753cddbdfb8d5d6360366a9aa8
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-16 10:13:11 +00:00
BogDan Vatra 3191140c95 Android: resetConfiguration for good
There is no need to use any default values.

Change-Id: Ib2b37f4198761ba06719585cb9bf114e15a4d082
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-16 10:13:08 +00:00
BogDan Vatra 1324983f52 Android: productId doesn't seem to be a persistent ID.
getDescriptor is guarantee to be unique no matter what.

Change-Id: I8db9745066547a3a210b0a305a6ee28ea0292825
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-16 10:13:05 +00:00
BogDan Vatra 541a2f88df Android: Fix default L2&R2 configuration.
Change-Id: Ie74342fa2ddca8ec87695e9a23210bafe4617b64
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-16 10:13:00 +00:00
BogDan Vatra 13774ef209 Android: Don't add SOURCE_DPAD on Android API-12+
SOURCE_DPAD is used by non-gamepad devices (e.g. remote controls) to
send key events. We don't need to add them to our gampad list if the
O.S. knows gamepads.

Change-Id: I36ac1187f6d18e279e0b1cc431a7a55448ce61de
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-15 07:30:31 +00:00
BogDan Vatra 71e5741660 Android: Fix Button[L2|R2] configuration
These kind of buttons act as axis and we must handle them properly.

Change-Id: Ifde9c1f8c03ab80c4fb899327ea803bb2f388a03
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-15 07:30:27 +00:00
Laszlo Agocs bf5b4dee85 Fix iOS build errors
Change-Id: I2670e027e491d7ed67f04906c095f2b90b1e9125
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-01 15:06:51 +00:00
Laszlo Agocs c1ce4d1ea4 Fix license headers in the Android backend
Change-Id: I8f2252e83ad3ec921eff59fbfe86bd0bf74616db
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-01 15:06:37 +00:00
BogDan Vatra dcf69f67ed EVDEV: Button[L2|R2] Act as an axis
Change-Id: I33e90ece7a7563b9136cd40c8c730fcfc6bfa340
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-01 08:15:02 +00:00
BogDan Vatra fc439bd7d3 EVDEV: Don't send negative values
Change-Id: I7e8925d7488347217f83dd7de340912bb8bb113a
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
2016-02-01 08:12:09 +00:00