|
@@ -1495,9 +1495,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
|
public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputConnection ic) {
|
|
public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputConnection ic) {
|
|
|
int deviceId = event.getDeviceId();
|
|
int deviceId = event.getDeviceId();
|
|
|
int source = event.getSource();
|
|
int source = event.getSource();
|
|
|
|
|
+ InputDevice device = InputDevice.getDevice(deviceId);
|
|
|
|
|
|
|
|
if (source == InputDevice.SOURCE_UNKNOWN) {
|
|
if (source == InputDevice.SOURCE_UNKNOWN) {
|
|
|
- InputDevice device = InputDevice.getDevice(deviceId);
|
|
|
|
|
if (device != null) {
|
|
if (device != null) {
|
|
|
source = device.getSources();
|
|
source = device.getSources();
|
|
|
}
|
|
}
|
|
@@ -1516,7 +1516,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
|
// Furthermore, it's possible a game controller has SOURCE_KEYBOARD and
|
|
// Furthermore, it's possible a game controller has SOURCE_KEYBOARD and
|
|
|
// SOURCE_JOYSTICK, while its key events arrive from the keyboard source
|
|
// SOURCE_JOYSTICK, while its key events arrive from the keyboard source
|
|
|
// So, retrieve the device itself and check all of its sources
|
|
// So, retrieve the device itself and check all of its sources
|
|
|
- if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) {
|
|
|
|
|
|
|
+ if (SDLControllerManager.isDeviceSDLJoystick(device)) {
|
|
|
// Note that we process events with specific key codes here
|
|
// Note that we process events with specific key codes here
|
|
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
|
if (SDLControllerManager.onNativePadDown(deviceId, keyCode, event.getScanCode())) {
|
|
if (SDLControllerManager.onNativePadDown(deviceId, keyCode, event.getScanCode())) {
|