Permalink
Browse files

Fix for nasty bug in multitouch events code

  • Loading branch information...
1 parent 88e9606 commit 90211ac16e521afd29bbb6586ee8345ac6fa394b @pelya committed Jun 12, 2012
@@ -437,6 +437,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean dispatchTouchEvent(final MotionEvent ev)
{
+ //System.out.println("dispatchTouchEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() );
if(_screenKeyboard != null)
_screenKeyboard.dispatchTouchEvent(ev);
else
@@ -454,6 +455,7 @@ public boolean dispatchTouchEvent(final MotionEvent ev)
@Override
public boolean dispatchGenericMotionEvent (MotionEvent ev)
{
+ //System.out.println("dispatchGenericMotionEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() );
// This code fails to run for Android 1.6, so there will be no generic motion event for Andorid screen keyboard
/*
if(_screenKeyboard != null)
View
@@ -106,7 +106,7 @@ public static DifferentTouchInput getInstance()
}
try {
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
- return XperiaMiniTouchpadTouchInput.Holder.sInstance;
+ return XperiaPlayTouchpadTouchInput.Holder.sInstance;
if (multiTouchAvailable1 && multiTouchAvailable2)
return MultiTouchInput.Holder.sInstance;
else
@@ -228,6 +228,9 @@ public void process(final MotionEvent event)
}
System.out.println(s);
*/
+ int pointerReleased = -1;
+ if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP )
+ pointerReleased = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
for( int id = 0; id < TOUCH_EVENTS_MAX; id++ )
{
@@ -249,8 +252,15 @@ public void process(final MotionEvent event)
}
else
{
- if( touchEvents[id].down )
+ if( pointerReleased == id && touchEvents[pointerReleased].down )
+ {
+ action = Mouse.SDL_FINGER_UP;
+ touchEvents[id].down = false;
+ }
+ else if( touchEvents[id].down )
+ {
action = Mouse.SDL_FINGER_MOVE;
+ }
else
{
action = Mouse.SDL_FINGER_DOWN;
@@ -286,11 +296,11 @@ public void process(final MotionEvent event)
}
}
}
- private static class XperiaMiniTouchpadTouchInput extends MultiTouchInput
+ private static class XperiaPlayTouchpadTouchInput extends MultiTouchInput
{
private static class Holder
{
- private static final XperiaMiniTouchpadTouchInput sInstance = new XperiaMiniTouchpadTouchInput();
+ private static final XperiaPlayTouchpadTouchInput sInstance = new XperiaPlayTouchpadTouchInput();
}
float xmin = 0.0f;
@@ -299,7 +309,7 @@ public void process(final MotionEvent event)
float ymax = 1.0f;
float minRange = 1.0f;
- XperiaMiniTouchpadTouchInput()
+ XperiaPlayTouchpadTouchInput()
{
super();
int[] devIds = InputDevice.getDeviceIds();
@@ -26,8 +26,8 @@ AppHandlesJoystickSensitivity=n
AppUsesMultitouch=y
NonBlockingSwapBuffers=n
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
-AppTouchscreenKeyboardKeysAmount=6
-AppTouchscreenKeyboardKeysAmountAutoFire=2
+AppTouchscreenKeyboardKeysAmount=0
+AppTouchscreenKeyboardKeysAmountAutoFire=0
RedefinedKeysScreenKb="1 2 3 4 5 6 1 2 3 4"
StartupMenuButtonTimeout=3000
HiddenMenuOptions='OptionalDownloadConfig'

0 comments on commit 90211ac

Please sign in to comment.