From 96d2e43bfb8e22bef74181b69979d42b4fc2421e Mon Sep 17 00:00:00 2001 From: pelya Date: Tue, 3 Dec 2013 20:45:00 +0200 Subject: [PATCH] Fix for MTK tablets with broken touch input --- project/java/Video.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/project/java/Video.java b/project/java/Video.java index 904b77536..c9c526f37 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -109,13 +109,18 @@ abstract class DifferentTouchInput multiTouchAvailable2 = true; } try { + Log.i("SDL", "Device: " + android.os.Build.DEVICE); + Log.i("SDL", "Device name: " + android.os.Build.DISPLAY); Log.i("SDL", "Device model: " + android.os.Build.MODEL); + Log.i("SDL", "Device board: " + android.os.Build.BOARD); if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH ) { if ( Globals.GenerateSubframeTouchEvents ) return IcsTouchInputWithHistory.Holder.sInstance; if( DetectCrappyDragonRiseDatexGamepad() ) return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance; + if( (android.os.Build.BOARD.contains("bird")) + return CrappyMtkTabletWithBrokenTouchDrivers.Holder.sInstance return IcsTouchInput.Holder.sInstance; } if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD ) @@ -468,6 +473,23 @@ abstract class DifferentTouchInput return false; } } + private static class CrappyMtkTabletWithBrokenTouchDrivers extends IcsTouchInput + { + private static class Holder + { + private static final CrappyMtkTabletWithBrokenTouchDrivers sInstance = new CrappyMtkTabletWithBrokenTouchDrivers(); + } + public void process(final MotionEvent event) + { + if( event.getX() != 0.0f && event.getY() != 0.0f ) // Ignore event when it has zero coordinates + super.process(event); + } + public void processGenericEvent(final MotionEvent event) + { + if( event.getX() != 0.0f && event.getY() != 0.0f ) // Ignore event when it has zero coordinates + super.processGenericEvent(event); + } + } }