Merge remote-tracking branch 'origin/master' into new-core

This commit is contained in:
Cameron Gutman
2017-05-15 23:23:45 -07:00
2 changed files with 23 additions and 4 deletions

View File

@@ -561,8 +561,13 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
boolean handled = false;
if (event.getDevice() == null ||
event.getDevice().getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
boolean detectedGamepad = event.getDevice() == null ? false :
((event.getDevice().getSources() & InputDevice.SOURCE_JOYSTICK) != 0 ||
(event.getDevice().getSources() & InputDevice.SOURCE_GAMEPAD) != 0);
if (detectedGamepad || (event.getDevice() == null ||
event.getDevice().getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC
)) {
// Always try the controller handler first, unless it's an alphanumeric keyboard device.
// Otherwise, controller handler will eat keyboard d-pad events.
handled = controllerHandler.handleButtonDown(event);
@@ -599,8 +604,12 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
boolean handled = false;
if (event.getDevice() == null ||
event.getDevice().getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
boolean detectedGamepad = event.getDevice() == null ? false :
((event.getDevice().getSources() & InputDevice.SOURCE_JOYSTICK) != 0 ||
(event.getDevice().getSources() & InputDevice.SOURCE_GAMEPAD) != 0);
if (detectedGamepad || (event.getDevice() == null ||
event.getDevice().getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC
)) {
// Always try the controller handler first, unless it's an alphanumeric keyboard device.
// Otherwise, controller handler will eat keyboard d-pad events.
handled = controllerHandler.handleButtonUp(event);