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

initial commit

This commit is contained in:
Richard 2013-01-15 06:43:50 +01:00
commit 49b61c7f7e
28 changed files with 673 additions and 0 deletions

View file

@ -0,0 +1,34 @@
package com.gimpusers.xorgtablet;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class XButtonEvent extends XEvent {
boolean down;
public XButtonEvent(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();
}
}