Skip to content

Commit

Permalink
Android: trigger keyboard events of Android game keys with or without…
Browse files Browse the repository at this point in the history
… an active joystick. Fixes liballeg#1479
  • Loading branch information
alemart committed Oct 3, 2023
1 parent 0be7a02 commit 7347961
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,17 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
if (index >= 0) {
code = getCode(keyCode, event, index);
}
if (code == -1) {
return onKeyboardKey(v, keyCode, event);
}
else if (code == -2) {
return true;
}
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (event.getRepeatCount() == 0) {
nativeOnJoystickButton(index, code, true);
if (code >= 0) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (event.getRepeatCount() == 0) {
nativeOnJoystickButton(index, code, true);
}
}
else {
nativeOnJoystickButton(index, code, false);
}
}
else {
nativeOnJoystickButton(index, code, false);
}
return true;
return onKeyboardKey(v, keyCode, event);
}

private void volumeChange(int inc)
Expand Down

0 comments on commit 7347961

Please sign in to comment.