Fix right-stick scroll focus and compatibility handling

This commit is contained in:
LunaDL committed 2026-11-28 22:26:44 -04:00
1 parent 53bd564298
commit 9e98ed45dd
1 file changed
+10 -8
@@ -2111,7 +2111,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (!hasFocus) triggerKeys.cancel()
if (!hasFocus) {
triggerKeys.cancel()
stopRightStickScroll()
}
if (hasFocus) {
com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false)
applyLauncherFullscreen()
@@ -2216,7 +2219,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private val rightStickScrollTick = object : Runnable {
override fun run() {
val deviceId = rightStickScrollDeviceId
if (!hasWindowFocus() || deviceId == android.view.InputDevice.INVALID_DEVICE_ID ||
if (!hasWindowFocus() || (compatLaunch != null && !compatLaunch!!.loading.ended) ||
deviceId == android.view.InputDevice.INVALID_DEVICE_ID ||
android.view.InputDevice.getDevice(deviceId) == null ||
kotlin.math.abs(rightStickScrollDeflection) < 0.55f) {
stopRightStickScroll()
@@ -2285,17 +2289,15 @@ 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
com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) {
stopRightStickScroll()
return true
}
triggerKeys.onMotion(event)
if (scrollPageWithRightStick(event)) return true
return super.dispatchGenericMotionEvent(event)
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (!hasFocus) stopRightStickScroll()
}
override fun onPause() {
stopRightStickScroll()
compatLaunchVisible = false