소스 검색

android: Fix inline keyboard input

german77 3 년 전
부모
커밋
265b9139e0
1개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  1. 7 5
      src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt

+ 7 - 5
src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt

@@ -147,17 +147,19 @@ open class EmulationActivity : AppCompatActivity(), SensorEventListener {
     }
 
     override fun dispatchKeyEvent(event: KeyEvent): Boolean {
-        // Handling the case where the back button is pressed.
-        if (event.keyCode == KeyEvent.KEYCODE_BACK) {
-            onBackPressedDispatcher.onBackPressed()
-            return true
+        if (event.source and InputDevice.SOURCE_JOYSTICK != InputDevice.SOURCE_JOYSTICK &&
+            event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD
+        ) {
+            return super.dispatchKeyEvent(event)
         }
 
         return inputHandler.dispatchKeyEvent(event)
     }
 
     override fun dispatchGenericMotionEvent(event: MotionEvent): Boolean {
-        if (event.source and InputDevice.SOURCE_CLASS_JOYSTICK === 0) {
+        if (event.source and InputDevice.SOURCE_JOYSTICK != InputDevice.SOURCE_JOYSTICK &&
+            event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD
+        ) {
             return super.dispatchGenericMotionEvent(event)
         }