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

com.github.moaxcp.x11client.protocol.xfixes.ExpandRegion Maven / Gradle / Ivy

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

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 ExpandRegion implements OneWayRequest {
  public static final byte OPCODE = 28;

  private int source;

  private int destination;

  private short left;

  private short right;

  private short top;

  private short bottom;

  public byte getOpCode() {
    return OPCODE;
  }

  public static ExpandRegion readExpandRegion(X11Input in) throws IOException {
    in.readPad(1);
    short length = in.readCard16();
    int source = in.readCard32();
    int destination = in.readCard32();
    short left = in.readCard16();
    short right = in.readCard16();
    short top = in.readCard16();
    short bottom = in.readCard16();
    ExpandRegion.ExpandRegionBuilder javaBuilder = ExpandRegion.builder();
    javaBuilder.source(source);
    javaBuilder.destination(destination);
    javaBuilder.left(left);
    javaBuilder.right(right);
    javaBuilder.top(top);
    javaBuilder.bottom(bottom);
    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(source);
    out.writeCard32(destination);
    out.writeCard16(left);
    out.writeCard16(right);
    out.writeCard16(top);
    out.writeCard16(bottom);
  }

  @Override
  public int getSize() {
    return 20;
  }

  public static class ExpandRegionBuilder {
    public int getSize() {
      return 20;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy