com.github.moaxcp.x11.protocol.xinput.InputState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x11-protocol-xinput Show documentation
Show all versions of x11-protocol-xinput Show documentation
An implementation of the x11 xinput protocol in java
package com.github.moaxcp.x11.protocol.xinput;
import com.github.moaxcp.x11.protocol.X11Input;
import com.github.moaxcp.x11.protocol.XStruct;
import java.io.IOException;
public interface InputState extends XStruct {
static InputState readInputState(X11Input in) throws IOException {
byte classId = in.readCard8();
byte len = in.readCard8();
InputClass ref = InputClass.getByCode(classId);
if(ref == InputClass.KEY) {
return InputStateKey.readInputStateKey(classId, len, in);
}
if(ref == InputClass.BUTTON) {
return InputStateButton.readInputStateButton(classId, len, in);
}
if(ref == InputClass.VALUATOR) {
return InputStateValuator.readInputStateValuator(classId, len, in);
}
throw new IllegalStateException("Could not find class for " + ref);
}
}