diff options
author | lawnjelly <lawnjelly@gmail.com> | 2019-06-21 10:54:33 +0100 |
---|---|---|
committer | lawnjelly <lawnjelly@gmail.com> | 2019-06-21 12:57:33 +0100 |
commit | 512f8ebb937e3b32a2f429763982d4328ad0ca50 (patch) | |
tree | 9ef770eeae575ff64c2ae4a9f6323e9beac383ee /scene | |
parent | 1e833cadbcf1403eec85fa85b290328bc1bf5179 (diff) |
Fix some keyboards not working with Android
Fixes #17004
Currently the keydown and keyup messages are handled with method like this:
if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK
|| (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD
|| (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
// joystick input
}
else
{
// keyboard input
}
The constant for SOURCE_DPAD is 513
10 0000 0001
and the constant for SOURCE_KEYBOARD is 257
1 0000 0001
However, rather confusingly, for many keyboards the source sent by android is 769
11 0000 0001
Thus the keyboard is passing the check as being a DPAD and being processed as a joystick rather than keyboard. This PR handles the specific case of 769, allowing input from physical keyboards.
Diffstat (limited to 'scene')
0 files changed, 0 insertions, 0 deletions