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
|
@ -1,34 +0,0 @@
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue