From e1f9d3c328eb10936d67ad4193280381e5086a0c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 30 Sep 2013 21:32:17 -0400 Subject: [PATCH] Fix touchpad inversion. Delay some between sending button down and button up to allow some games to detect input. --- src/com/limelight/Game.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/com/limelight/Game.java b/src/com/limelight/Game.java index 7993ca1f..4aa41037 100644 --- a/src/com/limelight/Game.java +++ b/src/com/limelight/Game.java @@ -188,8 +188,18 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi { if (!hasMoved) { - // We haven't move so send a click + // We haven't moved so send a click + + // Lower the mouse button conn.sendMouseButtonDown(); + + // We need to sleep a bit here because some games + // do input detection by polling + try { + Thread.sleep(100); + } catch (InterruptedException e) {} + + // Raise the mouse button conn.sendMouseButtonUp(); } } @@ -199,8 +209,8 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi if (eventX != lastTouchX || eventY != lastTouchY) { hasMoved = true; - conn.sendMouseMove((short)(lastTouchX - eventX), - (short)(lastTouchY - eventY)); + conn.sendMouseMove((short)(eventX - lastTouchX), + (short)(eventY - lastTouchY)); lastTouchX = eventX; lastTouchY = eventY;