refactor(input): name the scene input types and wheel scale (#2524)

nativeSendSceneInput took bare integers (3, 4, 6, 11, 12) and the
wheel step (120) and pointer fixed-point scale (256) were repeated
inline. BottomDesktopPanel kept its own private copies of three of
them. Move them to WaylandCompositor next to the native method and
use them at every call site. No behavior change.

Co-authored-by: Dennis Zabolotny <15849186+zdennisz@users.noreply.github.com>
This commit is contained in:
Dennis ZabolotnyandDennis Zabolotny authored and GitHub committed 2026-11-15 09:35:40 -05:00
1 parent 76aa3771b7
commit e3d86c4b17
4 files changed
+21 -20

No files matched your search

@@ -3703,7 +3703,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (h == 0 && v == 0) return
scrollRestX -= h
scrollRestY -= v
WaylandCompositor.nativeSendSceneInput(11, ScrollTouchGestures.wheelUnits(v, out.second), ScrollTouchGestures.wheelUnits(h, out.first))
WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_AXIS, ScrollTouchGestures.wheelUnits(v, out.second), ScrollTouchGestures.wheelUnits(h, out.first))
}
override fun onLongPress() = pointerListener.onLongPress()
}
@@ -3758,13 +3758,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (h == 0 && v == 0) return
scrollRestX -= h
scrollRestY -= v
WaylandCompositor.nativeSendSceneInput(12, v, h)
WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_AXIS_FINGER, v, h)
}
private fun fingerScrollEnd() {
scrollRestX = 0f
scrollRestY = 0f
WaylandCompositor.nativeSendSceneInput(12, 0, 0)
WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_AXIS_FINGER, 0, 0)
}
private fun placeTouchpadAtGuest(rect: android.graphics.RectF) {
@@ -4518,14 +4518,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
else guestButtonsDown.remove(code) ?: evdevMouseActive
val writer = if (raw) mouseWriter else null
if (writer != null) writer.writeMouseButton(code.toShort(), down)
else WaylandCompositor.nativeSendSceneInput(3, code, if (down) 1 else 0)
else WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_BUTTON, code, if (down) 1 else 0)
}
private fun sendSceneWheel(steps: Int, horizontal: Boolean = false): Unit = synchronized(heldButtons) {
val writer = if (evdevMouseActive) mouseWriter else null
if (writer != null) writer.writeMouseWheel(if (horizontal) 0 else -steps, if (horizontal) steps else 0, 120)
else if (horizontal) WaylandCompositor.nativeSendSceneInput(11, 0, steps * 120)
else WaylandCompositor.nativeSendSceneInput(4, steps, 0)
if (writer != null) writer.writeMouseWheel(if (horizontal) 0 else -steps, if (horizontal) steps else 0, WaylandCompositor.WHEEL_STEP_UNITS)
else if (horizontal) WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_AXIS, 0, steps * WaylandCompositor.WHEEL_STEP_UNITS)
else WaylandCompositor.nativeSendSceneInput(WaylandCompositor.SCENE_WHEEL, steps, 0)
}
private fun sendMouseDelta(x: Float, y: Float) {