diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index baf87eccfc..597a9cff7c 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -4917,7 +4917,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde return true } if (event.actionMasked == MotionEvent.ACTION_DOWN) { - if (!pointerLocked) showCursor(event.x.coerceIn(rect.left, rect.right), event.y.coerceIn(rect.top, rect.bottom)) + if (!pointerLocked) { + val x = event.x.coerceIn(rect.left, rect.right) + val y = event.y.coerceIn(rect.top, rect.bottom) + if (directTouchHold.tapClicks) showCursor(x, y) else movePointer(x, y) + } if (WaylandCompositor.nativeFocusTakesTouch()) { listOf(PointerGestures.BTN_LEFT, PointerGestures.BTN_RIGHT, PointerGestures.BTN_MIDDLE).forEach { heldButtons.set(1, it, false) diff --git a/app/src/test/java/com/droiddeck/launcher/input/SessionGestureRoutingTest.kt b/app/src/test/java/com/droiddeck/launcher/input/SessionGestureRoutingTest.kt index 9e55093883..aff2e33f10 100644 --- a/app/src/test/java/com/droiddeck/launcher/input/SessionGestureRoutingTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/input/SessionGestureRoutingTest.kt @@ -303,10 +303,14 @@ class SessionGestureRoutingTest { shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(200)) return directTouches.size } + CompositorShadow.pointerMoves.clear() assertEquals(1, tapWith(InputProfile.defaults(InputProfile.DESKTOP))) + assertTrue(CompositorShadow.pointerMoves.isEmpty()) assertEquals(0, tapWith(InputProfile.defaults(InputProfile.DESKTOP) .withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274)))) + assertEquals(1, CompositorShadow.pointerMoves.size) assertEquals(1, tapWith(InputProfile.defaults(InputProfile.DESKTOP))) + assertEquals(1, CompositorShadow.pointerMoves.size) } private fun tapThreeFingers(expectSteamGesture: Boolean) { @@ -337,7 +341,9 @@ class SessionGestureRoutingTest { class CompositorShadow { companion object { @JvmStatic var sceneInputs = 0 + @JvmStatic val pointerMoves = mutableListOf>() @JvmStatic @Implementation fun __staticInitializer__() {} + @JvmStatic @Implementation fun nativeSendPointer(action: Int, x: Int, y: Int) { pointerMoves += x to y } @JvmStatic @Implementation fun nativeSendTouch(action: Int, id: Int, x: Int, y: Int) {} @JvmStatic @Implementation fun nativeSendSceneInput(type: Int, code: Int, value: Int) { sceneInputs++ } }