Skip to content

Commit

Permalink
Adding generated protocol sources to git
Browse files Browse the repository at this point in the history
  • Loading branch information
moaxcp committed Mar 17, 2024
1 parent ba567b2 commit b183ddc
Show file tree
Hide file tree
Showing 1,698 changed files with 138,028 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules/examples/x11.examples.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules/x11-client/x11.x11-client.test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ https://www.x.org/releases/X11R7.6/doc/libXtst/recordlib.html

# versions

## 0.17.0

* Adding generated protocol sources to git

## 0.16.0

* Renaming project to x11
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ plugins {
}

allprojects {
version = '0.16.0'
version = '0.17.0'
group = 'com.github.moaxcp.x11'
repositories {
mavenCentral()
}
tasks.withType(Copy).all { duplicatesStrategy 'exclude' }
tasks.withType(Jar).all {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
}

sonar {
Expand Down
4 changes: 2 additions & 2 deletions x11-protocol/x11-protocol-bigreq/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jacocoTestReport {
}

x11Protocol {
outputSrc = file('build/generated/xproto/java/')
outputResources = file('build/generated/xproto/resources')
outputSrc = file('src/main/java')
outputResources = file('src/main/resources')
xcbXmls = file('src/main/protocol')
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.github.moaxcp.x11.protocol.bigreq;

import com.github.moaxcp.x11.protocol.X11Input;
import com.github.moaxcp.x11.protocol.XError;
import com.github.moaxcp.x11.protocol.XEvent;
import com.github.moaxcp.x11.protocol.XGenericEvent;
import com.github.moaxcp.x11.protocol.XProtocolPlugin;
import com.github.moaxcp.x11.protocol.XRequest;
import java.io.IOException;
import java.util.Optional;
import lombok.Getter;
import lombok.Setter;

public class BigreqPlugin implements XProtocolPlugin {
@Getter
@Setter
private byte majorOpcode;

@Getter
@Setter
private byte firstEvent;

@Getter
@Setter
private byte firstError;

public String getPluginName() {
return "bigreq";
}

public Optional<String> getExtensionXName() {
return Optional.ofNullable("BIG-REQUESTS");
}

public Optional<String> getExtensionName() {
return Optional.ofNullable("BigRequests");
}

public Optional<Boolean> getExtensionMultiword() {
return Optional.ofNullable(true);
}

public Optional<Byte> getMajorVersion() {
return Optional.ofNullable((byte) 0);
}

public Optional<Byte> getMinorVersion() {
return Optional.ofNullable((byte) 0);
}

@Override
public boolean supportedRequest(XRequest request) {
return request.getPluginName().equals(getPluginName());
}

@Override
public boolean supportedRequest(byte majorOpcode, byte minorOpcode) {
boolean isMajorOpcode = majorOpcode == getMajorOpcode();
if(minorOpcode == 0) {
return isMajorOpcode;
}
return false;
}

@Override
public boolean supportedEvent(byte number) {
return false;
}

@Override
public boolean supportedError(byte code) {
return false;
}

@Override
public XRequest readRequest(byte majorOpcode, byte minorOpcode, X11Input in) throws IOException {
if(minorOpcode == Enable.OPCODE) {
return Enable.readEnable(in);
}
throw new IllegalArgumentException("majorOpcode " + majorOpcode + ", minorOpcode " + minorOpcode + " is not supported");
}

@Override
public XEvent readEvent(byte number, boolean sentEvent, X11Input in) throws IOException {
throw new IllegalArgumentException("number " + number + " is not supported");
}

@Override
public XError readError(byte code, X11Input in) throws IOException {
throw new IllegalArgumentException("code " + code + " is not supported");
}

@Override
public XGenericEvent readGenericEvent(boolean sentEvent, byte extension, short sequenceNumber,
int length, short eventType, X11Input in) throws IOException {
throw new IllegalArgumentException("eventType " + eventType + " is not supported");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.github.moaxcp.x11.protocol.bigreq;

import com.github.moaxcp.x11.protocol.TwoWayRequest;
import com.github.moaxcp.x11.protocol.X11Input;
import com.github.moaxcp.x11.protocol.X11Output;
import com.github.moaxcp.x11.protocol.XReplyFunction;
import java.io.IOException;
import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class Enable implements TwoWayRequest<EnableReply> {
public static final String PLUGIN_NAME = "bigreq";

public static final byte OPCODE = 0;

public XReplyFunction<EnableReply> getReplyFunction() {
return (field, sequenceNumber, in) -> EnableReply.readEnableReply(field, sequenceNumber, in);
}

public byte getOpCode() {
return OPCODE;
}

public static Enable readEnable(X11Input in) throws IOException {
Enable.EnableBuilder javaBuilder = Enable.builder();
byte majorOpcode = in.readCard8();
short length = in.readCard16();
return javaBuilder.build();
}

@Override
public void write(byte majorOpcode, X11Output out) throws IOException {
out.writeCard8(majorOpcode);
out.writeCard8((byte)(Byte.toUnsignedInt(OPCODE)));
out.writeCard16((short) getLength());
}

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

public String getPluginName() {
return PLUGIN_NAME;
}

public static class EnableBuilder {
public int getSize() {
return 4;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.github.moaxcp.x11.protocol.bigreq;

import com.github.moaxcp.x11.protocol.X11Input;
import com.github.moaxcp.x11.protocol.X11Output;
import com.github.moaxcp.x11.protocol.XReply;
import java.io.IOException;
import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class EnableReply implements XReply {
public static final String PLUGIN_NAME = "bigreq";

private short sequenceNumber;

private int maximumRequestLength;

public static EnableReply readEnableReply(byte pad1, short sequenceNumber, X11Input in) throws
IOException {
EnableReply.EnableReplyBuilder javaBuilder = EnableReply.builder();
int length = in.readCard32();
int maximumRequestLength = in.readCard32();
in.readPad(20);
javaBuilder.sequenceNumber(sequenceNumber);
javaBuilder.maximumRequestLength(maximumRequestLength);
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(maximumRequestLength);
}

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

public String getPluginName() {
return PLUGIN_NAME;
}

public static class EnableReplyBuilder {
public int getSize() {
return 12;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.github.moaxcp.x11.protocol.bigreq.BigreqPlugin
4 changes: 2 additions & 2 deletions x11-protocol/x11-protocol-composite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jacocoTestReport {
}

x11Protocol {
outputSrc = file('build/generated/xproto/java/')
outputResources = file('build/generated/xproto/resources')
outputSrc = file('src/main/java')
outputResources = file('src/main/resources')
xcbXmls = file('src/main/protocol')
exclude = ['xproto', 'xfixes', 'render', 'shape']
}
Expand Down
Loading

0 comments on commit b183ddc

Please sign in to comment.