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>
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>
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>
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>
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>
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>
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>
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>
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>
SDL.h redefines bool, which breaks the build.
Task-number: QTBUG-60679
Change-Id: I1ae833b26e867c0127000d8b09eb53fe8cdac0b8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
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>
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>
... 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>
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>
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>
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>
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>
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>
The default values seems to be enough for all Android gamepads
Change-Id: I6e3d3b046cf4d0753cddbdfb8d5d6360366a9aa8
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
There is no need to use any default values.
Change-Id: Ib2b37f4198761ba06719585cb9bf114e15a4d082
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
getDescriptor is guarantee to be unique no matter what.
Change-Id: I8db9745066547a3a210b0a305a6ee28ea0292825
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
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>
These kind of buttons act as axis and we must handle them properly.
Change-Id: Ifde9c1f8c03ab80c4fb899327ea803bb2f388a03
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>