Fix excessive high-res scroll speed on newer GFE versions

This commit is contained in:
Cameron Gutman 2021-12-14 22:02:12 -06:00
parent ec222413dd
commit 4a60ec1755
3 changed files with 5 additions and 13 deletions

View File

@ -23,13 +23,12 @@ public class AbsoluteTouchContext implements TouchContext {
private boolean confirmedTap;
private Timer longPressTimer;
private Timer tapDownTimer;
private float accumulatedScrollDelta;
private final NvConnection conn;
private final int actionIndex;
private final View targetView;
private static final int SCROLL_SPEED_DIVISOR = 20;
private static final int SCROLL_SPEED_FACTOR = 3;
private static final int LONG_PRESS_TIME_THRESHOLD = 650;
private static final int LONG_PRESS_DISTANCE_THRESHOLD = 30;
@ -65,7 +64,6 @@ public class AbsoluteTouchContext implements TouchContext {
lastTouchLocationY = lastTouchDownY = eventY;
lastTouchDownTime = SystemClock.uptimeMillis();
cancelled = confirmedTap = confirmedLongPress = false;
accumulatedScrollDelta = 0;
if (actionIndex == 0) {
// Start the timers
@ -228,11 +226,7 @@ public class AbsoluteTouchContext implements TouchContext {
}
}
else if (actionIndex == 1) {
accumulatedScrollDelta += (eventY - lastTouchLocationY) / (float)SCROLL_SPEED_DIVISOR;
if ((short)accumulatedScrollDelta != 0) {
conn.sendMouseHighResScroll((short)accumulatedScrollDelta);
accumulatedScrollDelta -= (short)accumulatedScrollDelta;
}
conn.sendMouseHighResScroll((short)((eventY - lastTouchLocationY) * SCROLL_SPEED_FACTOR));
}
lastTouchLocationX = eventX;

View File

@ -36,7 +36,7 @@ public class RelativeTouchContext implements TouchContext {
private static final int TAP_TIME_THRESHOLD = 250;
private static final int DRAG_TIME_THRESHOLD = 650;
private static final int SCROLL_SPEED_DIVISOR = 20;
private static final int SCROLL_SPEED_FACTOR = 5;
public RelativeTouchContext(NvConnection conn, int actionIndex,
int referenceWidth, int referenceHeight, View view)
@ -248,9 +248,7 @@ public class RelativeTouchContext implements TouchContext {
if (pointerCount == 2) {
if (confirmedScroll) {
deltaY /= SCROLL_SPEED_DIVISOR;
conn.sendMouseHighResScroll((short) deltaY);
conn.sendMouseHighResScroll((short)(deltaY * SCROLL_SPEED_FACTOR));
}
} else {
conn.sendMouseMove((short) deltaX, (short) deltaY);

@ -1 +1 @@
Subproject commit a290ec032b6a068a56461bbe4b60798b68a319d5
Subproject commit 6001ece0b8bfcea6a8122a3e56f48f515e1aaaf5