mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-26 14:32:42 +00:00
Fix excessive high-res scroll speed on newer GFE versions
This commit is contained in:
parent
ec222413dd
commit
4a60ec1755
@ -23,13 +23,12 @@ public class AbsoluteTouchContext implements TouchContext {
|
|||||||
private boolean confirmedTap;
|
private boolean confirmedTap;
|
||||||
private Timer longPressTimer;
|
private Timer longPressTimer;
|
||||||
private Timer tapDownTimer;
|
private Timer tapDownTimer;
|
||||||
private float accumulatedScrollDelta;
|
|
||||||
|
|
||||||
private final NvConnection conn;
|
private final NvConnection conn;
|
||||||
private final int actionIndex;
|
private final int actionIndex;
|
||||||
private final View targetView;
|
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_TIME_THRESHOLD = 650;
|
||||||
private static final int LONG_PRESS_DISTANCE_THRESHOLD = 30;
|
private static final int LONG_PRESS_DISTANCE_THRESHOLD = 30;
|
||||||
@ -65,7 +64,6 @@ public class AbsoluteTouchContext implements TouchContext {
|
|||||||
lastTouchLocationY = lastTouchDownY = eventY;
|
lastTouchLocationY = lastTouchDownY = eventY;
|
||||||
lastTouchDownTime = SystemClock.uptimeMillis();
|
lastTouchDownTime = SystemClock.uptimeMillis();
|
||||||
cancelled = confirmedTap = confirmedLongPress = false;
|
cancelled = confirmedTap = confirmedLongPress = false;
|
||||||
accumulatedScrollDelta = 0;
|
|
||||||
|
|
||||||
if (actionIndex == 0) {
|
if (actionIndex == 0) {
|
||||||
// Start the timers
|
// Start the timers
|
||||||
@ -228,11 +226,7 @@ public class AbsoluteTouchContext implements TouchContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (actionIndex == 1) {
|
else if (actionIndex == 1) {
|
||||||
accumulatedScrollDelta += (eventY - lastTouchLocationY) / (float)SCROLL_SPEED_DIVISOR;
|
conn.sendMouseHighResScroll((short)((eventY - lastTouchLocationY) * SCROLL_SPEED_FACTOR));
|
||||||
if ((short)accumulatedScrollDelta != 0) {
|
|
||||||
conn.sendMouseHighResScroll((short)accumulatedScrollDelta);
|
|
||||||
accumulatedScrollDelta -= (short)accumulatedScrollDelta;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTouchLocationX = eventX;
|
lastTouchLocationX = eventX;
|
||||||
|
@ -36,7 +36,7 @@ public class RelativeTouchContext implements TouchContext {
|
|||||||
private static final int TAP_TIME_THRESHOLD = 250;
|
private static final int TAP_TIME_THRESHOLD = 250;
|
||||||
private static final int DRAG_TIME_THRESHOLD = 650;
|
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,
|
public RelativeTouchContext(NvConnection conn, int actionIndex,
|
||||||
int referenceWidth, int referenceHeight, View view)
|
int referenceWidth, int referenceHeight, View view)
|
||||||
@ -248,9 +248,7 @@ public class RelativeTouchContext implements TouchContext {
|
|||||||
|
|
||||||
if (pointerCount == 2) {
|
if (pointerCount == 2) {
|
||||||
if (confirmedScroll) {
|
if (confirmedScroll) {
|
||||||
deltaY /= SCROLL_SPEED_DIVISOR;
|
conn.sendMouseHighResScroll((short)(deltaY * SCROLL_SPEED_FACTOR));
|
||||||
|
|
||||||
conn.sendMouseHighResScroll((short) deltaY);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
conn.sendMouseMove((short) deltaX, (short) deltaY);
|
conn.sendMouseMove((short) deltaX, (short) deltaY);
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit a290ec032b6a068a56461bbe4b60798b68a319d5
|
Subproject commit 6001ece0b8bfcea6a8122a3e56f48f515e1aaaf5
|
Loading…
x
Reference in New Issue
Block a user