Tentative fix for Xperia Play touchpad
This commit is contained in:
@@ -308,6 +308,7 @@ abstract class DifferentTouchInput
|
|||||||
float ymin = 0.0f;
|
float ymin = 0.0f;
|
||||||
float ymax = 1.0f;
|
float ymax = 1.0f;
|
||||||
float minRange = 1.0f;
|
float minRange = 1.0f;
|
||||||
|
float xshift = 0.0f;
|
||||||
|
|
||||||
XperiaPlayTouchpadTouchInput()
|
XperiaPlayTouchpadTouchInput()
|
||||||
{
|
{
|
||||||
@@ -322,14 +323,14 @@ abstract class DifferentTouchInput
|
|||||||
if( (device.getSources() & InputDevice.SOURCE_TOUCHPAD) != InputDevice.SOURCE_TOUCHPAD )
|
if( (device.getSources() & InputDevice.SOURCE_TOUCHPAD) != InputDevice.SOURCE_TOUCHPAD )
|
||||||
continue;
|
continue;
|
||||||
System.out.println("libSDL: input device ID " + id + " type " + device.getSources() + " name " + device.getName() + " is a touchpad" );
|
System.out.println("libSDL: input device ID " + id + " type " + device.getSources() + " name " + device.getName() + " is a touchpad" );
|
||||||
InputDevice.MotionRange range = device.getMotionRange(MotionEvent.AXIS_X);
|
InputDevice.MotionRange range = device.getMotionRange(MotionEvent.AXIS_X, InputDevice.SOURCE_TOUCHPAD);
|
||||||
if(range != null)
|
if(range != null)
|
||||||
{
|
{
|
||||||
xmin = range.getMin();
|
xmin = range.getMin();
|
||||||
xmax = range.getMax() - range.getMin();
|
xmax = range.getMax() - range.getMin();
|
||||||
System.out.println("libSDL: touch pad X range " + xmin + ":" + xmax );
|
System.out.println("libSDL: touch pad X range " + xmin + ":" + xmax );
|
||||||
}
|
}
|
||||||
range = device.getMotionRange(MotionEvent.AXIS_Y);
|
range = device.getMotionRange(MotionEvent.AXIS_Y, InputDevice.SOURCE_TOUCHPAD);
|
||||||
if(range != null)
|
if(range != null)
|
||||||
{
|
{
|
||||||
ymin = range.getMin();
|
ymin = range.getMin();
|
||||||
@@ -339,9 +340,9 @@ abstract class DifferentTouchInput
|
|||||||
// Xperia Play has long wide touchpad with joystick-like embossing on the sides, so we'll leave only a left joystick to function
|
// Xperia Play has long wide touchpad with joystick-like embossing on the sides, so we'll leave only a left joystick to function
|
||||||
// I don't know how to use the second joystick, so I'll just ignore it for now
|
// I don't know how to use the second joystick, so I'll just ignore it for now
|
||||||
minRange = Math.min( Math.abs(ymax - ymin), Math.abs(xmax - xmin) );
|
minRange = Math.min( Math.abs(ymax - ymin), Math.abs(xmax - xmin) );
|
||||||
|
xshift = xmax - minRange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int GalaxyNoteGingerStylus = 0;
|
|
||||||
public void process(final MotionEvent event)
|
public void process(final MotionEvent event)
|
||||||
{
|
{
|
||||||
boolean hwMouseEvent = ( event.getSource() == InputDevice.SOURCE_MOUSE ||
|
boolean hwMouseEvent = ( event.getSource() == InputDevice.SOURCE_MOUSE ||
|
||||||
@@ -361,14 +362,13 @@ abstract class DifferentTouchInput
|
|||||||
process(event);
|
process(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
int x = (int)((event.getX() - xmin) / xmax * 65535.0f);
|
int x = (int)((event.getX() - xmin) / xmax * 65535.0f);
|
||||||
int y = (int)((event.getY() - ymin) / ymax * 65535.0f);
|
int y = (int)((event.getY() - ymin) / ymax * 65535.0f);
|
||||||
// Use only left square part of a touch surface - I've heard reports that it breaks functionality, feel free to uncomment and test it.
|
|
||||||
/*
|
|
||||||
int x = (int)((event.getX() - xmin) / minRange * 65535.0f);
|
|
||||||
int y = (int)((event.getY() - ymin) / minRange * 65535.0f);
|
|
||||||
*/
|
*/
|
||||||
|
// Use only right square part of a touch surface - I've heard reports that it breaks functionality, feel free to uncomment and test it.
|
||||||
|
int x = (int)((event.getX() - xshift) / minRange * 65535.0f);
|
||||||
|
int y = (int)((event.getY() - ymin) / minRange * 65535.0f);
|
||||||
if( x > 65535 )
|
if( x > 65535 )
|
||||||
x = 65535;
|
x = 65535;
|
||||||
if( x < 0 )
|
if( x < 0 )
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ StartupMenuButtonTimeout=3000
|
|||||||
HiddenMenuOptions='OptionalDownloadConfig'
|
HiddenMenuOptions='OptionalDownloadConfig'
|
||||||
FirstStartMenuOptions=''
|
FirstStartMenuOptions=''
|
||||||
MultiABI=n
|
MultiABI=n
|
||||||
AppVersionCode=12116
|
AppVersionCode=12117
|
||||||
AppVersionName="1.2.1.16"
|
AppVersionName="1.2.1.17"
|
||||||
ResetSdlConfigForThisVersion=y
|
ResetSdlConfigForThisVersion=y
|
||||||
DeleteFilesOnUpgrade="data gm"
|
DeleteFilesOnUpgrade="data gm"
|
||||||
CompiledLibraries="jpeg png freetype timidity lzma lzo2"
|
CompiledLibraries="jpeg png freetype timidity lzma lzo2"
|
||||||
|
|||||||
Reference in New Issue
Block a user