com.github.moaxcp.x11client.protocol.xproto.CreateCursor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x11-client Show documentation
Show all versions of x11-client Show documentation
An x11 client implemented in java
package com.github.moaxcp.x11client.protocol.xproto;
import com.github.moaxcp.x11client.protocol.OneWayRequest;
import com.github.moaxcp.x11client.protocol.X11Input;
import com.github.moaxcp.x11client.protocol.X11Output;
import java.io.IOException;
import java.lang.Byte;
import java.lang.Override;
import lombok.Builder;
import lombok.Value;
@Value
@Builder
public class CreateCursor implements OneWayRequest {
public static final byte OPCODE = 93;
private int cid;
private int source;
private int mask;
private short foreRed;
private short foreGreen;
private short foreBlue;
private short backRed;
private short backGreen;
private short backBlue;
private short x;
private short y;
public byte getOpCode() {
return OPCODE;
}
public static CreateCursor readCreateCursor(X11Input in) throws IOException {
in.readPad(1);
short length = in.readCard16();
int cid = in.readCard32();
int source = in.readCard32();
int mask = in.readCard32();
short foreRed = in.readCard16();
short foreGreen = in.readCard16();
short foreBlue = in.readCard16();
short backRed = in.readCard16();
short backGreen = in.readCard16();
short backBlue = in.readCard16();
short x = in.readCard16();
short y = in.readCard16();
CreateCursor.CreateCursorBuilder javaBuilder = CreateCursor.builder();
javaBuilder.cid(cid);
javaBuilder.source(source);
javaBuilder.mask(mask);
javaBuilder.foreRed(foreRed);
javaBuilder.foreGreen(foreGreen);
javaBuilder.foreBlue(foreBlue);
javaBuilder.backRed(backRed);
javaBuilder.backGreen(backGreen);
javaBuilder.backBlue(backBlue);
javaBuilder.x(x);
javaBuilder.y(y);
return javaBuilder.build();
}
@Override
public void write(byte offset, X11Output out) throws IOException {
out.writeCard8((byte)(Byte.toUnsignedInt(OPCODE) + Byte.toUnsignedInt(offset)));
out.writePad(1);
out.writeCard16((short) getLength());
out.writeCard32(cid);
out.writeCard32(source);
out.writeCard32(mask);
out.writeCard16(foreRed);
out.writeCard16(foreGreen);
out.writeCard16(foreBlue);
out.writeCard16(backRed);
out.writeCard16(backGreen);
out.writeCard16(backBlue);
out.writeCard16(x);
out.writeCard16(y);
}
@Override
public int getSize() {
return 32;
}
public static class CreateCursorBuilder {
public int getSize() {
return 32;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy