All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.moaxcp.x11client.protocol.randr.GetCrtcTransformReply Maven / Gradle / Ivy

There is a newer version: 0.18.2
Show newest version
package com.github.moaxcp.x11client.protocol.randr;

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 com.github.moaxcp.x11client.protocol.render.Transform;
import java.io.IOException;
import java.lang.Byte;
import java.lang.Integer;
import java.lang.Override;
import java.util.List;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;

@Value
@Builder
public class GetCrtcTransformReply implements XReply {
  private short sequenceNumber;

  @NonNull
  private Transform pendingTransform;

  private boolean hasTransforms;

  @NonNull
  private Transform currentTransform;

  @NonNull
  private List pendingFilterName;

  @NonNull
  private List pendingParams;

  @NonNull
  private List currentFilterName;

  @NonNull
  private List currentParams;

  public static GetCrtcTransformReply readGetCrtcTransformReply(byte pad, short sequenceNumber,
      X11Input in) throws IOException {
    int length = in.readCard32();
    Transform pendingTransform = Transform.readTransform(in);
    boolean hasTransforms = in.readBool();
    in.readPad(3);
    Transform currentTransform = Transform.readTransform(in);
    in.readPad(4);
    short pendingLen = in.readCard16();
    short pendingNparams = in.readCard16();
    short currentLen = in.readCard16();
    short currentNparams = in.readCard16();
    List pendingFilterName = in.readChar(Short.toUnsignedInt(pendingLen));
    in.readPadAlign(Short.toUnsignedInt(pendingLen));
    List pendingParams = in.readInt32(Short.toUnsignedInt(pendingNparams));
    List currentFilterName = in.readChar(Short.toUnsignedInt(currentLen));
    in.readPadAlign(Short.toUnsignedInt(currentLen));
    List currentParams = in.readInt32(Short.toUnsignedInt(currentNparams));
    GetCrtcTransformReply.GetCrtcTransformReplyBuilder javaBuilder = GetCrtcTransformReply.builder();
    javaBuilder.sequenceNumber(sequenceNumber);
    javaBuilder.pendingTransform(pendingTransform);
    javaBuilder.hasTransforms(hasTransforms);
    javaBuilder.currentTransform(currentTransform);
    javaBuilder.pendingFilterName(pendingFilterName);
    javaBuilder.pendingParams(pendingParams);
    javaBuilder.currentFilterName(currentFilterName);
    javaBuilder.currentParams(currentParams);
    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());
    pendingTransform.write(out);
    out.writeBool(hasTransforms);
    out.writePad(3);
    currentTransform.write(out);
    out.writePad(4);
    short pendingLen = (short) pendingFilterName.size();
    out.writeCard16(pendingLen);
    short pendingNparams = (short) pendingParams.size();
    out.writeCard16(pendingNparams);
    short currentLen = (short) currentFilterName.size();
    out.writeCard16(currentLen);
    short currentNparams = (short) currentParams.size();
    out.writeCard16(currentNparams);
    out.writeChar(pendingFilterName);
    out.writePadAlign(Short.toUnsignedInt(pendingLen));
    out.writeInt32(pendingParams);
    out.writeChar(currentFilterName);
    out.writePadAlign(Short.toUnsignedInt(currentLen));
    out.writeInt32(currentParams);
    out.writePadAlign(getSize());
  }

  @Override
  public int getSize() {
    return 96 + 1 * pendingFilterName.size() + XObject.getSizeForPadAlign(4, 1 * pendingFilterName.size()) + 4 * pendingParams.size() + 1 * currentFilterName.size() + XObject.getSizeForPadAlign(4, 1 * currentFilterName.size()) + 4 * currentParams.size();
  }

  public static class GetCrtcTransformReplyBuilder {
    public int getSize() {
      return 96 + 1 * pendingFilterName.size() + XObject.getSizeForPadAlign(4, 1 * pendingFilterName.size()) + 4 * pendingParams.size() + 1 * currentFilterName.size() + XObject.getSizeForPadAlign(4, 1 * currentFilterName.size()) + 4 * currentParams.size();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy