From 40c406051c949aeb12ba37f43805c362399f0e3c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 20 Mar 2018 20:21:21 -0700 Subject: [PATCH] Ignore non-relative MotionEvents on Oreo to fix mouse jumping when toggling capture --- app/src/main/java/com/limelight/Game.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 4453f9b8..3e4dda69 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -970,6 +970,12 @@ public class Game extends Activity implements SurfaceHolder.Callback, lastMouseX = (int)event.getX(); lastMouseY = (int)event.getY(); } + else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + // We get a normal (non-relative) MotionEvent when starting pointer capture to synchronize the + // location of the cursor with our app. We don't want this, so we must discard this event. + lastMouseX = (int)event.getX(); + lastMouseY = (int)event.getY(); + } else { // First process the history for (int i = 0; i < event.getHistorySize(); i++) {