Fix right-stick scroll routing and trigger event order

This commit is contained in:
LunaDL committed 2026-11-28 18:18:44 -04:00
1 parent 7761d0aba7
commit 378c4dc84a
1 file changed
+6 -3
@@ -2216,6 +2216,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
!com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return false
val device = event.device ?: return false
val rxRy = com.droiddeck.launcher.input.PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts)
?: return false
val axis = if (rxRy) android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ
val value = event.getAxisValue(axis)
if (kotlin.math.abs(value) < 0.55f) return false
@@ -2227,9 +2228,11 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
id = 0
toolType = android.view.MotionEvent.TOOL_TYPE_MOUSE
}
val root = window.decorView
if (root.width <= 0 || root.height <= 0) return true
val coordinates = android.view.MotionEvent.PointerCoords().apply {
x = 1f
y = 1f
x = root.width * 0.65f
y = root.height * 0.5f
setAxisValue(android.view.MotionEvent.AXIS_VSCROLL, -value * 3f)
}
val scroll = android.view.MotionEvent.obtain(
@@ -2248,8 +2251,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
override fun dispatchGenericMotionEvent(event: android.view.MotionEvent): Boolean {
if (compatLaunch != null && !compatLaunch!!.loading.ended &&
com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return true
if (scrollPageWithRightStick(event)) return true
triggerKeys.onMotion(event)
if (scrollPageWithRightStick(event)) return true
return super.dispatchGenericMotionEvent(event)
}