|
|
@ -139,10 +139,7 @@ public class ControlMessageReader {
|
|
|
|
int action = Binary.toUnsigned(buffer.get());
|
|
|
|
int action = Binary.toUnsigned(buffer.get());
|
|
|
|
long pointerId = buffer.getLong();
|
|
|
|
long pointerId = buffer.getLong();
|
|
|
|
Position position = readPosition(buffer);
|
|
|
|
Position position = readPosition(buffer);
|
|
|
|
// 16 bits fixed-point
|
|
|
|
float pressure = Binary.u16FixedPointToFloat(buffer.getShort());
|
|
|
|
int pressureInt = Binary.toUnsigned(buffer.getShort());
|
|
|
|
|
|
|
|
// convert it to a float between 0 and 1 (0x1p16f is 2^16 as float)
|
|
|
|
|
|
|
|
float pressure = pressureInt == 0xffff ? 1f : (pressureInt / 0x1p16f);
|
|
|
|
|
|
|
|
int buttons = buffer.getInt();
|
|
|
|
int buttons = buffer.getInt();
|
|
|
|
return ControlMessage.createInjectTouchEvent(action, pointerId, position, pressure, buttons);
|
|
|
|
return ControlMessage.createInjectTouchEvent(action, pointerId, position, pressure, buttons);
|
|
|
|
}
|
|
|
|
}
|
|
|
|