Skip to content

Commit

Permalink
Adding examples with fixes and api.
Browse files Browse the repository at this point in the history
Added support for no-sequence-number in KeymapNotifyEvent I suspect this also fixed the RecordApiExample.

Fixed bug where generated code for reading generic events was missing from protocol plugins

Fixed bug in generated code for replies where reading pad align was missing

Added XApi and extended interfaces to act as traits for the X11Client. These interfaces allow the X11Client to have an api beyond the simple response, reply, event, and error api.

Added examples for xproto.
  • Loading branch information
moaxcp committed Dec 28, 2024
1 parent 08bc643 commit c5dffec
Show file tree
Hide file tree
Showing 181 changed files with 186 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ https://www.x.org/releases/X11R7.6/doc/libXtst/recordlib.html

* Added support for no-sequence-number events which is only used in KeymapNotifyEvent
* This fixed part of the RecordApiExample
* Fixing bug in generating code to read generic events
* Fixed bug where generated code for reading generic events was missing from protocol plugins
* Fixed bug in generated code for replies where reading pad align was missing
* Adding XApi interfaces to cleanup client
* Added examples and api to run examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static void main(String... args) throws IOException, InterruptedException
.y(500)
.build());

client.sync();

System.out.println(client.getNextEvent());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public static void main(String... args) throws IOException {
.build();
var fonts = client.send(listFontsRequest);

fonts.getNames().forEach(str -> System.out.println(Utilities.toString(str.getName()).indent(4)));
fonts.getNames().forEach(str -> System.out.println(" " + Utilities.toString(str.getName())));

client.sync();

System.out.println("Fonts with info:");

Expand All @@ -36,7 +38,7 @@ public static void main(String... args) throws IOException {
var fontsWithInfo = client.send(listFontsWithInfoRequest);

while (!fontsWithInfo.getName().isEmpty()) {
System.out.println("%s %d".formatted(Utilities.toString(fontsWithInfo.getName()), fontsWithInfo.getRepliesHint()).indent(4));
System.out.println(" %s %d".formatted(Utilities.toString(fontsWithInfo.getName()), fontsWithInfo.getRepliesHint()));
fontsWithInfo = client.getNextReply(listFontsWithInfoRequest.getReplyFunction());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
public interface XprotoApi extends XApi {

/**
* Sends a {@link GetInputFocus} to the server. This is a {@link TwoWayRequest} which causes a {@link #flush()} and
* Sends a {@link GetInputFocus} to the server. This is a {@link TwoWayRequest} which causes a {@link com.github.moaxcp.x11.x11client.X11Client#flush()} and
* all events to be read from the server and added to the event queue.
* See <a href="https://github.com/mirror/libX11/blob/caa71668af7fd3ebdd56353c8f0ab90824773969/src/Sync.c">...</a>
*/
default void sync() {
GetInputFocusReply reply = send(GetInputFocus.builder().build());
send(GetInputFocus.builder().build());
}

int nextResourceId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class JavaReply extends JavaClass {
methodBuilder.beginControlFlow('if(javaBuilder.getSize() < 32)')
methodBuilder.addStatement('in.readPad(32 - javaBuilder.getSize())')
methodBuilder.endControlFlow()
return
}

if(fixedSize && fixedSize.get() % 4 == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static ConnectReply readConnectReply(byte pad1, short sequenceNumber, X11
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static GetBuffersReply readGetBuffersReply(byte pad1, short sequenceNumbe
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static GetBuffersWithFormatReply readGetBuffersWithFormatReply(byte pad1,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static BuffersFromPixmapReply readBuffersFromPixmapReply(byte nfd, short
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static GetSupportedModifiersReply readGetSupportedModifiersReply(byte pad
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static AreTexturesResidentReply readAreTexturesResidentReply(byte pad1,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static GenQueriesARBReply readGenQueriesARBReply(byte pad1, short sequenc
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static GenTexturesReply readGenTexturesReply(byte pad1, short sequenceNum
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetBooleanvReply readGetBooleanvReply(byte pad1, short sequenceNum
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static GetClipPlaneReply readGetClipPlaneReply(byte pad1, short sequenceN
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetColorTableParameterfvReply readGetColorTableParameterfvReply(by
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetColorTableParameterivReply readGetColorTableParameterivReply(by
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static GetColorTableReply readGetColorTableReply(byte pad1, short sequenc
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static GetCompressedTexImageARBReply readGetCompressedTexImageARBReply(by
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static GetConvolutionFilterReply readGetConvolutionFilterReply(byte pad1,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetConvolutionParameterfvReply readGetConvolutionParameterfvReply(
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetConvolutionParameterivReply readGetConvolutionParameterivReply(
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetDoublevReply readGetDoublevReply(byte pad1, short sequenceNumbe
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static GetDrawableAttributesReply readGetDrawableAttributesReply(byte pad
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static GetFBConfigsReply readGetFBConfigsReply(byte pad1, short sequenceN
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetFloatvReply readGetFloatvReply(byte pad1, short sequenceNumber,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetHistogramParameterfvReply readGetHistogramParameterfvReply(byte
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetHistogramParameterivReply readGetHistogramParameterivReply(byte
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static GetHistogramReply readGetHistogramReply(byte pad1, short sequenceN
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetIntegervReply readGetIntegervReply(byte pad1, short sequenceNum
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetLightfvReply readGetLightfvReply(byte pad1, short sequenceNumbe
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetLightivReply readGetLightivReply(byte pad1, short sequenceNumbe
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetMapdvReply readGetMapdvReply(byte pad1, short sequenceNumber, X
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetMapfvReply readGetMapfvReply(byte pad1, short sequenceNumber, X
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetMapivReply readGetMapivReply(byte pad1, short sequenceNumber, X
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetMaterialfvReply readGetMaterialfvReply(byte pad1, short sequenc
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetMaterialivReply readGetMaterialivReply(byte pad1, short sequenc
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetMinmaxParameterfvReply readGetMinmaxParameterfvReply(byte pad1,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetMinmaxParameterivReply readGetMinmaxParameterivReply(byte pad1,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static GetMinmaxReply readGetMinmaxReply(byte pad1, short sequenceNumber,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetPixelMapfvReply readGetPixelMapfvReply(byte pad1, short sequenc
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetPixelMapuivReply readGetPixelMapuivReply(byte pad1, short seque
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetPixelMapusvReply readGetPixelMapusvReply(byte pad1, short seque
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static GetPolygonStippleReply readGetPolygonStippleReply(byte pad1, short
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetQueryObjectivARBReply readGetQueryObjectivARBReply(byte pad1,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetQueryObjectuivARBReply readGetQueryObjectuivARBReply(byte pad1,
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static GetQueryivARBReply readGetQueryivARBReply(byte pad1, short sequenc
if(javaBuilder.getSize() < 32) {
in.readPad(32 - javaBuilder.getSize());
}
in.readPadAlign(javaBuilder.getSize());
return javaBuilder.build();
}

Expand Down
Loading

0 comments on commit c5dffec

Please sign in to comment.