Skip to content
John Mercier edited this page Nov 19, 2020 · 9 revisions

Welcome to the x11-client wiki!

Generating classes

Protocol classes are generated using the xcb xmls.

XObject

A struct, union, event, error, request, or reply. An XObject is composed of a protocol of XUnits. The XUnits are an ordered list of the data that makes up the protocol for the XObject.

XObjects are converted to a JavaType.

XUnit

A unit of the protocol. This can be

  • field
  • list
  • padding
  • alignment

All XUnits can be converted to a JavaUnit. Each XUnit has a similar JavaUnit.

Field and list units provide methods to create JavaProperty or JavaListProperty.

XUnitField

A field within an XObject. The type refers to an XType which can be resolved using an XResult.

Optional maskEnumType

When this field is set the field has a mask enum. The type is used to read and write the value but the field is a mask which switches on features described in the enum.

Optional enumType

When this field is set the field represents an enum. The type is used to read and write but the value represents an enum value.

XUnitList

A list within an XObject. has similar features of a XUnitField.

Contains an expression for the size of the list.

XType

The field type or list type. Can be a primative, enum, or XObject.

JavaUnits for fields and lists are created from a resolved XType for the field or list. XType provides the type info while the field provides the name within the object.

XResult

Contains all of the imports, xids, xidunions, structs, unions, enums, events, errors, requests, replys for an xcb file. It is capable of resolving a type name into an XType.

JavaType

Similat to XObject in that it contains a List of JavaUnits which define how the object is read and written. Contains method to generate a javapoet TypeSpec. The resulting TypeSpec is used to generate the class file. It contains member variables and the read and write methods to read and write the java object.

JavaUnit

Provides read and write CodeBlocks for creating the read and write methods of the JavaType. Can be a

  • JavaPad
  • JavaPadAlign
  • JavaProperty
  • JavaPropertyList

writeOnly readCode writeCode

JavaProperty

JavaProperty classes provide additional methods that return FieldSpec for the TypeSpec built in JavaType.

fieldSpec isField isStatic //means output only isParameter methods // extra methods declareAndReadCode builderSetCode builderMethods

JavaListProperty

Contains a Expression describing the length of the list.

Expressions

Can be a

  • value
  • fieldref
  • paramref
  • op expression
  • unop expression
  • popcount
  • sumof expression

value

A literal value

fieldref

A reference to a field within the object.

paramref

Has a name and type.

Add a parameter to the read and write methods.

op

A binary operation which is performed on a list of expressions. Operations include +, -, ×, /, &. The list of expressions can include other op expressions.

unop

A urnary operator. ~ is the only unup used.

popcount

Còunts the 1 bits of another field.

sumof

Sum of another list. Sumof contains an expression. If the other list contains objects a fieldref will describe which field. popcount may also be used.

  • listelement
  • fieldref
  • popcount