1
0
Fork 0
mirror of https://github.com/rfc2822/GfxTablet synced 2025-10-04 01:59:16 +02:00

* app refactoring

* uinput driver
This commit is contained in:
Richard Hirner 2013-01-26 21:24:36 +01:00
parent 1b93a87ed0
commit cef17da6d2
34 changed files with 251 additions and 103 deletions

View file

@ -0,0 +1,34 @@
package at.bitfire.gfxtablet;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class NetButtonEvent extends NetEvent {
boolean down;
public NetButtonEvent(int x, int y, int pressure, boolean down) {
super(x, y, pressure);
this.down = down;
}
@Override
public byte[] toByteArray() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
try {
dos.write(1); /* EVENT_TYPE_BUTTON */
dos.writeShort(x);
dos.writeShort(y);
dos.writeShort(pressure);
dos.write(1);
dos.write(down ? 1 : 0);
} catch (IOException e) {
return null;
}
return baos.toByteArray();
}
}