From cac2bdbb81f448dceae79c6fc614c09b565e0580 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 27 Oct 2018 13:50:37 -0700 Subject: [PATCH] Disable back mouse button on Xiaomi devices to workaround issue --- app/src/main/java/com/limelight/Game.java | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 9dee6686..ecb39dbd 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -1031,17 +1031,21 @@ public class Game extends Activity implements SurfaceHolder.Callback, } } - if ((changedButtons & MotionEvent.BUTTON_BACK) != 0) { - if ((event.getButtonState() & MotionEvent.BUTTON_BACK) != 0) { - conn.sendMouseButtonDown(MouseButtonPacket.BUTTON_X1); - } - else { - conn.sendMouseButtonUp(MouseButtonPacket.BUTTON_X1); - } + // HACK: Disable mouse back button press on Xiaomi due to reported + // issues with right clicks triggering it. + if (!("Xiaomi".equalsIgnoreCase(Build.MANUFACTURER))) { + if ((changedButtons & MotionEvent.BUTTON_BACK) != 0) { + if ((event.getButtonState() & MotionEvent.BUTTON_BACK) != 0) { + conn.sendMouseButtonDown(MouseButtonPacket.BUTTON_X1); + } + else { + conn.sendMouseButtonUp(MouseButtonPacket.BUTTON_X1); + } - // Don't use the KEYCODE_BACK hack. That will cause this - // button press to trigger a right-click. - gotBackPointerEvent = true; + // Don't use the KEYCODE_BACK hack. That will cause this + // button press to trigger a right-click. + gotBackPointerEvent = true; + } } if ((changedButtons & MotionEvent.BUTTON_FORWARD) != 0) {