Fix for nasty bug in multitouch events code
This commit is contained in:
@@ -437,6 +437,7 @@ public class MainActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean dispatchTouchEvent(final MotionEvent ev)
|
public boolean dispatchTouchEvent(final MotionEvent ev)
|
||||||
{
|
{
|
||||||
|
//System.out.println("dispatchTouchEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() );
|
||||||
if(_screenKeyboard != null)
|
if(_screenKeyboard != null)
|
||||||
_screenKeyboard.dispatchTouchEvent(ev);
|
_screenKeyboard.dispatchTouchEvent(ev);
|
||||||
else
|
else
|
||||||
@@ -454,6 +455,7 @@ public class MainActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean dispatchGenericMotionEvent (MotionEvent ev)
|
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
|
// This code fails to run for Android 1.6, so there will be no generic motion event for Andorid screen keyboard
|
||||||
/*
|
/*
|
||||||
if(_screenKeyboard != null)
|
if(_screenKeyboard != null)
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ abstract class DifferentTouchInput
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
|
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
|
||||||
return XperiaMiniTouchpadTouchInput.Holder.sInstance;
|
return XperiaPlayTouchpadTouchInput.Holder.sInstance;
|
||||||
if (multiTouchAvailable1 && multiTouchAvailable2)
|
if (multiTouchAvailable1 && multiTouchAvailable2)
|
||||||
return MultiTouchInput.Holder.sInstance;
|
return MultiTouchInput.Holder.sInstance;
|
||||||
else
|
else
|
||||||
@@ -228,6 +228,9 @@ abstract class DifferentTouchInput
|
|||||||
}
|
}
|
||||||
System.out.println(s);
|
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++ )
|
for( int id = 0; id < TOUCH_EVENTS_MAX; id++ )
|
||||||
{
|
{
|
||||||
@@ -249,8 +252,15 @@ abstract class DifferentTouchInput
|
|||||||
}
|
}
|
||||||
else
|
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;
|
action = Mouse.SDL_FINGER_MOVE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
action = Mouse.SDL_FINGER_DOWN;
|
action = Mouse.SDL_FINGER_DOWN;
|
||||||
@@ -286,11 +296,11 @@ abstract class DifferentTouchInput
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static class XperiaMiniTouchpadTouchInput extends MultiTouchInput
|
private static class XperiaPlayTouchpadTouchInput extends MultiTouchInput
|
||||||
{
|
{
|
||||||
private static class Holder
|
private static class Holder
|
||||||
{
|
{
|
||||||
private static final XperiaMiniTouchpadTouchInput sInstance = new XperiaMiniTouchpadTouchInput();
|
private static final XperiaPlayTouchpadTouchInput sInstance = new XperiaPlayTouchpadTouchInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
float xmin = 0.0f;
|
float xmin = 0.0f;
|
||||||
@@ -299,7 +309,7 @@ abstract class DifferentTouchInput
|
|||||||
float ymax = 1.0f;
|
float ymax = 1.0f;
|
||||||
float minRange = 1.0f;
|
float minRange = 1.0f;
|
||||||
|
|
||||||
XperiaMiniTouchpadTouchInput()
|
XperiaPlayTouchpadTouchInput()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
int[] devIds = InputDevice.getDeviceIds();
|
int[] devIds = InputDevice.getDeviceIds();
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ AppHandlesJoystickSensitivity=n
|
|||||||
AppUsesMultitouch=y
|
AppUsesMultitouch=y
|
||||||
NonBlockingSwapBuffers=n
|
NonBlockingSwapBuffers=n
|
||||||
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
|
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
|
||||||
AppTouchscreenKeyboardKeysAmount=6
|
AppTouchscreenKeyboardKeysAmount=0
|
||||||
AppTouchscreenKeyboardKeysAmountAutoFire=2
|
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||||
RedefinedKeysScreenKb="1 2 3 4 5 6 1 2 3 4"
|
RedefinedKeysScreenKb="1 2 3 4 5 6 1 2 3 4"
|
||||||
StartupMenuButtonTimeout=3000
|
StartupMenuButtonTimeout=3000
|
||||||
HiddenMenuOptions='OptionalDownloadConfig'
|
HiddenMenuOptions='OptionalDownloadConfig'
|
||||||
|
|||||||
Reference in New Issue
Block a user