···13271327 // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and
13281328 // SOURCE_JOYSTICK, while its key events arrive from the keyboard source
13291329 // So, retrieve the device itself and check all of its sources
13301330- if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) {
13311331- // Note that we process events with specific key codes here
13321332- if (event.getAction() == KeyEvent.ACTION_DOWN) {
13331333- if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) {
13341334- return true;
13351335- }
13361336- } else if (event.getAction() == KeyEvent.ACTION_UP) {
13371337- if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) {
13381338- return true;
13391339- }
13401340- }
13411341- }
13421342-13431330 if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
13441331 if (event.getAction() == KeyEvent.ACTION_DOWN) {
13451332 if (isTextInputEvent(event)) {
···13561343 return true;
13571344 }
13581345 }
13591359-13461346+ if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) {
13471347+ // Note that we process events with specific key codes here
13481348+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
13491349+ if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) {
13501350+ return true;
13511351+ }
13521352+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
13531353+ if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) {
13541354+ return true;
13551355+ }
13561356+ }
13571357+ }
13601358 if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) {
13611359 // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses
13621360 // they are ignored here because sending them as mouse input to SDL is messy