Xserver: fixed bugs with vertical screen orientation

This commit is contained in:
pelya
2014-04-24 04:49:12 +03:00
parent 3c8c656e34
commit 38652a483a
3 changed files with 27 additions and 24 deletions

View File

@@ -96,11 +96,20 @@ class AccelerometerReader implements SensorEventListener
public void onSensorChanged(SensorEvent event)
{
// TODO: vertical orientation
//if( Globals.HorizontalOrientation )
if( event.values[0] < x1 || event.values[0] > x2 ||
event.values[1] < y1 || event.values[1] > y2 ||
event.values[2] < z1 || event.values[2] > z2 )
nativeGyroscope(event.values[0] - xc, event.values[1] - yc, event.values[2] - zc);
if( Globals.HorizontalOrientation )
{
if( event.values[0] < x1 || event.values[0] > x2 ||
event.values[1] < y1 || event.values[1] > y2 ||
event.values[2] < z1 || event.values[2] > z2 )
nativeGyroscope(event.values[0] - xc, event.values[1] - yc, event.values[2] - zc);
}
else
{
if( event.values[0] < x1 || event.values[0] > x2 ||
event.values[1] < y1 || event.values[1] > y2 ||
event.values[2] < z1 || event.values[2] > z2 )
nativeGyroscope(-(event.values[1] - yc), event.values[0] - xc, event.values[2] - zc);
}
}
public void onAccuracyChanged(Sensor s, int a)
{