From b5cbd77073f15b272e8091bf2c57e10cc25ecda0 Mon Sep 17 00:00:00 2001 From: lizzie Date: Thu, 2 Oct 2025 18:27:58 +0000 Subject: [PATCH 1/2] [android] allow use of mouse and keyboard on motion events Signed-off-by: lizzie --- .../org/yuzu/yuzu_emu/activities/EmulationActivity.kt | 8 ++++++-- .../yuzu_emu/features/settings/ui/InputDialogFragment.kt | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt index da40453497..ba60aeace2 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt @@ -230,7 +230,9 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { override fun dispatchKeyEvent(event: KeyEvent): Boolean { if (event.source and InputDevice.SOURCE_JOYSTICK != InputDevice.SOURCE_JOYSTICK && - event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD + event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD && + event.source and InputDevice.SOURCE_KEYBOARD != InputDevice.SOURCE_KEYBOARD && + event.source and InputDevice.SOURCE_MOUSE != InputDevice.SOURCE_MOUSE ) { return super.dispatchKeyEvent(event) } @@ -244,7 +246,9 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { override fun dispatchGenericMotionEvent(event: MotionEvent): Boolean { if (event.source and InputDevice.SOURCE_JOYSTICK != InputDevice.SOURCE_JOYSTICK && - event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD + event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD && + event.source and InputDevice.SOURCE_KEYBOARD != InputDevice.SOURCE_KEYBOARD && + event.source and InputDevice.SOURCE_MOUSE != InputDevice.SOURCE_MOUSE ) { return super.dispatchGenericMotionEvent(event) } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt index 16a1d05044..bc54fddc09 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt @@ -149,7 +149,9 @@ class InputDialogFragment : DialogFragment() { private fun onKeyEvent(event: KeyEvent): Boolean { if (event.source and InputDevice.SOURCE_JOYSTICK != InputDevice.SOURCE_JOYSTICK && - event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD + event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD && + event.source and InputDevice.SOURCE_KEYBOARD != InputDevice.SOURCE_KEYBOARD && + event.source and InputDevice.SOURCE_MOUSE != InputDevice.SOURCE_MOUSE ) { return false } @@ -173,7 +175,9 @@ class InputDialogFragment : DialogFragment() { private fun onMotionEvent(event: MotionEvent): Boolean { if (event.source and InputDevice.SOURCE_JOYSTICK != InputDevice.SOURCE_JOYSTICK && - event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD + event.source and InputDevice.SOURCE_GAMEPAD != InputDevice.SOURCE_GAMEPAD && + event.source and InputDevice.SOURCE_KEYBOARD != InputDevice.SOURCE_KEYBOARD && + event.source and InputDevice.SOURCE_MOUSE != InputDevice.SOURCE_MOUSE ) { return false } From e7eea75f8873cd335e1013cd53f3380d460fd3c1 Mon Sep 17 00:00:00 2001 From: lizzie Date: Thu, 2 Oct 2025 21:22:19 +0000 Subject: [PATCH 2/2] fix license Signed-off-by: lizzie --- .../yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt index bc54fddc09..d07a6e6aea 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/InputDialogFragment.kt @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later