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:
parent
1b93a87ed0
commit
cef17da6d2
34 changed files with 251 additions and 103 deletions
34
app-android/src/at/bitfire/gfxtablet/NetButtonEvent.java
Normal file
34
app-android/src/at/bitfire/gfxtablet/NetButtonEvent.java
Normal 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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue