通用类型
LISTofFOO
形如 LISTofFOO 的类型名表示一个由 FOO 类型元素构成的带计数列表;长度字段的大小可以变化(它不一定与一个 FOO 一样大),在某些情况下可能是隐含的,并且本文档没有完全规定它。
BITMASK 与 LISTofVALUE
类型 BITMASK 和 LISTofVALUE 比较特殊。有各种请求包含如下形式的参数:
value-mask: BITMASK
value-list: LISTofVALUE
用于允许客户端从一个异构的「可选」参数集合中指定其中一个子集。value-mask 指明要提供哪些参数;每个这样的参数都被分配一个唯一的位位置。BITMASK 的表示通常包含比已定义参数更多的位;value-mask 中未使用的位必须为零(否则服务器产生 Value 错误)。value-list 对掩码中每一个置 1 的位(从最低位到最高位顺序)包含一个值。每个值用 4 字节表示,但实际值只占用所需的最低若干字节;未使用字节的取值无关紧要。
Or 类型
形如「T1 or ... or Tn」的类型表示所指示各类型的并集;单元素类型只写出该元素本身,不加外层花括号。
DEVICE: 32-bit id (<class,model,manufacturer,unit> 8 bits each)
WINDOW: 32-bit id
PIXMAP: 32-bit id
CURSOR: 32-bit id
FONT: 32-bit id
GCONTEXT: 32-bit id
COLORMAP: 32-bit id
DRAWABLE: WINDOW or PIXMAP
ATOM: 32-bit id (top 3 bits guaranteed to be zero)
VISUALID: 32-bit id (top 3 bits guaranteed to be zero)
VALUE: 32-bit quantity (used only in LISTofVALUE)
INT8: 8-bit signed integer
INT16: 16-bit signed integer
INT32: 32-bit signed integer
CARD8: 8-bit unsigned integer
CARD16: 16-bit unsigned integer
CARD32: 32-bit unsigned integer
TIMESTAMP: CARD32
BITGRAVITY: {Forget, Static,
NorthWest, North, NorthEast,
West, Center, East,
SouthWest, South, SouthEast}
WINGRAVITY: {Unmap, Static,
NorthWest, North, NorthEast,
West, Center, East,
SouthWest, South, SouthEast}
BOOL: {True, False}
EVENT: {KeyPress, KeyRelease,
OwnerGrabButton,
ButtonPress, ButtonRelease, EnterWindow, LeaveWindow,
PointerMotion, PointerMotionHint,
Button1Motion, Button2Motion, Button3Motion,
Button4Motion, Button5Motion, ButtonMotion
Exposure, VisibilityChange,
StructureNotify, ResizeRedirect,
SubstructureNotify, SubstructureRedirect,
FocusChange,
PropertyChange, ColormapChange,
KeymapState}
POINTEREVENT: {ButtonPress, ButtonRelease, EnterWindow, LeaveWindow,
PointerMotion, PointerMotionHint,
Button1Motion, Button2Motion, Button3Motion,
Button4Motion, Button5Motion, ButtonMotion
KeymapState}
DEVICEEVENT: {KeyPress, KeyRelease,
ButtonPress, ButtonRelease,
PointerMotion,
Button1Motion, Button2Motion, Button3Motion,
Button4Motion, Button5Motion, ButtonMotion}
KEYCODE: CARD8
BUTTON: CARD8
KEYMASK: {Shift, CapsLock, Control, Mod1, Mod2, Mod3, Mod4, Mod5}
BUTMASK: {Button1, Button2, Button3, Button4, Button5}
KEYBUTMASK: KEYMASK or BUTMASK
STRING8: LISTofCARD8
STRING16: LISTofCHAR2B
CHAR2B: [byte1, byte2: CARD8] POINT: [x, y: INT16] RECTANGLE: [x, y: INT16,
width, height: CARD16]
ARC: [x, y: INT16,
width, height: CARD16,
angle1, angle2: INT16]
HOST: [family: {Internet, NS, ECMA, Datakit, DECnet}
address: LISTofCARD8]
RECTANGLE 的 [x,y] 坐标指定其左上角。
对 STRING16 中「large」字符的主要解释是:它们由两个字节组成,用来索引一个 2-D 矩阵;因此使用 CHAR2B 而不是 CARD16。这对应于 JIS/ISO 对双字节字符的索引方式。预期大多数「large」字体都将以双字节矩阵索引来定义。对于以线性索引构造的 large 字体,可以把 byte1 当作最高有效字节,从而把 CHAR2B 解释为一个 16 位数;这意味着客户端应始终以最高有效字节在先的顺序发送这类 16 位字符值,因为服务器绝不会对 CHAR2B 量作字节交换。
HOST 地址的长度、格式和解释方式取决于具体的 family。