com.github.moaxcp.x11client.protocol.xproto.ClientMessageEvent 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.X11Input;
import com.github.moaxcp.x11client.protocol.X11Output;
import com.github.moaxcp.x11client.protocol.XEvent;
import java.io.IOException;
import java.lang.Override;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@Value
@Builder
public class ClientMessageEvent implements XEvent {
public static final byte NUMBER = 33;
private boolean sentEvent;
private byte format;
private short sequenceNumber;
private int window;
private int type;
@NonNull
private ClientMessageDataUnion data;
@Override
public byte getResponseCode() {
return NUMBER;
}
public static ClientMessageEvent readClientMessageEvent(boolean sentEvent, X11Input in) throws
IOException {
byte format = in.readCard8();
short sequenceNumber = in.readCard16();
int window = in.readCard32();
int type = in.readCard32();
ClientMessageDataUnion data = ClientMessageDataUnion.readClientMessageDataUnion(in, format);
ClientMessageEvent.ClientMessageEventBuilder javaBuilder = ClientMessageEvent.builder();
javaBuilder.format(format);
javaBuilder.sequenceNumber(sequenceNumber);
javaBuilder.window(window);
javaBuilder.type(type);
javaBuilder.data(data);
javaBuilder.sentEvent(sentEvent);
return javaBuilder.build();
}
@Override
public void write(X11Output out) throws IOException {
out.writeCard8(sentEvent ? 0b10000000 & NUMBER : NUMBER);
out.writeCard8(format);
out.writeCard16(sequenceNumber);
out.writeCard32(window);
out.writeCard32(type);
data.write(out);
}
@Override
public int getSize() {
return 32;
}
public static class ClientMessageEventBuilder {
public int getSize() {
return 32;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy