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

@@ -327,6 +327,9 @@ public final class WaylandCompositor {
public static native void nativeSendSceneInput(int type, int a, int b);
public static final int SCENE_BUTTON = 3, SCENE_WHEEL = 4, SCENE_POINTER_DELTA = 6, SCENE_AXIS = 11, SCENE_AXIS_FINGER = 12;
public static final int WHEEL_STEP_UNITS = 120, POINTER_DELTA_SCALE = 256;
public static final int FG_ENGINE_LSFG = 0, FG_ENGINE_DDFG = 1;
public static native void nativeSetFrameGenEngine(int kind);
@@ -355,19 +358,19 @@ public final class WaylandCompositor {
public static void sendPointerDelta(int dx, int dy) {
if (dx == 0 && dy == 0) return;
nativeSendSceneInput(6, dx * 256, dy * 256);
nativeSendSceneInput(SCENE_POINTER_DELTA, dx * POINTER_DELTA_SCALE, dy * POINTER_DELTA_SCALE);
}
private static float pendingDeltaX, pendingDeltaY;
public static void sendPointerDelta(float dx, float dy) {
pendingDeltaX += dx * 256f;
pendingDeltaY += dy * 256f;
pendingDeltaX += dx * POINTER_DELTA_SCALE;
pendingDeltaY += dy * POINTER_DELTA_SCALE;
int x = (int) Math.floor(pendingDeltaX);
int y = (int) Math.floor(pendingDeltaY);
if (x == 0 && y == 0) return;
pendingDeltaX -= x;
pendingDeltaY -= y;
nativeSendSceneInput(6, x, y);
nativeSendSceneInput(SCENE_POINTER_DELTA, x, y);
}
}