com.github.moaxcp.x11client.protocol.xf86dri.GetDrawableInfoReply 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.xf86dri;
import com.github.moaxcp.x11client.protocol.X11Input;
import com.github.moaxcp.x11client.protocol.X11Output;
import com.github.moaxcp.x11client.protocol.XObject;
import com.github.moaxcp.x11client.protocol.XReply;
import java.io.IOException;
import java.lang.Override;
import java.util.ArrayList;
import java.util.List;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@Value
@Builder
public class GetDrawableInfoReply implements XReply {
private short sequenceNumber;
private int drawableTableIndex;
private int drawableTableStamp;
private short drawableOriginX;
private short drawableOriginY;
private short drawableSizeW;
private short drawableSizeH;
private int numClipRects;
private short backX;
private short backY;
private int numBackClipRects;
@NonNull
private List clipRects;
@NonNull
private List backClipRects;
public static GetDrawableInfoReply readGetDrawableInfoReply(byte pad, short sequenceNumber,
X11Input in) throws IOException {
int length = in.readCard32();
int drawableTableIndex = in.readCard32();
int drawableTableStamp = in.readCard32();
short drawableOriginX = in.readInt16();
short drawableOriginY = in.readInt16();
short drawableSizeW = in.readInt16();
short drawableSizeH = in.readInt16();
int numClipRects = in.readCard32();
short backX = in.readInt16();
short backY = in.readInt16();
int numBackClipRects = in.readCard32();
List clipRects = new ArrayList<>((int) (Integer.toUnsignedLong(numClipRects)));
for(int i = 0; i < Integer.toUnsignedLong(numClipRects); i++) {
clipRects.add(DrmClipRect.readDrmClipRect(in));
}
List backClipRects = new ArrayList<>((int) (Integer.toUnsignedLong(numBackClipRects)));
for(int i = 0; i < Integer.toUnsignedLong(numBackClipRects); i++) {
backClipRects.add(DrmClipRect.readDrmClipRect(in));
}
GetDrawableInfoReply.GetDrawableInfoReplyBuilder javaBuilder = GetDrawableInfoReply.builder();
javaBuilder.sequenceNumber(sequenceNumber);
javaBuilder.drawableTableIndex(drawableTableIndex);
javaBuilder.drawableTableStamp(drawableTableStamp);
javaBuilder.drawableOriginX(drawableOriginX);
javaBuilder.drawableOriginY(drawableOriginY);
javaBuilder.drawableSizeW(drawableSizeW);
javaBuilder.drawableSizeH(drawableSizeH);
javaBuilder.numClipRects(numClipRects);
javaBuilder.backX(backX);
javaBuilder.backY(backY);
javaBuilder.numBackClipRects(numBackClipRects);
javaBuilder.clipRects(clipRects);
javaBuilder.backClipRects(backClipRects);
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
return javaBuilder.build();
}
@Override
public void write(X11Output out) throws IOException {
out.writeCard8(getResponseCode());
out.writePad(1);
out.writeCard16(sequenceNumber);
out.writeCard32(getLength());
out.writeCard32(drawableTableIndex);
out.writeCard32(drawableTableStamp);
out.writeInt16(drawableOriginX);
out.writeInt16(drawableOriginY);
out.writeInt16(drawableSizeW);
out.writeInt16(drawableSizeH);
out.writeCard32(numClipRects);
out.writeInt16(backX);
out.writeInt16(backY);
out.writeCard32(numBackClipRects);
for(DrmClipRect t : clipRects) {
t.write(out);
}
for(DrmClipRect t : backClipRects) {
t.write(out);
}
out.writePadAlign(getSize());
}
@Override
public int getSize() {
return 36 + XObject.sizeOf(clipRects) + XObject.sizeOf(backClipRects);
}
public static class GetDrawableInfoReplyBuilder {
public int getSize() {
return 36 + XObject.sizeOf(clipRects) + XObject.sizeOf(backClipRects);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy