#1 feat(xtgen): generator for xcb-proto bindings
A bigreq/replies_fuzz_test.go +21 -0
A bigreq/replies_generated.go +21 -0
A bigreq/requests_generated.go +21 -0
A bigreq/sizes_test.go +11 -0
A bigreq/types_generated.go +2 -0
A buf.go +92 -0
A buf_test.go +69 -0
A cmd/xtgen/emit.go +252 -0
A cmd/xtgen/expr.go +43 -0
A cmd/xtgen/ir.go +39 -0
A cmd/xtgen/layout.go +103 -0
M cmd/xtgen/main.go +47 -1
A cmd/xtgen/naming.go +43 -0
A cmd/xtgen/parse.go +292 -0
A cmd/xtgen/parse_test.go +74 -0
A cmd/xtgen/replies.go +554 -0
A cmd/xtgen/replies_test.go +70 -0
A cmd/xtgen/requests.go +359 -0
A cmd/xtgen/resolve.go +356 -0
A cmd/xtgen/resolve_test.go +165 -0
A cmd/xtgen/templates/ext.tmpl +10 -0
A cmd/xtgen/templates/replies.tmpl +5 -0
A cmd/xtgen/templates/requests.tmpl +5 -0
A cmd/xtgen/templates/sizes.tmpl +7 -0
A cmd/xtgen/templates/types.tmpl +5 -0
A cmd/xtgen/values.go +136 -0
A cmd/xtgen/values_test.go +93 -0
A composite/replies_fuzz_test.go +39 -0
A composite/replies_generated.go +42 -0
A composite/requests_generated.go +176 -0
A composite/sizes_test.go +14 -0
A composite/types_generated.go +7 -0
A ext.go +27 -0
A ext_generated.go +19 -0
A ge/replies_fuzz_test.go +22 -0
A ge/replies_generated.go +24 -0
A ge/requests_generated.go +24 -0
A ge/sizes_test.go +11 -0
A ge/types_generated.go +2 -0
A generate.go +3 -0
A internal/xtest/README.md +40 -0
A internal/xtest/capture_test.go +405 -0
A internal/xtest/golden.go +22 -0
A lists_test.go +87 -0
A render/replies_fuzz_test.go +135 -0
A render/replies_generated.go +380 -0
A render/requests_generated.go +1276 -0
A render/sizes_test.go +68 -0
A render/types_generated.go +522 -0
A replies_test.go +304 -0
A requests_test.go +62 -0
A res/replies_fuzz_test.go +146 -0
A res/replies_generated.go +348 -0
A res/requests_generated.go +144 -0
A res/sizes_test.go +47 -0
A res/types_generated.go +159 -0
A shape/replies_fuzz_test.go +86 -0
A shape/replies_generated.go +123 -0
A shape/requests_generated.go +214 -0
A shape/sizes_test.go +23 -0
A shape/types_generated.go +20 -0
A testdata/golden/render/CreatePicture.req.hex +3 -0
A testdata/golden/render/QueryPictFormats.reply.hex +3 -0
A testdata/golden/res/QueryClientIds.reply.hex +3 -0
A testdata/golden/res/QueryClientIds.req.hex +3 -0
A testdata/golden/xfixes/QueryVersion.reply.hex +3 -0
A testdata/golden/xfixes/QueryVersion.req.hex +3 -0
A testdata/golden/xproto/ChangeProperty.req.hex +3 -0
A testdata/golden/xproto/ChangeWindowAttributes.req.hex +3 -0
A testdata/golden/xproto/ConfigureWindow.req.hex +3 -0
A testdata/golden/xproto/ConfigureWindowAll.req.hex +3 -0
A testdata/golden/xproto/ConfigureWindowSparse.req.hex +3 -0
A testdata/golden/xproto/CreateWindow.req.hex +3 -0
A testdata/golden/xproto/GetGeometry.reply.hex +3 -0
A testdata/golden/xproto/GetGeometry.req.hex +3 -0
A testdata/golden/xproto/GetProperty.reply.hex +3 -0
A testdata/golden/xproto/GetPropertyEmpty.reply.hex +3 -0
A testdata/golden/xproto/GetWindowAttributes.reply.hex +3 -0
A testdata/golden/xproto/InternAtom.reply.hex +3 -0
A testdata/golden/xproto/InternAtom.req.hex +3 -0
A testdata/golden/xproto/ListExtensions.reply.hex +3 -0
A testdata/golden/xproto/MapWindow.req.hex +3 -0
A testdata/golden/xproto/QueryExtension.reply.hex +3 -0
A testdata/golden/xproto/QueryTree.reply.hex +3 -0
A values_test.go +103 -0
A xcmisc/replies_fuzz_test.go +60 -0
A xcmisc/replies_generated.go +80 -0
A xcmisc/requests_generated.go +59 -0
A xcmisc/sizes_test.go +17 -0
A xcmisc/types_generated.go +2 -0
A xfixes/replies_fuzz_test.go +136 -0
A xfixes/replies_generated.go +242 -0
A xfixes/requests_generated.go +766 -0
A xfixes/sizes_test.go +32 -0
A xfixes/types_generated.go +55 -0
A xproto/replies_fuzz_test.go +895 -0
A xproto/replies_generated.go +1964 -0
A xproto/requests_generated.go +2780 -0
A xproto/requests_test.go +83 -0
A xproto/sizes_test.go +293 -0
A xproto/types_generated.go +1353 -0
| @@ -0,0 +1,1353 @@ | |||
| 1 | + | // Code generated by xtgen; DO NOT EDIT. | |
| 2 | + | package xproto | |
| 3 | + | ||
| 4 | + | import "encoding/binary" | |
| 5 | + | ||
| 6 | + | type Char2b struct { | |
| 7 | + | Byte1 uint8 | |
| 8 | + | Byte2 uint8 | |
| 9 | + | } | |
| 10 | + | ||
| 11 | + | const Char2bSize = 2 | |
| 12 | + | ||
| 13 | + | func (v Char2b) Put(p []byte) { clear(p[:2]); p[0:][0] = byte(v.Byte1); p[1:][0] = byte(v.Byte2) } | |
| 14 | + | func GetChar2b(p []byte) (v Char2b) { | |
| 15 | + | _ = p[1] | |
| 16 | + | v.Byte1 = uint8(p[0:][0]) | |
| 17 | + | v.Byte2 = uint8(p[1:][0]) | |
| 18 | + | return | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | type Window uint32 | |
| 22 | + | ||
| 23 | + | type Pixmap uint32 | |
| 24 | + | ||
| 25 | + | type Cursor uint32 | |
| 26 | + | ||
| 27 | + | type Font uint32 | |
| 28 | + | ||
| 29 | + | type Gcontext uint32 | |
| 30 | + | ||
| 31 | + | type Colormap uint32 | |
| 32 | + | ||
| 33 | + | type Atom uint32 | |
| 34 | + | ||
| 35 | + | type Drawable uint32 | |
| 36 | + | ||
| 37 | + | type Fontable uint32 | |
| 38 | + | ||
| 39 | + | type Bool32 uint32 | |
| 40 | + | ||
| 41 | + | type Visualid uint32 | |
| 42 | + | ||
| 43 | + | type Timestamp uint32 | |
| 44 | + | ||
| 45 | + | type Keysym uint32 | |
| 46 | + | ||
| 47 | + | type Keycode uint8 | |
| 48 | + | ||
| 49 | + | type Keycode32 uint32 | |
| 50 | + | ||
| 51 | + | type Button uint8 | |
| 52 | + | ||
| 53 | + | type Point struct { | |
| 54 | + | X int16 | |
| 55 | + | Y int16 | |
| 56 | + | } | |
| 57 | + | ||
| 58 | + | const PointSize = 4 | |
| 59 | + | ||
| 60 | + | func (v Point) Put(p []byte) { | |
| 61 | + | clear(p[:4]) | |
| 62 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X)) | |
| 63 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y)) | |
| 64 | + | } | |
| 65 | + | func GetPoint(p []byte) (v Point) { | |
| 66 | + | _ = p[3] | |
| 67 | + | v.X = int16(binary.LittleEndian.Uint16(p[0:])) | |
| 68 | + | v.Y = int16(binary.LittleEndian.Uint16(p[2:])) | |
| 69 | + | return | |
| 70 | + | } | |
| 71 | + | ||
| 72 | + | type Rectangle struct { | |
| 73 | + | X int16 | |
| 74 | + | Y int16 | |
| 75 | + | Width uint16 | |
| 76 | + | Height uint16 | |
| 77 | + | } | |
| 78 | + | ||
| 79 | + | const RectangleSize = 8 | |
| 80 | + | ||
| 81 | + | func (v Rectangle) Put(p []byte) { | |
| 82 | + | clear(p[:8]) | |
| 83 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X)) | |
| 84 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y)) | |
| 85 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Width)) | |
| 86 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Height)) | |
| 87 | + | } | |
| 88 | + | func GetRectangle(p []byte) (v Rectangle) { | |
| 89 | + | _ = p[7] | |
| 90 | + | v.X = int16(binary.LittleEndian.Uint16(p[0:])) | |
| 91 | + | v.Y = int16(binary.LittleEndian.Uint16(p[2:])) | |
| 92 | + | v.Width = uint16(binary.LittleEndian.Uint16(p[4:])) | |
| 93 | + | v.Height = uint16(binary.LittleEndian.Uint16(p[6:])) | |
| 94 | + | return | |
| 95 | + | } | |
| 96 | + | ||
| 97 | + | type Arc struct { | |
| 98 | + | X int16 | |
| 99 | + | Y int16 | |
| 100 | + | Width uint16 | |
| 101 | + | Height uint16 | |
| 102 | + | Angle1 int16 | |
| 103 | + | Angle2 int16 | |
| 104 | + | } | |
| 105 | + | ||
| 106 | + | const ArcSize = 12 | |
| 107 | + | ||
| 108 | + | func (v Arc) Put(p []byte) { | |
| 109 | + | clear(p[:12]) | |
| 110 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X)) | |
| 111 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y)) | |
| 112 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Width)) | |
| 113 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Height)) | |
| 114 | + | binary.LittleEndian.PutUint16(p[8:], uint16(v.Angle1)) | |
| 115 | + | binary.LittleEndian.PutUint16(p[10:], uint16(v.Angle2)) | |
| 116 | + | } | |
| 117 | + | func GetArc(p []byte) (v Arc) { | |
| 118 | + | _ = p[11] | |
| 119 | + | v.X = int16(binary.LittleEndian.Uint16(p[0:])) | |
| 120 | + | v.Y = int16(binary.LittleEndian.Uint16(p[2:])) | |
| 121 | + | v.Width = uint16(binary.LittleEndian.Uint16(p[4:])) | |
| 122 | + | v.Height = uint16(binary.LittleEndian.Uint16(p[6:])) | |
| 123 | + | v.Angle1 = int16(binary.LittleEndian.Uint16(p[8:])) | |
| 124 | + | v.Angle2 = int16(binary.LittleEndian.Uint16(p[10:])) | |
| 125 | + | return | |
| 126 | + | } | |
| 127 | + | ||
| 128 | + | type Format struct { | |
| 129 | + | Depth uint8 | |
| 130 | + | BitsPerPixel uint8 | |
| 131 | + | ScanlinePad uint8 | |
| 132 | + | } | |
| 133 | + | ||
| 134 | + | const FormatSize = 8 | |
| 135 | + | ||
| 136 | + | func (v Format) Put(p []byte) { | |
| 137 | + | clear(p[:8]) | |
| 138 | + | p[0:][0] = byte(v.Depth) | |
| 139 | + | p[1:][0] = byte(v.BitsPerPixel) | |
| 140 | + | p[2:][0] = byte(v.ScanlinePad) | |
| 141 | + | } | |
| 142 | + | func GetFormat(p []byte) (v Format) { | |
| 143 | + | _ = p[7] | |
| 144 | + | v.Depth = uint8(p[0:][0]) | |
| 145 | + | v.BitsPerPixel = uint8(p[1:][0]) | |
| 146 | + | v.ScanlinePad = uint8(p[2:][0]) | |
| 147 | + | return | |
| 148 | + | } | |
| 149 | + | ||
| 150 | + | type Visualtype struct { | |
| 151 | + | VisualId Visualid | |
| 152 | + | Class VisualClass | |
| 153 | + | BitsPerRgbValue uint8 | |
| 154 | + | ColormapEntries uint16 | |
| 155 | + | RedMask uint32 | |
| 156 | + | GreenMask uint32 | |
| 157 | + | BlueMask uint32 | |
| 158 | + | } | |
| 159 | + | ||
| 160 | + | const VisualtypeSize = 24 | |
| 161 | + | ||
| 162 | + | func (v Visualtype) Put(p []byte) { | |
| 163 | + | clear(p[:24]) | |
| 164 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.VisualId)) | |
| 165 | + | p[4:][0] = byte(v.Class) | |
| 166 | + | p[5:][0] = byte(v.BitsPerRgbValue) | |
| 167 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.ColormapEntries)) | |
| 168 | + | binary.LittleEndian.PutUint32(p[8:], uint32(v.RedMask)) | |
| 169 | + | binary.LittleEndian.PutUint32(p[12:], uint32(v.GreenMask)) | |
| 170 | + | binary.LittleEndian.PutUint32(p[16:], uint32(v.BlueMask)) | |
| 171 | + | } | |
| 172 | + | func GetVisualtype(p []byte) (v Visualtype) { | |
| 173 | + | _ = p[23] | |
| 174 | + | v.VisualId = Visualid(binary.LittleEndian.Uint32(p[0:])) | |
| 175 | + | v.Class = VisualClass(p[4:][0]) | |
| 176 | + | v.BitsPerRgbValue = uint8(p[5:][0]) | |
| 177 | + | v.ColormapEntries = uint16(binary.LittleEndian.Uint16(p[6:])) | |
| 178 | + | v.RedMask = uint32(binary.LittleEndian.Uint32(p[8:])) | |
| 179 | + | v.GreenMask = uint32(binary.LittleEndian.Uint32(p[12:])) | |
| 180 | + | v.BlueMask = uint32(binary.LittleEndian.Uint32(p[16:])) | |
| 181 | + | return | |
| 182 | + | } | |
| 183 | + | ||
| 184 | + | type Depth struct { | |
| 185 | + | Depth uint8 | |
| 186 | + | VisualsLen uint16 | |
| 187 | + | Visuals []Visualtype | |
| 188 | + | } | |
| 189 | + | ||
| 190 | + | const DepthSize = 8 | |
| 191 | + | ||
| 192 | + | func (v Depth) Size() int { | |
| 193 | + | off := 0 | |
| 194 | + | off += 1 | |
| 195 | + | off += 1 | |
| 196 | + | off += 2 | |
| 197 | + | off += 4 | |
| 198 | + | off += len(v.Visuals) * 24 | |
| 199 | + | return off | |
| 200 | + | } | |
| 201 | + | func (v Depth) Put(p []byte) { | |
| 202 | + | off := 0 | |
| 203 | + | p[off:][0] = byte(v.Depth) | |
| 204 | + | off += 1 | |
| 205 | + | clear(p[off : off+1]) | |
| 206 | + | off += 1 | |
| 207 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.VisualsLen)) | |
| 208 | + | off += 2 | |
| 209 | + | clear(p[off : off+4]) | |
| 210 | + | off += 4 | |
| 211 | + | for i := range v.Visuals { | |
| 212 | + | v.Visuals[i].Put(p[off+i*24:]) | |
| 213 | + | } | |
| 214 | + | off += len(v.Visuals) * 24 | |
| 215 | + | } | |
| 216 | + | ||
| 217 | + | type Screen struct { | |
| 218 | + | Root Window | |
| 219 | + | DefaultColormap Colormap | |
| 220 | + | WhitePixel uint32 | |
| 221 | + | BlackPixel uint32 | |
| 222 | + | CurrentInputMasks EventMask | |
| 223 | + | WidthInPixels uint16 | |
| 224 | + | HeightInPixels uint16 | |
| 225 | + | WidthInMillimeters uint16 | |
| 226 | + | HeightInMillimeters uint16 | |
| 227 | + | MinInstalledMaps uint16 | |
| 228 | + | MaxInstalledMaps uint16 | |
| 229 | + | RootVisual Visualid | |
| 230 | + | BackingStores BackingStore | |
| 231 | + | SaveUnders bool | |
| 232 | + | RootDepth uint8 | |
| 233 | + | AllowedDepthsLen uint8 | |
| 234 | + | AllowedDepths []Depth | |
| 235 | + | } | |
| 236 | + | ||
| 237 | + | const ScreenSize = 40 | |
| 238 | + | ||
| 239 | + | func (v Screen) Size() int { | |
| 240 | + | off := 0 | |
| 241 | + | off += 4 | |
| 242 | + | off += 4 | |
| 243 | + | off += 4 | |
| 244 | + | off += 4 | |
| 245 | + | off += 4 | |
| 246 | + | off += 2 | |
| 247 | + | off += 2 | |
| 248 | + | off += 2 | |
| 249 | + | off += 2 | |
| 250 | + | off += 2 | |
| 251 | + | off += 2 | |
| 252 | + | off += 4 | |
| 253 | + | off += 1 | |
| 254 | + | off += 1 | |
| 255 | + | off += 1 | |
| 256 | + | off += 1 | |
| 257 | + | for i := range v.AllowedDepths { | |
| 258 | + | off += v.AllowedDepths[i].Size() | |
| 259 | + | } | |
| 260 | + | return off | |
| 261 | + | } | |
| 262 | + | func (v Screen) Put(p []byte) { | |
| 263 | + | off := 0 | |
| 264 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.Root)) | |
| 265 | + | off += 4 | |
| 266 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.DefaultColormap)) | |
| 267 | + | off += 4 | |
| 268 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.WhitePixel)) | |
| 269 | + | off += 4 | |
| 270 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.BlackPixel)) | |
| 271 | + | off += 4 | |
| 272 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.CurrentInputMasks)) | |
| 273 | + | off += 4 | |
| 274 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.WidthInPixels)) | |
| 275 | + | off += 2 | |
| 276 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.HeightInPixels)) | |
| 277 | + | off += 2 | |
| 278 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.WidthInMillimeters)) | |
| 279 | + | off += 2 | |
| 280 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.HeightInMillimeters)) | |
| 281 | + | off += 2 | |
| 282 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.MinInstalledMaps)) | |
| 283 | + | off += 2 | |
| 284 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.MaxInstalledMaps)) | |
| 285 | + | off += 2 | |
| 286 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.RootVisual)) | |
| 287 | + | off += 4 | |
| 288 | + | p[off:][0] = byte(v.BackingStores) | |
| 289 | + | off += 1 | |
| 290 | + | if v.SaveUnders { | |
| 291 | + | p[off:][0] = 1 | |
| 292 | + | } else { | |
| 293 | + | p[off:][0] = 0 | |
| 294 | + | } | |
| 295 | + | off += 1 | |
| 296 | + | p[off:][0] = byte(v.RootDepth) | |
| 297 | + | off += 1 | |
| 298 | + | p[off:][0] = byte(v.AllowedDepthsLen) | |
| 299 | + | off += 1 | |
| 300 | + | for i := range v.AllowedDepths { | |
| 301 | + | v.AllowedDepths[i].Put(p[off:]) | |
| 302 | + | off += v.AllowedDepths[i].Size() | |
| 303 | + | } | |
| 304 | + | } | |
| 305 | + | ||
| 306 | + | type SetupRequest struct { | |
| 307 | + | ByteOrder uint8 | |
| 308 | + | ProtocolMajorVersion uint16 | |
| 309 | + | ProtocolMinorVersion uint16 | |
| 310 | + | AuthorizationProtocolNameLen uint16 | |
| 311 | + | AuthorizationProtocolDataLen uint16 | |
| 312 | + | AuthorizationProtocolName string | |
| 313 | + | AuthorizationProtocolData string | |
| 314 | + | } | |
| 315 | + | ||
| 316 | + | const SetupRequestSize = 12 | |
| 317 | + | ||
| 318 | + | func (v SetupRequest) Size() int { | |
| 319 | + | off := 0 | |
| 320 | + | off += 1 | |
| 321 | + | off += 1 | |
| 322 | + | off += 2 | |
| 323 | + | off += 2 | |
| 324 | + | off += 2 | |
| 325 | + | off += 2 | |
| 326 | + | off += 2 | |
| 327 | + | off += len(v.AuthorizationProtocolName) * 1 | |
| 328 | + | off = (off + 3) &^ 3 | |
| 329 | + | off += len(v.AuthorizationProtocolData) * 1 | |
| 330 | + | off = (off + 3) &^ 3 | |
| 331 | + | return off | |
| 332 | + | } | |
| 333 | + | func (v SetupRequest) Put(p []byte) { | |
| 334 | + | off := 0 | |
| 335 | + | p[off:][0] = byte(v.ByteOrder) | |
| 336 | + | off += 1 | |
| 337 | + | clear(p[off : off+1]) | |
| 338 | + | off += 1 | |
| 339 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMajorVersion)) | |
| 340 | + | off += 2 | |
| 341 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMinorVersion)) | |
| 342 | + | off += 2 | |
| 343 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.AuthorizationProtocolNameLen)) | |
| 344 | + | off += 2 | |
| 345 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.AuthorizationProtocolDataLen)) | |
| 346 | + | off += 2 | |
| 347 | + | clear(p[off : off+2]) | |
| 348 | + | off += 2 | |
| 349 | + | for i := range v.AuthorizationProtocolName { | |
| 350 | + | p[off+i*1:][0] = byte(v.AuthorizationProtocolName[i]) | |
| 351 | + | } | |
| 352 | + | off += len(v.AuthorizationProtocolName) * 1 | |
| 353 | + | { | |
| 354 | + | next := (off + 3) &^ 3 | |
| 355 | + | clear(p[off:next]) | |
| 356 | + | off = next | |
| 357 | + | } | |
| 358 | + | for i := range v.AuthorizationProtocolData { | |
| 359 | + | p[off+i*1:][0] = byte(v.AuthorizationProtocolData[i]) | |
| 360 | + | } | |
| 361 | + | off += len(v.AuthorizationProtocolData) * 1 | |
| 362 | + | { | |
| 363 | + | next := (off + 3) &^ 3 | |
| 364 | + | clear(p[off:next]) | |
| 365 | + | off = next | |
| 366 | + | } | |
| 367 | + | } | |
| 368 | + | ||
| 369 | + | type SetupFailed struct { | |
| 370 | + | Status uint8 | |
| 371 | + | ReasonLen uint8 | |
| 372 | + | ProtocolMajorVersion uint16 | |
| 373 | + | ProtocolMinorVersion uint16 | |
| 374 | + | Length uint16 | |
| 375 | + | Reason string | |
| 376 | + | } | |
| 377 | + | ||
| 378 | + | const SetupFailedSize = 8 | |
| 379 | + | ||
| 380 | + | func (v SetupFailed) Size() int { | |
| 381 | + | off := 0 | |
| 382 | + | off += 1 | |
| 383 | + | off += 1 | |
| 384 | + | off += 2 | |
| 385 | + | off += 2 | |
| 386 | + | off += 2 | |
| 387 | + | off += len(v.Reason) * 1 | |
| 388 | + | return off | |
| 389 | + | } | |
| 390 | + | func (v SetupFailed) Put(p []byte) { | |
| 391 | + | off := 0 | |
| 392 | + | p[off:][0] = byte(v.Status) | |
| 393 | + | off += 1 | |
| 394 | + | p[off:][0] = byte(v.ReasonLen) | |
| 395 | + | off += 1 | |
| 396 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMajorVersion)) | |
| 397 | + | off += 2 | |
| 398 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMinorVersion)) | |
| 399 | + | off += 2 | |
| 400 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.Length)) | |
| 401 | + | off += 2 | |
| 402 | + | for i := range v.Reason { | |
| 403 | + | p[off+i*1:][0] = byte(v.Reason[i]) | |
| 404 | + | } | |
| 405 | + | off += len(v.Reason) * 1 | |
| 406 | + | } | |
| 407 | + | ||
| 408 | + | type SetupAuthenticate struct { | |
| 409 | + | Status uint8 | |
| 410 | + | Length uint16 | |
| 411 | + | Reason string | |
| 412 | + | } | |
| 413 | + | ||
| 414 | + | const SetupAuthenticateSize = 8 | |
| 415 | + | ||
| 416 | + | func (v SetupAuthenticate) Size() int { | |
| 417 | + | off := 0 | |
| 418 | + | off += 1 | |
| 419 | + | off += 5 | |
| 420 | + | off += 2 | |
| 421 | + | off += len(v.Reason) * 1 | |
| 422 | + | return off | |
| 423 | + | } | |
| 424 | + | func (v SetupAuthenticate) Put(p []byte) { | |
| 425 | + | off := 0 | |
| 426 | + | p[off:][0] = byte(v.Status) | |
| 427 | + | off += 1 | |
| 428 | + | clear(p[off : off+5]) | |
| 429 | + | off += 5 | |
| 430 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.Length)) | |
| 431 | + | off += 2 | |
| 432 | + | for i := range v.Reason { | |
| 433 | + | p[off+i*1:][0] = byte(v.Reason[i]) | |
| 434 | + | } | |
| 435 | + | off += len(v.Reason) * 1 | |
| 436 | + | } | |
| 437 | + | ||
| 438 | + | type Setup struct { | |
| 439 | + | Status uint8 | |
| 440 | + | ProtocolMajorVersion uint16 | |
| 441 | + | ProtocolMinorVersion uint16 | |
| 442 | + | Length uint16 | |
| 443 | + | ReleaseNumber uint32 | |
| 444 | + | ResourceIdBase uint32 | |
| 445 | + | ResourceIdMask uint32 | |
| 446 | + | MotionBufferSize uint32 | |
| 447 | + | VendorLen uint16 | |
| 448 | + | MaximumRequestLength uint16 | |
| 449 | + | RootsLen uint8 | |
| 450 | + | PixmapFormatsLen uint8 | |
| 451 | + | ImageByteOrder ImageOrder | |
| 452 | + | BitmapFormatBitOrder ImageOrder | |
| 453 | + | BitmapFormatScanlineUnit uint8 | |
| 454 | + | BitmapFormatScanlinePad uint8 | |
| 455 | + | MinKeycode Keycode | |
| 456 | + | MaxKeycode Keycode | |
| 457 | + | Vendor string | |
| 458 | + | PixmapFormats []Format | |
| 459 | + | Roots []Screen | |
| 460 | + | } | |
| 461 | + | ||
| 462 | + | const SetupSize = 40 | |
| 463 | + | ||
| 464 | + | func (v Setup) Size() int { | |
| 465 | + | off := 0 | |
| 466 | + | off += 1 | |
| 467 | + | off += 1 | |
| 468 | + | off += 2 | |
| 469 | + | off += 2 | |
| 470 | + | off += 2 | |
| 471 | + | off += 4 | |
| 472 | + | off += 4 | |
| 473 | + | off += 4 | |
| 474 | + | off += 4 | |
| 475 | + | off += 2 | |
| 476 | + | off += 2 | |
| 477 | + | off += 1 | |
| 478 | + | off += 1 | |
| 479 | + | off += 1 | |
| 480 | + | off += 1 | |
| 481 | + | off += 1 | |
| 482 | + | off += 1 | |
| 483 | + | off += 1 | |
| 484 | + | off += 1 | |
| 485 | + | off += 4 | |
| 486 | + | off += len(v.Vendor) * 1 | |
| 487 | + | off = (off + 3) &^ 3 | |
| 488 | + | off += len(v.PixmapFormats) * 8 | |
| 489 | + | for i := range v.Roots { | |
| 490 | + | off += v.Roots[i].Size() | |
| 491 | + | } | |
| 492 | + | return off | |
| 493 | + | } | |
| 494 | + | func (v Setup) Put(p []byte) { | |
| 495 | + | off := 0 | |
| 496 | + | p[off:][0] = byte(v.Status) | |
| 497 | + | off += 1 | |
| 498 | + | clear(p[off : off+1]) | |
| 499 | + | off += 1 | |
| 500 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMajorVersion)) | |
| 501 | + | off += 2 | |
| 502 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMinorVersion)) | |
| 503 | + | off += 2 | |
| 504 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.Length)) | |
| 505 | + | off += 2 | |
| 506 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.ReleaseNumber)) | |
| 507 | + | off += 4 | |
| 508 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.ResourceIdBase)) | |
| 509 | + | off += 4 | |
| 510 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.ResourceIdMask)) | |
| 511 | + | off += 4 | |
| 512 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.MotionBufferSize)) | |
| 513 | + | off += 4 | |
| 514 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.VendorLen)) | |
| 515 | + | off += 2 | |
| 516 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.MaximumRequestLength)) | |
| 517 | + | off += 2 | |
| 518 | + | p[off:][0] = byte(v.RootsLen) | |
| 519 | + | off += 1 | |
| 520 | + | p[off:][0] = byte(v.PixmapFormatsLen) | |
| 521 | + | off += 1 | |
| 522 | + | p[off:][0] = byte(v.ImageByteOrder) | |
| 523 | + | off += 1 | |
| 524 | + | p[off:][0] = byte(v.BitmapFormatBitOrder) | |
| 525 | + | off += 1 | |
| 526 | + | p[off:][0] = byte(v.BitmapFormatScanlineUnit) | |
| 527 | + | off += 1 | |
| 528 | + | p[off:][0] = byte(v.BitmapFormatScanlinePad) | |
| 529 | + | off += 1 | |
| 530 | + | p[off:][0] = byte(v.MinKeycode) | |
| 531 | + | off += 1 | |
| 532 | + | p[off:][0] = byte(v.MaxKeycode) | |
| 533 | + | off += 1 | |
| 534 | + | clear(p[off : off+4]) | |
| 535 | + | off += 4 | |
| 536 | + | for i := range v.Vendor { | |
| 537 | + | p[off+i*1:][0] = byte(v.Vendor[i]) | |
| 538 | + | } | |
| 539 | + | off += len(v.Vendor) * 1 | |
| 540 | + | { | |
| 541 | + | next := (off + 3) &^ 3 | |
| 542 | + | clear(p[off:next]) | |
| 543 | + | off = next | |
| 544 | + | } | |
| 545 | + | for i := range v.PixmapFormats { | |
| 546 | + | v.PixmapFormats[i].Put(p[off+i*8:]) | |
| 547 | + | } | |
| 548 | + | off += len(v.PixmapFormats) * 8 | |
| 549 | + | for i := range v.Roots { | |
| 550 | + | v.Roots[i].Put(p[off:]) | |
| 551 | + | off += v.Roots[i].Size() | |
| 552 | + | } | |
| 553 | + | } | |
| 554 | + | ||
| 555 | + | type ClientMessageData struct{ raw []byte } | |
| 556 | + | ||
| 557 | + | const ClientMessageDataSize = 20 | |
| 558 | + | ||
| 559 | + | func GetClientMessageData(p []byte) ClientMessageData { return ClientMessageData{raw: p[:20]} } | |
| 560 | + | func (v ClientMessageData) Put(p []byte) { copy(p[:20], v.raw) } | |
| 561 | + | func (v ClientMessageData) Data8() (out [20]uint8) { | |
| 562 | + | for i := range out { | |
| 563 | + | out[i] = uint8(v.raw[i*1:][0]) | |
| 564 | + | } | |
| 565 | + | return | |
| 566 | + | } | |
| 567 | + | func (v ClientMessageData) Data16() (out [10]uint16) { | |
| 568 | + | for i := range out { | |
| 569 | + | out[i] = uint16(binary.LittleEndian.Uint16(v.raw[i*2:])) | |
| 570 | + | } | |
| 571 | + | return | |
| 572 | + | } | |
| 573 | + | func (v ClientMessageData) Data32() (out [5]uint32) { | |
| 574 | + | for i := range out { | |
| 575 | + | out[i] = uint32(binary.LittleEndian.Uint32(v.raw[i*4:])) | |
| 576 | + | } | |
| 577 | + | return | |
| 578 | + | } | |
| 579 | + | ||
| 580 | + | type Timecoord struct { | |
| 581 | + | Time Timestamp | |
| 582 | + | X int16 | |
| 583 | + | Y int16 | |
| 584 | + | } | |
| 585 | + | ||
| 586 | + | const TimecoordSize = 8 | |
| 587 | + | ||
| 588 | + | func (v Timecoord) Put(p []byte) { | |
| 589 | + | clear(p[:8]) | |
| 590 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.Time)) | |
| 591 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.X)) | |
| 592 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Y)) | |
| 593 | + | } | |
| 594 | + | func GetTimecoord(p []byte) (v Timecoord) { | |
| 595 | + | _ = p[7] | |
| 596 | + | v.Time = Timestamp(binary.LittleEndian.Uint32(p[0:])) | |
| 597 | + | v.X = int16(binary.LittleEndian.Uint16(p[4:])) | |
| 598 | + | v.Y = int16(binary.LittleEndian.Uint16(p[6:])) | |
| 599 | + | return | |
| 600 | + | } | |
| 601 | + | ||
| 602 | + | type Fontprop struct { | |
| 603 | + | Name Atom | |
| 604 | + | Value uint32 | |
| 605 | + | } | |
| 606 | + | ||
| 607 | + | const FontpropSize = 8 | |
| 608 | + | ||
| 609 | + | func (v Fontprop) Put(p []byte) { | |
| 610 | + | clear(p[:8]) | |
| 611 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.Name)) | |
| 612 | + | binary.LittleEndian.PutUint32(p[4:], uint32(v.Value)) | |
| 613 | + | } | |
| 614 | + | func GetFontprop(p []byte) (v Fontprop) { | |
| 615 | + | _ = p[7] | |
| 616 | + | v.Name = Atom(binary.LittleEndian.Uint32(p[0:])) | |
| 617 | + | v.Value = uint32(binary.LittleEndian.Uint32(p[4:])) | |
| 618 | + | return | |
| 619 | + | } | |
| 620 | + | ||
| 621 | + | type Charinfo struct { | |
| 622 | + | LeftSideBearing int16 | |
| 623 | + | RightSideBearing int16 | |
| 624 | + | CharacterWidth int16 | |
| 625 | + | Ascent int16 | |
| 626 | + | Descent int16 | |
| 627 | + | Attributes uint16 | |
| 628 | + | } | |
| 629 | + | ||
| 630 | + | const CharinfoSize = 12 | |
| 631 | + | ||
| 632 | + | func (v Charinfo) Put(p []byte) { | |
| 633 | + | clear(p[:12]) | |
| 634 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.LeftSideBearing)) | |
| 635 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.RightSideBearing)) | |
| 636 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.CharacterWidth)) | |
| 637 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Ascent)) | |
| 638 | + | binary.LittleEndian.PutUint16(p[8:], uint16(v.Descent)) | |
| 639 | + | binary.LittleEndian.PutUint16(p[10:], uint16(v.Attributes)) | |
| 640 | + | } | |
| 641 | + | func GetCharinfo(p []byte) (v Charinfo) { | |
| 642 | + | _ = p[11] | |
| 643 | + | v.LeftSideBearing = int16(binary.LittleEndian.Uint16(p[0:])) | |
| 644 | + | v.RightSideBearing = int16(binary.LittleEndian.Uint16(p[2:])) | |
| 645 | + | v.CharacterWidth = int16(binary.LittleEndian.Uint16(p[4:])) | |
| 646 | + | v.Ascent = int16(binary.LittleEndian.Uint16(p[6:])) | |
| 647 | + | v.Descent = int16(binary.LittleEndian.Uint16(p[8:])) | |
| 648 | + | v.Attributes = uint16(binary.LittleEndian.Uint16(p[10:])) | |
| 649 | + | return | |
| 650 | + | } | |
| 651 | + | ||
| 652 | + | type Str struct { | |
| 653 | + | NameLen uint8 | |
| 654 | + | Name string | |
| 655 | + | } | |
| 656 | + | ||
| 657 | + | const StrSize = 1 | |
| 658 | + | ||
| 659 | + | func (v Str) Size() int { off := 0; off += 1; off += len(v.Name) * 1; return off } | |
| 660 | + | func (v Str) Put(p []byte) { | |
| 661 | + | off := 0 | |
| 662 | + | p[off:][0] = byte(v.NameLen) | |
| 663 | + | off += 1 | |
| 664 | + | for i := range v.Name { | |
| 665 | + | p[off+i*1:][0] = byte(v.Name[i]) | |
| 666 | + | } | |
| 667 | + | off += len(v.Name) * 1 | |
| 668 | + | } | |
| 669 | + | ||
| 670 | + | type Segment struct { | |
| 671 | + | X1 int16 | |
| 672 | + | Y1 int16 | |
| 673 | + | X2 int16 | |
| 674 | + | Y2 int16 | |
| 675 | + | } | |
| 676 | + | ||
| 677 | + | const SegmentSize = 8 | |
| 678 | + | ||
| 679 | + | func (v Segment) Put(p []byte) { | |
| 680 | + | clear(p[:8]) | |
| 681 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X1)) | |
| 682 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y1)) | |
| 683 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.X2)) | |
| 684 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Y2)) | |
| 685 | + | } | |
| 686 | + | func GetSegment(p []byte) (v Segment) { | |
| 687 | + | _ = p[7] | |
| 688 | + | v.X1 = int16(binary.LittleEndian.Uint16(p[0:])) | |
| 689 | + | v.Y1 = int16(binary.LittleEndian.Uint16(p[2:])) | |
| 690 | + | v.X2 = int16(binary.LittleEndian.Uint16(p[4:])) | |
| 691 | + | v.Y2 = int16(binary.LittleEndian.Uint16(p[6:])) | |
| 692 | + | return | |
| 693 | + | } | |
| 694 | + | ||
| 695 | + | type Coloritem struct { | |
| 696 | + | Pixel uint32 | |
| 697 | + | Red uint16 | |
| 698 | + | Green uint16 | |
| 699 | + | Blue uint16 | |
| 700 | + | Flags ColorFlag | |
| 701 | + | } | |
| 702 | + | ||
| 703 | + | const ColoritemSize = 12 | |
| 704 | + | ||
| 705 | + | func (v Coloritem) Put(p []byte) { | |
| 706 | + | clear(p[:12]) | |
| 707 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.Pixel)) | |
| 708 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Red)) | |
| 709 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Green)) | |
| 710 | + | binary.LittleEndian.PutUint16(p[8:], uint16(v.Blue)) | |
| 711 | + | p[10:][0] = byte(v.Flags) | |
| 712 | + | } | |
| 713 | + | func GetColoritem(p []byte) (v Coloritem) { | |
| 714 | + | _ = p[11] | |
| 715 | + | v.Pixel = uint32(binary.LittleEndian.Uint32(p[0:])) | |
| 716 | + | v.Red = uint16(binary.LittleEndian.Uint16(p[4:])) | |
| 717 | + | v.Green = uint16(binary.LittleEndian.Uint16(p[6:])) | |
| 718 | + | v.Blue = uint16(binary.LittleEndian.Uint16(p[8:])) | |
| 719 | + | v.Flags = ColorFlag(p[10:][0]) | |
| 720 | + | return | |
| 721 | + | } | |
| 722 | + | ||
| 723 | + | type Rgb struct { | |
| 724 | + | Red uint16 | |
| 725 | + | Green uint16 | |
| 726 | + | Blue uint16 | |
| 727 | + | } | |
| 728 | + | ||
| 729 | + | const RgbSize = 8 | |
| 730 | + | ||
| 731 | + | func (v Rgb) Put(p []byte) { | |
| 732 | + | clear(p[:8]) | |
| 733 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.Red)) | |
| 734 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Green)) | |
| 735 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Blue)) | |
| 736 | + | } | |
| 737 | + | func GetRgb(p []byte) (v Rgb) { | |
| 738 | + | _ = p[7] | |
| 739 | + | v.Red = uint16(binary.LittleEndian.Uint16(p[0:])) | |
| 740 | + | v.Green = uint16(binary.LittleEndian.Uint16(p[2:])) | |
| 741 | + | v.Blue = uint16(binary.LittleEndian.Uint16(p[4:])) | |
| 742 | + | return | |
| 743 | + | } | |
| 744 | + | ||
| 745 | + | type Host struct { | |
| 746 | + | Family Family | |
| 747 | + | AddressLen uint16 | |
| 748 | + | Address []byte | |
| 749 | + | } | |
| 750 | + | ||
| 751 | + | const HostSize = 4 | |
| 752 | + | ||
| 753 | + | func (v Host) Size() int { | |
| 754 | + | off := 0 | |
| 755 | + | off += 1 | |
| 756 | + | off += 1 | |
| 757 | + | off += 2 | |
| 758 | + | off += len(v.Address) * 1 | |
| 759 | + | off = (off + 3) &^ 3 | |
| 760 | + | return off | |
| 761 | + | } | |
| 762 | + | func (v Host) Put(p []byte) { | |
| 763 | + | off := 0 | |
| 764 | + | p[off:][0] = byte(v.Family) | |
| 765 | + | off += 1 | |
| 766 | + | clear(p[off : off+1]) | |
| 767 | + | off += 1 | |
| 768 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.AddressLen)) | |
| 769 | + | off += 2 | |
| 770 | + | for i := range v.Address { | |
| 771 | + | p[off+i*1:][0] = byte(v.Address[i]) | |
| 772 | + | } | |
| 773 | + | off += len(v.Address) * 1 | |
| 774 | + | { | |
| 775 | + | next := (off + 3) &^ 3 | |
| 776 | + | clear(p[off:next]) | |
| 777 | + | off = next | |
| 778 | + | } | |
| 779 | + | } | |
| 780 | + | ||
| 781 | + | type VisualClass uint8 | |
| 782 | + | ||
| 783 | + | const VisualClassStaticGray VisualClass = 0 | |
| 784 | + | const VisualClassGrayScale VisualClass = 1 | |
| 785 | + | const VisualClassStaticColor VisualClass = 2 | |
| 786 | + | const VisualClassPseudoColor VisualClass = 3 | |
| 787 | + | const VisualClassTrueColor VisualClass = 4 | |
| 788 | + | const VisualClassDirectColor VisualClass = 5 | |
| 789 | + | ||
| 790 | + | type EventMask uint32 | |
| 791 | + | ||
| 792 | + | const EventMaskNoEvent EventMask = 0 | |
| 793 | + | const EventMaskKeyPress EventMask = 1 | |
| 794 | + | const EventMaskKeyRelease EventMask = 2 | |
| 795 | + | const EventMaskButtonPress EventMask = 4 | |
| 796 | + | const EventMaskButtonRelease EventMask = 8 | |
| 797 | + | const EventMaskEnterWindow EventMask = 16 | |
| 798 | + | const EventMaskLeaveWindow EventMask = 32 | |
| 799 | + | const EventMaskPointerMotion EventMask = 64 | |
| 800 | + | const EventMaskPointerMotionHint EventMask = 128 | |
| 801 | + | const EventMaskButton1Motion EventMask = 256 | |
| 802 | + | const EventMaskButton2Motion EventMask = 512 | |
| 803 | + | const EventMaskButton3Motion EventMask = 1024 | |
| 804 | + | const EventMaskButton4Motion EventMask = 2048 | |
| 805 | + | const EventMaskButton5Motion EventMask = 4096 | |
| 806 | + | const EventMaskButtonMotion EventMask = 8192 | |
| 807 | + | const EventMaskKeymapState EventMask = 16384 | |
| 808 | + | const EventMaskExposure EventMask = 32768 | |
| 809 | + | const EventMaskVisibilityChange EventMask = 65536 | |
| 810 | + | const EventMaskStructureNotify EventMask = 131072 | |
| 811 | + | const EventMaskResizeRedirect EventMask = 262144 | |
| 812 | + | const EventMaskSubstructureNotify EventMask = 524288 | |
| 813 | + | const EventMaskSubstructureRedirect EventMask = 1048576 | |
| 814 | + | const EventMaskFocusChange EventMask = 2097152 | |
| 815 | + | const EventMaskPropertyChange EventMask = 4194304 | |
| 816 | + | const EventMaskColorMapChange EventMask = 8388608 | |
| 817 | + | const EventMaskOwnerGrabButton EventMask = 16777216 | |
| 818 | + | ||
| 819 | + | type BackingStore uint32 | |
| 820 | + | ||
| 821 | + | const BackingStoreNotUseful BackingStore = 0 | |
| 822 | + | const BackingStoreWhenMapped BackingStore = 1 | |
| 823 | + | const BackingStoreAlways BackingStore = 2 | |
| 824 | + | ||
| 825 | + | type ImageOrder uint8 | |
| 826 | + | ||
| 827 | + | const ImageOrderLSBFirst ImageOrder = 0 | |
| 828 | + | const ImageOrderMSBFirst ImageOrder = 1 | |
| 829 | + | ||
| 830 | + | type ModMask uint16 | |
| 831 | + | ||
| 832 | + | const ModMaskShift ModMask = 1 | |
| 833 | + | const ModMaskLock ModMask = 2 | |
| 834 | + | const ModMaskControl ModMask = 4 | |
| 835 | + | const ModMaskX1 ModMask = 8 | |
| 836 | + | const ModMaskX2 ModMask = 16 | |
| 837 | + | const ModMaskX3 ModMask = 32 | |
| 838 | + | const ModMaskX4 ModMask = 64 | |
| 839 | + | const ModMaskX5 ModMask = 128 | |
| 840 | + | const ModMaskAny ModMask = 32768 | |
| 841 | + | ||
| 842 | + | type KeyButMask uint16 | |
| 843 | + | ||
| 844 | + | const KeyButMaskShift KeyButMask = 1 | |
| 845 | + | const KeyButMaskLock KeyButMask = 2 | |
| 846 | + | const KeyButMaskControl KeyButMask = 4 | |
| 847 | + | const KeyButMaskMod1 KeyButMask = 8 | |
| 848 | + | const KeyButMaskMod2 KeyButMask = 16 | |
| 849 | + | const KeyButMaskMod3 KeyButMask = 32 | |
| 850 | + | const KeyButMaskMod4 KeyButMask = 64 | |
| 851 | + | const KeyButMaskMod5 KeyButMask = 128 | |
| 852 | + | const KeyButMaskButton1 KeyButMask = 256 | |
| 853 | + | const KeyButMaskButton2 KeyButMask = 512 | |
| 854 | + | const KeyButMaskButton3 KeyButMask = 1024 | |
| 855 | + | const KeyButMaskButton4 KeyButMask = 2048 | |
| 856 | + | const KeyButMaskButton5 KeyButMask = 4096 | |
| 857 | + | ||
| 858 | + | const WindowNone Window = 0 | |
| 859 | + | ||
| 860 | + | type ButtonMask uint32 | |
| 861 | + | ||
| 862 | + | const ButtonMaskX1 ButtonMask = 256 | |
| 863 | + | const ButtonMaskX2 ButtonMask = 512 | |
| 864 | + | const ButtonMaskX3 ButtonMask = 1024 | |
| 865 | + | const ButtonMaskX4 ButtonMask = 2048 | |
| 866 | + | const ButtonMaskX5 ButtonMask = 4096 | |
| 867 | + | const ButtonMaskAny ButtonMask = 32768 | |
| 868 | + | ||
| 869 | + | type Motion uint8 | |
| 870 | + | ||
| 871 | + | const MotionNormal Motion = 0 | |
| 872 | + | const MotionHint Motion = 1 | |
| 873 | + | ||
| 874 | + | type NotifyDetail uint8 | |
| 875 | + | ||
| 876 | + | const NotifyDetailAncestor NotifyDetail = 0 | |
| 877 | + | const NotifyDetailVirtual NotifyDetail = 1 | |
| 878 | + | const NotifyDetailInferior NotifyDetail = 2 | |
| 879 | + | const NotifyDetailNonlinear NotifyDetail = 3 | |
| 880 | + | const NotifyDetailNonlinearVirtual NotifyDetail = 4 | |
| 881 | + | const NotifyDetailPointer NotifyDetail = 5 | |
| 882 | + | const NotifyDetailPointerRoot NotifyDetail = 6 | |
| 883 | + | const NotifyDetailNone NotifyDetail = 7 | |
| 884 | + | ||
| 885 | + | type NotifyMode uint8 | |
| 886 | + | ||
| 887 | + | const NotifyModeNormal NotifyMode = 0 | |
| 888 | + | const NotifyModeGrab NotifyMode = 1 | |
| 889 | + | const NotifyModeUngrab NotifyMode = 2 | |
| 890 | + | const NotifyModeWhileGrabbed NotifyMode = 3 | |
| 891 | + | ||
| 892 | + | type Visibility uint8 | |
| 893 | + | ||
| 894 | + | const VisibilityUnobscured Visibility = 0 | |
| 895 | + | const VisibilityPartiallyObscured Visibility = 1 | |
| 896 | + | const VisibilityFullyObscured Visibility = 2 | |
| 897 | + | ||
| 898 | + | type Place uint8 | |
| 899 | + | ||
| 900 | + | const PlaceOnTop Place = 0 | |
| 901 | + | const PlaceOnBottom Place = 1 | |
| 902 | + | ||
| 903 | + | type Property uint8 | |
| 904 | + | ||
| 905 | + | const PropertyNewValue Property = 0 | |
| 906 | + | const PropertyDelete Property = 1 | |
| 907 | + | ||
| 908 | + | type Time uint32 | |
| 909 | + | ||
| 910 | + | const TimeCurrentTime Time = 0 | |
| 911 | + | ||
| 912 | + | const AtomNone Atom = 0 | |
| 913 | + | const AtomAny Atom = 0 | |
| 914 | + | const AtomPrimary Atom = 1 | |
| 915 | + | const AtomSecondary Atom = 2 | |
| 916 | + | const AtomArc Atom = 3 | |
| 917 | + | const AtomAtom Atom = 4 | |
| 918 | + | const AtomBitmap Atom = 5 | |
| 919 | + | const AtomCardinal Atom = 6 | |
| 920 | + | const AtomColormap Atom = 7 | |
| 921 | + | const AtomCursor Atom = 8 | |
| 922 | + | const AtomCutBuffer0 Atom = 9 | |
| 923 | + | const AtomCutBuffer1 Atom = 10 | |
| 924 | + | const AtomCutBuffer2 Atom = 11 | |
| 925 | + | const AtomCutBuffer3 Atom = 12 | |
| 926 | + | const AtomCutBuffer4 Atom = 13 | |
| 927 | + | const AtomCutBuffer5 Atom = 14 | |
| 928 | + | const AtomCutBuffer6 Atom = 15 | |
| 929 | + | const AtomCutBuffer7 Atom = 16 | |
| 930 | + | const AtomDrawable Atom = 17 | |
| 931 | + | const AtomFont Atom = 18 | |
| 932 | + | const AtomInteger Atom = 19 | |
| 933 | + | const AtomPixmap Atom = 20 | |
| 934 | + | const AtomPoint Atom = 21 | |
| 935 | + | const AtomRectangle Atom = 22 | |
| 936 | + | const AtomResourceManager Atom = 23 | |
| 937 | + | const AtomRgbColorMap Atom = 24 | |
| 938 | + | const AtomRgbBestMap Atom = 25 | |
| 939 | + | const AtomRgbBlueMap Atom = 26 | |
| 940 | + | const AtomRgbDefaultMap Atom = 27 | |
| 941 | + | const AtomRgbGrayMap Atom = 28 | |
| 942 | + | const AtomRgbGreenMap Atom = 29 | |
| 943 | + | const AtomRgbRedMap Atom = 30 | |
| 944 | + | const AtomString Atom = 31 | |
| 945 | + | const AtomVisualid Atom = 32 | |
| 946 | + | const AtomWindow Atom = 33 | |
| 947 | + | const AtomWmCommand Atom = 34 | |
| 948 | + | const AtomWmHints Atom = 35 | |
| 949 | + | const AtomWmClientMachine Atom = 36 | |
| 950 | + | const AtomWmIconName Atom = 37 | |
| 951 | + | const AtomWmIconSize Atom = 38 | |
| 952 | + | const AtomWmName Atom = 39 | |
| 953 | + | const AtomWmNormalHints Atom = 40 | |
| 954 | + | const AtomWmSizeHints Atom = 41 | |
| 955 | + | const AtomWmZoomHints Atom = 42 | |
| 956 | + | const AtomMinSpace Atom = 43 | |
| 957 | + | const AtomNormSpace Atom = 44 | |
| 958 | + | const AtomMaxSpace Atom = 45 | |
| 959 | + | const AtomEndSpace Atom = 46 | |
| 960 | + | const AtomSuperscriptX Atom = 47 | |
| 961 | + | const AtomSuperscriptY Atom = 48 | |
| 962 | + | const AtomSubscriptX Atom = 49 | |
| 963 | + | const AtomSubscriptY Atom = 50 | |
| 964 | + | const AtomUnderlinePosition Atom = 51 | |
| 965 | + | const AtomUnderlineThickness Atom = 52 | |
| 966 | + | const AtomStrikeoutAscent Atom = 53 | |
| 967 | + | const AtomStrikeoutDescent Atom = 54 | |
| 968 | + | const AtomItalicAngle Atom = 55 | |
| 969 | + | const AtomXHeight Atom = 56 | |
| 970 | + | const AtomQuadWidth Atom = 57 | |
| 971 | + | const AtomWeight Atom = 58 | |
| 972 | + | const AtomPointSize Atom = 59 | |
| 973 | + | const AtomResolution Atom = 60 | |
| 974 | + | const AtomCopyright Atom = 61 | |
| 975 | + | const AtomNotice Atom = 62 | |
| 976 | + | const AtomFontName Atom = 63 | |
| 977 | + | const AtomFamilyName Atom = 64 | |
| 978 | + | const AtomFullName Atom = 65 | |
| 979 | + | const AtomCapHeight Atom = 66 | |
| 980 | + | const AtomWmClass Atom = 67 | |
| 981 | + | const AtomWmTransientFor Atom = 68 | |
| 982 | + | ||
| 983 | + | type ColormapState uint8 | |
| 984 | + | ||
| 985 | + | const ColormapStateUninstalled ColormapState = 0 | |
| 986 | + | const ColormapStateInstalled ColormapState = 1 | |
| 987 | + | ||
| 988 | + | const ColormapNone Colormap = 0 | |
| 989 | + | ||
| 990 | + | type Mapping uint8 | |
| 991 | + | ||
| 992 | + | const MappingModifier Mapping = 0 | |
| 993 | + | const MappingKeyboard Mapping = 1 | |
| 994 | + | const MappingPointer Mapping = 2 | |
| 995 | + | ||
| 996 | + | type WindowClass uint16 | |
| 997 | + | ||
| 998 | + | const WindowClassCopyFromParent WindowClass = 0 | |
| 999 | + | const WindowClassInputOutput WindowClass = 1 | |
| 1000 | + | const WindowClassInputOnly WindowClass = 2 | |
| 1001 | + | ||
| 1002 | + | type Cw uint32 | |
| 1003 | + | ||
| 1004 | + | const CwBackPixmap Cw = 1 | |
| 1005 | + | const CwBackPixel Cw = 2 | |
| 1006 | + | const CwBorderPixmap Cw = 4 | |
| 1007 | + | const CwBorderPixel Cw = 8 | |
| 1008 | + | const CwBitGravity Cw = 16 | |
| 1009 | + | const CwWinGravity Cw = 32 | |
| 1010 | + | const CwBackingStore Cw = 64 | |
| 1011 | + | const CwBackingPlanes Cw = 128 | |
| 1012 | + | const CwBackingPixel Cw = 256 | |
| 1013 | + | const CwOverrideRedirect Cw = 512 | |
| 1014 | + | const CwSaveUnder Cw = 1024 | |
| 1015 | + | const CwEventMask Cw = 2048 | |
| 1016 | + | const CwDontPropagate Cw = 4096 | |
| 1017 | + | const CwColormap Cw = 8192 | |
| 1018 | + | const CwCursor Cw = 16384 | |
| 1019 | + | ||
| 1020 | + | type BackPixmap uint32 | |
| 1021 | + | ||
| 1022 | + | const BackPixmapNone BackPixmap = 0 | |
| 1023 | + | const BackPixmapParentRelative BackPixmap = 1 | |
| 1024 | + | ||
| 1025 | + | type Gravity uint32 | |
| 1026 | + | ||
| 1027 | + | const GravityBitForget Gravity = 0 | |
| 1028 | + | const GravityWinUnmap Gravity = 0 | |
| 1029 | + | const GravityNorthWest Gravity = 1 | |
| 1030 | + | const GravityNorth Gravity = 2 | |
| 1031 | + | const GravityNorthEast Gravity = 3 | |
| 1032 | + | const GravityWest Gravity = 4 | |
| 1033 | + | const GravityCenter Gravity = 5 | |
| 1034 | + | const GravityEast Gravity = 6 | |
| 1035 | + | const GravitySouthWest Gravity = 7 | |
| 1036 | + | const GravitySouth Gravity = 8 | |
| 1037 | + | const GravitySouthEast Gravity = 9 | |
| 1038 | + | const GravityStatic Gravity = 10 | |
| 1039 | + | ||
| 1040 | + | type MapState uint8 | |
| 1041 | + | ||
| 1042 | + | const MapStateUnmapped MapState = 0 | |
| 1043 | + | const MapStateUnviewable MapState = 1 | |
| 1044 | + | const MapStateViewable MapState = 2 | |
| 1045 | + | ||
| 1046 | + | type SetMode uint8 | |
| 1047 | + | ||
| 1048 | + | const SetModeInsert SetMode = 0 | |
| 1049 | + | const SetModeDelete SetMode = 1 | |
| 1050 | + | ||
| 1051 | + | type ConfigWindow uint16 | |
| 1052 | + | ||
| 1053 | + | const ConfigWindowX ConfigWindow = 1 | |
| 1054 | + | const ConfigWindowY ConfigWindow = 2 | |
| 1055 | + | const ConfigWindowWidth ConfigWindow = 4 | |
| 1056 | + | const ConfigWindowHeight ConfigWindow = 8 | |
| 1057 | + | const ConfigWindowBorderWidth ConfigWindow = 16 | |
| 1058 | + | const ConfigWindowSibling ConfigWindow = 32 | |
| 1059 | + | const ConfigWindowStackMode ConfigWindow = 64 | |
| 1060 | + | ||
| 1061 | + | type StackMode uint32 | |
| 1062 | + | ||
| 1063 | + | const StackModeAbove StackMode = 0 | |
| 1064 | + | const StackModeBelow StackMode = 1 | |
| 1065 | + | const StackModeTopIf StackMode = 2 | |
| 1066 | + | const StackModeBottomIf StackMode = 3 | |
| 1067 | + | const StackModeOpposite StackMode = 4 | |
| 1068 | + | ||
| 1069 | + | type Circulate uint8 | |
| 1070 | + | ||
| 1071 | + | const CirculateRaiseLowest Circulate = 0 | |
| 1072 | + | const CirculateLowerHighest Circulate = 1 | |
| 1073 | + | ||
| 1074 | + | type PropMode uint8 | |
| 1075 | + | ||
| 1076 | + | const PropModeReplace PropMode = 0 | |
| 1077 | + | const PropModePrepend PropMode = 1 | |
| 1078 | + | const PropModeAppend PropMode = 2 | |
| 1079 | + | ||
| 1080 | + | type GetPropertyType uint32 | |
| 1081 | + | ||
| 1082 | + | const GetPropertyTypeAny GetPropertyType = 0 | |
| 1083 | + | ||
| 1084 | + | type SendEventDest uint32 | |
| 1085 | + | ||
| 1086 | + | const SendEventDestPointerWindow SendEventDest = 0 | |
| 1087 | + | const SendEventDestItemFocus SendEventDest = 1 | |
| 1088 | + | ||
| 1089 | + | type GrabMode uint8 | |
| 1090 | + | ||
| 1091 | + | const GrabModeSync GrabMode = 0 | |
| 1092 | + | const GrabModeAsync GrabMode = 1 | |
| 1093 | + | ||
| 1094 | + | type GrabStatus uint8 | |
| 1095 | + | ||
| 1096 | + | const GrabStatusSuccess GrabStatus = 0 | |
| 1097 | + | const GrabStatusAlreadyGrabbed GrabStatus = 1 | |
| 1098 | + | const GrabStatusInvalidTime GrabStatus = 2 | |
| 1099 | + | const GrabStatusNotViewable GrabStatus = 3 | |
| 1100 | + | const GrabStatusFrozen GrabStatus = 4 | |
| 1101 | + | ||
| 1102 | + | const CursorNone Cursor = 0 | |
| 1103 | + | ||
| 1104 | + | type ButtonIndex uint8 | |
| 1105 | + | ||
| 1106 | + | const ButtonIndexAny ButtonIndex = 0 | |
| 1107 | + | const ButtonIndexX1 ButtonIndex = 1 | |
| 1108 | + | const ButtonIndexX2 ButtonIndex = 2 | |
| 1109 | + | const ButtonIndexX3 ButtonIndex = 3 | |
| 1110 | + | const ButtonIndexX4 ButtonIndex = 4 | |
| 1111 | + | const ButtonIndexX5 ButtonIndex = 5 | |
| 1112 | + | ||
| 1113 | + | type Grab uint8 | |
| 1114 | + | ||
| 1115 | + | const GrabAny Grab = 0 | |
| 1116 | + | ||
| 1117 | + | type Allow uint8 | |
| 1118 | + | ||
| 1119 | + | const AllowAsyncPointer Allow = 0 | |
| 1120 | + | const AllowSyncPointer Allow = 1 | |
| 1121 | + | const AllowReplayPointer Allow = 2 | |
| 1122 | + | const AllowAsyncKeyboard Allow = 3 | |
| 1123 | + | const AllowSyncKeyboard Allow = 4 | |
| 1124 | + | const AllowReplayKeyboard Allow = 5 | |
| 1125 | + | const AllowAsyncBoth Allow = 6 | |
| 1126 | + | const AllowSyncBoth Allow = 7 | |
| 1127 | + | ||
| 1128 | + | type InputFocus uint32 | |
| 1129 | + | ||
| 1130 | + | const InputFocusNone InputFocus = 0 | |
| 1131 | + | const InputFocusPointerRoot InputFocus = 1 | |
| 1132 | + | const InputFocusParent InputFocus = 2 | |
| 1133 | + | const InputFocusFollowKeyboard InputFocus = 3 | |
| 1134 | + | ||
| 1135 | + | type FontDraw uint8 | |
| 1136 | + | ||
| 1137 | + | const FontDrawLeftToRight FontDraw = 0 | |
| 1138 | + | const FontDrawRightToLeft FontDraw = 1 | |
| 1139 | + | ||
| 1140 | + | type Gc uint32 | |
| 1141 | + | ||
| 1142 | + | const GcFunction Gc = 1 | |
| 1143 | + | const GcPlaneMask Gc = 2 | |
| 1144 | + | const GcForeground Gc = 4 | |
| 1145 | + | const GcBackground Gc = 8 | |
| 1146 | + | const GcLineWidth Gc = 16 | |
| 1147 | + | const GcLineStyle Gc = 32 | |
| 1148 | + | const GcCapStyle Gc = 64 | |
| 1149 | + | const GcJoinStyle Gc = 128 | |
| 1150 | + | const GcFillStyle Gc = 256 | |
| 1151 | + | const GcFillRule Gc = 512 | |
| 1152 | + | const GcTile Gc = 1024 | |
| 1153 | + | const GcStipple Gc = 2048 | |
| 1154 | + | const GcTileStippleOriginX Gc = 4096 | |
| 1155 | + | const GcTileStippleOriginY Gc = 8192 | |
| 1156 | + | const GcFont Gc = 16384 | |
| 1157 | + | const GcSubwindowMode Gc = 32768 | |
| 1158 | + | const GcGraphicsExposures Gc = 65536 | |
| 1159 | + | const GcClipOriginX Gc = 131072 | |
| 1160 | + | const GcClipOriginY Gc = 262144 | |
| 1161 | + | const GcClipMask Gc = 524288 | |
| 1162 | + | const GcDashOffset Gc = 1048576 | |
| 1163 | + | const GcDashList Gc = 2097152 | |
| 1164 | + | const GcArcMode Gc = 4194304 | |
| 1165 | + | ||
| 1166 | + | type Gx uint32 | |
| 1167 | + | ||
| 1168 | + | const GxClear Gx = 0 | |
| 1169 | + | const GxAnd Gx = 1 | |
| 1170 | + | const GxAndReverse Gx = 2 | |
| 1171 | + | const GxCopy Gx = 3 | |
| 1172 | + | const GxAndInverted Gx = 4 | |
| 1173 | + | const GxNoop Gx = 5 | |
| 1174 | + | const GxXor Gx = 6 | |
| 1175 | + | const GxOr Gx = 7 | |
| 1176 | + | const GxNor Gx = 8 | |
| 1177 | + | const GxEquiv Gx = 9 | |
| 1178 | + | const GxInvert Gx = 10 | |
| 1179 | + | const GxOrReverse Gx = 11 | |
| 1180 | + | const GxCopyInverted Gx = 12 | |
| 1181 | + | const GxOrInverted Gx = 13 | |
| 1182 | + | const GxNand Gx = 14 | |
| 1183 | + | const GxSet Gx = 15 | |
| 1184 | + | ||
| 1185 | + | type LineStyle uint32 | |
| 1186 | + | ||
| 1187 | + | const LineStyleSolid LineStyle = 0 | |
| 1188 | + | const LineStyleOnOffDash LineStyle = 1 | |
| 1189 | + | const LineStyleDoubleDash LineStyle = 2 | |
| 1190 | + | ||
| 1191 | + | type CapStyle uint32 | |
| 1192 | + | ||
| 1193 | + | const CapStyleNotLast CapStyle = 0 | |
| 1194 | + | const CapStyleButt CapStyle = 1 | |
| 1195 | + | const CapStyleRound CapStyle = 2 | |
| 1196 | + | const CapStyleProjecting CapStyle = 3 | |
| 1197 | + | ||
| 1198 | + | type JoinStyle uint32 | |
| 1199 | + | ||
| 1200 | + | const JoinStyleMiter JoinStyle = 0 | |
| 1201 | + | const JoinStyleRound JoinStyle = 1 | |
| 1202 | + | const JoinStyleBevel JoinStyle = 2 | |
| 1203 | + | ||
| 1204 | + | type FillStyle uint32 | |
| 1205 | + | ||
| 1206 | + | const FillStyleSolid FillStyle = 0 | |
| 1207 | + | const FillStyleTiled FillStyle = 1 | |
| 1208 | + | const FillStyleStippled FillStyle = 2 | |
| 1209 | + | const FillStyleOpaqueStippled FillStyle = 3 | |
| 1210 | + | ||
| 1211 | + | type FillRule uint32 | |
| 1212 | + | ||
| 1213 | + | const FillRuleEvenOdd FillRule = 0 | |
| 1214 | + | const FillRuleWinding FillRule = 1 | |
| 1215 | + | ||
| 1216 | + | type SubwindowMode uint32 | |
| 1217 | + | ||
| 1218 | + | const SubwindowModeClipByChildren SubwindowMode = 0 | |
| 1219 | + | const SubwindowModeIncludeInferiors SubwindowMode = 1 | |
| 1220 | + | ||
| 1221 | + | type ArcMode uint32 | |
| 1222 | + | ||
| 1223 | + | const ArcModeChord ArcMode = 0 | |
| 1224 | + | const ArcModePieSlice ArcMode = 1 | |
| 1225 | + | ||
| 1226 | + | type ClipOrdering uint8 | |
| 1227 | + | ||
| 1228 | + | const ClipOrderingUnsorted ClipOrdering = 0 | |
| 1229 | + | const ClipOrderingYSorted ClipOrdering = 1 | |
| 1230 | + | const ClipOrderingYXSorted ClipOrdering = 2 | |
| 1231 | + | const ClipOrderingYXBanded ClipOrdering = 3 | |
| 1232 | + | ||
| 1233 | + | type CoordMode uint8 | |
| 1234 | + | ||
| 1235 | + | const CoordModeOrigin CoordMode = 0 | |
| 1236 | + | const CoordModePrevious CoordMode = 1 | |
| 1237 | + | ||
| 1238 | + | type PolyShape uint8 | |
| 1239 | + | ||
| 1240 | + | const PolyShapeComplex PolyShape = 0 | |
| 1241 | + | const PolyShapeNonconvex PolyShape = 1 | |
| 1242 | + | const PolyShapeConvex PolyShape = 2 | |
| 1243 | + | ||
| 1244 | + | type ImageFormat uint8 | |
| 1245 | + | ||
| 1246 | + | const ImageFormatXYBitmap ImageFormat = 0 | |
| 1247 | + | const ImageFormatXYPixmap ImageFormat = 1 | |
| 1248 | + | const ImageFormatZPixmap ImageFormat = 2 | |
| 1249 | + | ||
| 1250 | + | type ColormapAlloc uint8 | |
| 1251 | + | ||
| 1252 | + | const ColormapAllocNone ColormapAlloc = 0 | |
| 1253 | + | const ColormapAllocAll ColormapAlloc = 1 | |
| 1254 | + | ||
| 1255 | + | type ColorFlag uint8 | |
| 1256 | + | ||
| 1257 | + | const ColorFlagRed ColorFlag = 1 | |
| 1258 | + | const ColorFlagGreen ColorFlag = 2 | |
| 1259 | + | const ColorFlagBlue ColorFlag = 4 | |
| 1260 | + | ||
| 1261 | + | const PixmapNone Pixmap = 0 | |
| 1262 | + | ||
| 1263 | + | const FontNone Font = 0 | |
| 1264 | + | ||
| 1265 | + | type QueryShapeOf uint8 | |
| 1266 | + | ||
| 1267 | + | const QueryShapeOfLargestCursor QueryShapeOf = 0 | |
| 1268 | + | const QueryShapeOfFastestTile QueryShapeOf = 1 | |
| 1269 | + | const QueryShapeOfFastestStipple QueryShapeOf = 2 | |
| 1270 | + | ||
| 1271 | + | type Kb uint32 | |
| 1272 | + | ||
| 1273 | + | const KbKeyClickPercent Kb = 1 | |
| 1274 | + | const KbBellPercent Kb = 2 | |
| 1275 | + | const KbBellPitch Kb = 4 | |
| 1276 | + | const KbBellDuration Kb = 8 | |
| 1277 | + | const KbLed Kb = 16 | |
| 1278 | + | const KbLedMode Kb = 32 | |
| 1279 | + | const KbKey Kb = 64 | |
| 1280 | + | const KbAutoRepeatMode Kb = 128 | |
| 1281 | + | ||
| 1282 | + | type LedMode uint32 | |
| 1283 | + | ||
| 1284 | + | const LedModeOff LedMode = 0 | |
| 1285 | + | const LedModeOn LedMode = 1 | |
| 1286 | + | ||
| 1287 | + | type AutoRepeatMode uint32 | |
| 1288 | + | ||
| 1289 | + | const AutoRepeatModeOff AutoRepeatMode = 0 | |
| 1290 | + | const AutoRepeatModeOn AutoRepeatMode = 1 | |
| 1291 | + | const AutoRepeatModeDefault AutoRepeatMode = 2 | |
| 1292 | + | ||
| 1293 | + | type Blanking uint8 | |
| 1294 | + | ||
| 1295 | + | const BlankingNotPreferred Blanking = 0 | |
| 1296 | + | const BlankingPreferred Blanking = 1 | |
| 1297 | + | const BlankingDefault Blanking = 2 | |
| 1298 | + | ||
| 1299 | + | type Exposures uint8 | |
| 1300 | + | ||
| 1301 | + | const ExposuresNotAllowed Exposures = 0 | |
| 1302 | + | const ExposuresAllowed Exposures = 1 | |
| 1303 | + | const ExposuresDefault Exposures = 2 | |
| 1304 | + | ||
| 1305 | + | type HostMode uint8 | |
| 1306 | + | ||
| 1307 | + | const HostModeInsert HostMode = 0 | |
| 1308 | + | const HostModeDelete HostMode = 1 | |
| 1309 | + | ||
| 1310 | + | type Family uint8 | |
| 1311 | + | ||
| 1312 | + | const FamilyInternet Family = 0 | |
| 1313 | + | const FamilyDECnet Family = 1 | |
| 1314 | + | const FamilyChaos Family = 2 | |
| 1315 | + | const FamilyServerInterpreted Family = 5 | |
| 1316 | + | const FamilyInternet6 Family = 6 | |
| 1317 | + | ||
| 1318 | + | type AccessControl uint8 | |
| 1319 | + | ||
| 1320 | + | const AccessControlDisable AccessControl = 0 | |
| 1321 | + | const AccessControlEnable AccessControl = 1 | |
| 1322 | + | ||
| 1323 | + | type CloseDown uint8 | |
| 1324 | + | ||
| 1325 | + | const CloseDownDestroyAll CloseDown = 0 | |
| 1326 | + | const CloseDownRetainPermanent CloseDown = 1 | |
| 1327 | + | const CloseDownRetainTemporary CloseDown = 2 | |
| 1328 | + | ||
| 1329 | + | type Kill uint32 | |
| 1330 | + | ||
| 1331 | + | const KillAllTemporary Kill = 0 | |
| 1332 | + | ||
| 1333 | + | type ScreenSaver uint8 | |
| 1334 | + | ||
| 1335 | + | const ScreenSaverReset ScreenSaver = 0 | |
| 1336 | + | const ScreenSaverActive ScreenSaver = 1 | |
| 1337 | + | ||
| 1338 | + | type MappingStatus uint8 | |
| 1339 | + | ||
| 1340 | + | const MappingStatusSuccess MappingStatus = 0 | |
| 1341 | + | const MappingStatusBusy MappingStatus = 1 | |
| 1342 | + | const MappingStatusFailure MappingStatus = 2 | |
| 1343 | + | ||
| 1344 | + | type MapIndex uint32 | |
| 1345 | + | ||
| 1346 | + | const MapIndexShift MapIndex = 0 | |
| 1347 | + | const MapIndexLock MapIndex = 1 | |
| 1348 | + | const MapIndexControl MapIndex = 2 | |
| 1349 | + | const MapIndexX1 MapIndex = 3 | |
| 1350 | + | const MapIndexX2 MapIndex = 4 | |
| 1351 | + | const MapIndexX3 MapIndex = 5 | |
| 1352 | + | const MapIndexX4 MapIndex = 6 | |
| 1353 | + | const MapIndexX5 MapIndex = 7 | |
| @@ -0,0 +1,1353 @@ | |||||
| 1 | + | // Code generated by xtgen; DO NOT EDIT. | |||
| 2 | + | package xproto | |||
| 3 | + | ||||
| 4 | + | import "encoding/binary" | |||
| 5 | + | ||||
| 6 | + | type Char2b struct { | |||
| 7 | + | Byte1 uint8 | |||
| 8 | + | Byte2 uint8 | |||
| 9 | + | } | |||
| 10 | + | ||||
| 11 | + | const Char2bSize = 2 | |||
| 12 | + | ||||
| 13 | + | func (v Char2b) Put(p []byte) { clear(p[:2]); p[0:][0] = byte(v.Byte1); p[1:][0] = byte(v.Byte2) } | |||
| 14 | + | func GetChar2b(p []byte) (v Char2b) { | |||
| 15 | + | _ = p[1] | |||
| 16 | + | v.Byte1 = uint8(p[0:][0]) | |||
| 17 | + | v.Byte2 = uint8(p[1:][0]) | |||
| 18 | + | return | |||
| 19 | + | } | |||
| 20 | + | ||||
| 21 | + | type Window uint32 | |||
| 22 | + | ||||
| 23 | + | type Pixmap uint32 | |||
| 24 | + | ||||
| 25 | + | type Cursor uint32 | |||
| 26 | + | ||||
| 27 | + | type Font uint32 | |||
| 28 | + | ||||
| 29 | + | type Gcontext uint32 | |||
| 30 | + | ||||
| 31 | + | type Colormap uint32 | |||
| 32 | + | ||||
| 33 | + | type Atom uint32 | |||
| 34 | + | ||||
| 35 | + | type Drawable uint32 | |||
| 36 | + | ||||
| 37 | + | type Fontable uint32 | |||
| 38 | + | ||||
| 39 | + | type Bool32 uint32 | |||
| 40 | + | ||||
| 41 | + | type Visualid uint32 | |||
| 42 | + | ||||
| 43 | + | type Timestamp uint32 | |||
| 44 | + | ||||
| 45 | + | type Keysym uint32 | |||
| 46 | + | ||||
| 47 | + | type Keycode uint8 | |||
| 48 | + | ||||
| 49 | + | type Keycode32 uint32 | |||
| 50 | + | ||||
| 51 | + | type Button uint8 | |||
| 52 | + | ||||
| 53 | + | type Point struct { | |||
| 54 | + | X int16 | |||
| 55 | + | Y int16 | |||
| 56 | + | } | |||
| 57 | + | ||||
| 58 | + | const PointSize = 4 | |||
| 59 | + | ||||
| 60 | + | func (v Point) Put(p []byte) { | |||
| 61 | + | clear(p[:4]) | |||
| 62 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X)) | |||
| 63 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y)) | |||
| 64 | + | } | |||
| 65 | + | func GetPoint(p []byte) (v Point) { | |||
| 66 | + | _ = p[3] | |||
| 67 | + | v.X = int16(binary.LittleEndian.Uint16(p[0:])) | |||
| 68 | + | v.Y = int16(binary.LittleEndian.Uint16(p[2:])) | |||
| 69 | + | return | |||
| 70 | + | } | |||
| 71 | + | ||||
| 72 | + | type Rectangle struct { | |||
| 73 | + | X int16 | |||
| 74 | + | Y int16 | |||
| 75 | + | Width uint16 | |||
| 76 | + | Height uint16 | |||
| 77 | + | } | |||
| 78 | + | ||||
| 79 | + | const RectangleSize = 8 | |||
| 80 | + | ||||
| 81 | + | func (v Rectangle) Put(p []byte) { | |||
| 82 | + | clear(p[:8]) | |||
| 83 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X)) | |||
| 84 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y)) | |||
| 85 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Width)) | |||
| 86 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Height)) | |||
| 87 | + | } | |||
| 88 | + | func GetRectangle(p []byte) (v Rectangle) { | |||
| 89 | + | _ = p[7] | |||
| 90 | + | v.X = int16(binary.LittleEndian.Uint16(p[0:])) | |||
| 91 | + | v.Y = int16(binary.LittleEndian.Uint16(p[2:])) | |||
| 92 | + | v.Width = uint16(binary.LittleEndian.Uint16(p[4:])) | |||
| 93 | + | v.Height = uint16(binary.LittleEndian.Uint16(p[6:])) | |||
| 94 | + | return | |||
| 95 | + | } | |||
| 96 | + | ||||
| 97 | + | type Arc struct { | |||
| 98 | + | X int16 | |||
| 99 | + | Y int16 | |||
| 100 | + | Width uint16 | |||
| 101 | + | Height uint16 | |||
| 102 | + | Angle1 int16 | |||
| 103 | + | Angle2 int16 | |||
| 104 | + | } | |||
| 105 | + | ||||
| 106 | + | const ArcSize = 12 | |||
| 107 | + | ||||
| 108 | + | func (v Arc) Put(p []byte) { | |||
| 109 | + | clear(p[:12]) | |||
| 110 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X)) | |||
| 111 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y)) | |||
| 112 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Width)) | |||
| 113 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Height)) | |||
| 114 | + | binary.LittleEndian.PutUint16(p[8:], uint16(v.Angle1)) | |||
| 115 | + | binary.LittleEndian.PutUint16(p[10:], uint16(v.Angle2)) | |||
| 116 | + | } | |||
| 117 | + | func GetArc(p []byte) (v Arc) { | |||
| 118 | + | _ = p[11] | |||
| 119 | + | v.X = int16(binary.LittleEndian.Uint16(p[0:])) | |||
| 120 | + | v.Y = int16(binary.LittleEndian.Uint16(p[2:])) | |||
| 121 | + | v.Width = uint16(binary.LittleEndian.Uint16(p[4:])) | |||
| 122 | + | v.Height = uint16(binary.LittleEndian.Uint16(p[6:])) | |||
| 123 | + | v.Angle1 = int16(binary.LittleEndian.Uint16(p[8:])) | |||
| 124 | + | v.Angle2 = int16(binary.LittleEndian.Uint16(p[10:])) | |||
| 125 | + | return | |||
| 126 | + | } | |||
| 127 | + | ||||
| 128 | + | type Format struct { | |||
| 129 | + | Depth uint8 | |||
| 130 | + | BitsPerPixel uint8 | |||
| 131 | + | ScanlinePad uint8 | |||
| 132 | + | } | |||
| 133 | + | ||||
| 134 | + | const FormatSize = 8 | |||
| 135 | + | ||||
| 136 | + | func (v Format) Put(p []byte) { | |||
| 137 | + | clear(p[:8]) | |||
| 138 | + | p[0:][0] = byte(v.Depth) | |||
| 139 | + | p[1:][0] = byte(v.BitsPerPixel) | |||
| 140 | + | p[2:][0] = byte(v.ScanlinePad) | |||
| 141 | + | } | |||
| 142 | + | func GetFormat(p []byte) (v Format) { | |||
| 143 | + | _ = p[7] | |||
| 144 | + | v.Depth = uint8(p[0:][0]) | |||
| 145 | + | v.BitsPerPixel = uint8(p[1:][0]) | |||
| 146 | + | v.ScanlinePad = uint8(p[2:][0]) | |||
| 147 | + | return | |||
| 148 | + | } | |||
| 149 | + | ||||
| 150 | + | type Visualtype struct { | |||
| 151 | + | VisualId Visualid | |||
| 152 | + | Class VisualClass | |||
| 153 | + | BitsPerRgbValue uint8 | |||
| 154 | + | ColormapEntries uint16 | |||
| 155 | + | RedMask uint32 | |||
| 156 | + | GreenMask uint32 | |||
| 157 | + | BlueMask uint32 | |||
| 158 | + | } | |||
| 159 | + | ||||
| 160 | + | const VisualtypeSize = 24 | |||
| 161 | + | ||||
| 162 | + | func (v Visualtype) Put(p []byte) { | |||
| 163 | + | clear(p[:24]) | |||
| 164 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.VisualId)) | |||
| 165 | + | p[4:][0] = byte(v.Class) | |||
| 166 | + | p[5:][0] = byte(v.BitsPerRgbValue) | |||
| 167 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.ColormapEntries)) | |||
| 168 | + | binary.LittleEndian.PutUint32(p[8:], uint32(v.RedMask)) | |||
| 169 | + | binary.LittleEndian.PutUint32(p[12:], uint32(v.GreenMask)) | |||
| 170 | + | binary.LittleEndian.PutUint32(p[16:], uint32(v.BlueMask)) | |||
| 171 | + | } | |||
| 172 | + | func GetVisualtype(p []byte) (v Visualtype) { | |||
| 173 | + | _ = p[23] | |||
| 174 | + | v.VisualId = Visualid(binary.LittleEndian.Uint32(p[0:])) | |||
| 175 | + | v.Class = VisualClass(p[4:][0]) | |||
| 176 | + | v.BitsPerRgbValue = uint8(p[5:][0]) | |||
| 177 | + | v.ColormapEntries = uint16(binary.LittleEndian.Uint16(p[6:])) | |||
| 178 | + | v.RedMask = uint32(binary.LittleEndian.Uint32(p[8:])) | |||
| 179 | + | v.GreenMask = uint32(binary.LittleEndian.Uint32(p[12:])) | |||
| 180 | + | v.BlueMask = uint32(binary.LittleEndian.Uint32(p[16:])) | |||
| 181 | + | return | |||
| 182 | + | } | |||
| 183 | + | ||||
| 184 | + | type Depth struct { | |||
| 185 | + | Depth uint8 | |||
| 186 | + | VisualsLen uint16 | |||
| 187 | + | Visuals []Visualtype | |||
| 188 | + | } | |||
| 189 | + | ||||
| 190 | + | const DepthSize = 8 | |||
| 191 | + | ||||
| 192 | + | func (v Depth) Size() int { | |||
| 193 | + | off := 0 | |||
| 194 | + | off += 1 | |||
| 195 | + | off += 1 | |||
| 196 | + | off += 2 | |||
| 197 | + | off += 4 | |||
| 198 | + | off += len(v.Visuals) * 24 | |||
| 199 | + | return off | |||
| 200 | + | } | |||
| 201 | + | func (v Depth) Put(p []byte) { | |||
| 202 | + | off := 0 | |||
| 203 | + | p[off:][0] = byte(v.Depth) | |||
| 204 | + | off += 1 | |||
| 205 | + | clear(p[off : off+1]) | |||
| 206 | + | off += 1 | |||
| 207 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.VisualsLen)) | |||
| 208 | + | off += 2 | |||
| 209 | + | clear(p[off : off+4]) | |||
| 210 | + | off += 4 | |||
| 211 | + | for i := range v.Visuals { | |||
| 212 | + | v.Visuals[i].Put(p[off+i*24:]) | |||
| 213 | + | } | |||
| 214 | + | off += len(v.Visuals) * 24 | |||
| 215 | + | } | |||
| 216 | + | ||||
| 217 | + | type Screen struct { | |||
| 218 | + | Root Window | |||
| 219 | + | DefaultColormap Colormap | |||
| 220 | + | WhitePixel uint32 | |||
| 221 | + | BlackPixel uint32 | |||
| 222 | + | CurrentInputMasks EventMask | |||
| 223 | + | WidthInPixels uint16 | |||
| 224 | + | HeightInPixels uint16 | |||
| 225 | + | WidthInMillimeters uint16 | |||
| 226 | + | HeightInMillimeters uint16 | |||
| 227 | + | MinInstalledMaps uint16 | |||
| 228 | + | MaxInstalledMaps uint16 | |||
| 229 | + | RootVisual Visualid | |||
| 230 | + | BackingStores BackingStore | |||
| 231 | + | SaveUnders bool | |||
| 232 | + | RootDepth uint8 | |||
| 233 | + | AllowedDepthsLen uint8 | |||
| 234 | + | AllowedDepths []Depth | |||
| 235 | + | } | |||
| 236 | + | ||||
| 237 | + | const ScreenSize = 40 | |||
| 238 | + | ||||
| 239 | + | func (v Screen) Size() int { | |||
| 240 | + | off := 0 | |||
| 241 | + | off += 4 | |||
| 242 | + | off += 4 | |||
| 243 | + | off += 4 | |||
| 244 | + | off += 4 | |||
| 245 | + | off += 4 | |||
| 246 | + | off += 2 | |||
| 247 | + | off += 2 | |||
| 248 | + | off += 2 | |||
| 249 | + | off += 2 | |||
| 250 | + | off += 2 | |||
| 251 | + | off += 2 | |||
| 252 | + | off += 4 | |||
| 253 | + | off += 1 | |||
| 254 | + | off += 1 | |||
| 255 | + | off += 1 | |||
| 256 | + | off += 1 | |||
| 257 | + | for i := range v.AllowedDepths { | |||
| 258 | + | off += v.AllowedDepths[i].Size() | |||
| 259 | + | } | |||
| 260 | + | return off | |||
| 261 | + | } | |||
| 262 | + | func (v Screen) Put(p []byte) { | |||
| 263 | + | off := 0 | |||
| 264 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.Root)) | |||
| 265 | + | off += 4 | |||
| 266 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.DefaultColormap)) | |||
| 267 | + | off += 4 | |||
| 268 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.WhitePixel)) | |||
| 269 | + | off += 4 | |||
| 270 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.BlackPixel)) | |||
| 271 | + | off += 4 | |||
| 272 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.CurrentInputMasks)) | |||
| 273 | + | off += 4 | |||
| 274 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.WidthInPixels)) | |||
| 275 | + | off += 2 | |||
| 276 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.HeightInPixels)) | |||
| 277 | + | off += 2 | |||
| 278 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.WidthInMillimeters)) | |||
| 279 | + | off += 2 | |||
| 280 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.HeightInMillimeters)) | |||
| 281 | + | off += 2 | |||
| 282 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.MinInstalledMaps)) | |||
| 283 | + | off += 2 | |||
| 284 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.MaxInstalledMaps)) | |||
| 285 | + | off += 2 | |||
| 286 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.RootVisual)) | |||
| 287 | + | off += 4 | |||
| 288 | + | p[off:][0] = byte(v.BackingStores) | |||
| 289 | + | off += 1 | |||
| 290 | + | if v.SaveUnders { | |||
| 291 | + | p[off:][0] = 1 | |||
| 292 | + | } else { | |||
| 293 | + | p[off:][0] = 0 | |||
| 294 | + | } | |||
| 295 | + | off += 1 | |||
| 296 | + | p[off:][0] = byte(v.RootDepth) | |||
| 297 | + | off += 1 | |||
| 298 | + | p[off:][0] = byte(v.AllowedDepthsLen) | |||
| 299 | + | off += 1 | |||
| 300 | + | for i := range v.AllowedDepths { | |||
| 301 | + | v.AllowedDepths[i].Put(p[off:]) | |||
| 302 | + | off += v.AllowedDepths[i].Size() | |||
| 303 | + | } | |||
| 304 | + | } | |||
| 305 | + | ||||
| 306 | + | type SetupRequest struct { | |||
| 307 | + | ByteOrder uint8 | |||
| 308 | + | ProtocolMajorVersion uint16 | |||
| 309 | + | ProtocolMinorVersion uint16 | |||
| 310 | + | AuthorizationProtocolNameLen uint16 | |||
| 311 | + | AuthorizationProtocolDataLen uint16 | |||
| 312 | + | AuthorizationProtocolName string | |||
| 313 | + | AuthorizationProtocolData string | |||
| 314 | + | } | |||
| 315 | + | ||||
| 316 | + | const SetupRequestSize = 12 | |||
| 317 | + | ||||
| 318 | + | func (v SetupRequest) Size() int { | |||
| 319 | + | off := 0 | |||
| 320 | + | off += 1 | |||
| 321 | + | off += 1 | |||
| 322 | + | off += 2 | |||
| 323 | + | off += 2 | |||
| 324 | + | off += 2 | |||
| 325 | + | off += 2 | |||
| 326 | + | off += 2 | |||
| 327 | + | off += len(v.AuthorizationProtocolName) * 1 | |||
| 328 | + | off = (off + 3) &^ 3 | |||
| 329 | + | off += len(v.AuthorizationProtocolData) * 1 | |||
| 330 | + | off = (off + 3) &^ 3 | |||
| 331 | + | return off | |||
| 332 | + | } | |||
| 333 | + | func (v SetupRequest) Put(p []byte) { | |||
| 334 | + | off := 0 | |||
| 335 | + | p[off:][0] = byte(v.ByteOrder) | |||
| 336 | + | off += 1 | |||
| 337 | + | clear(p[off : off+1]) | |||
| 338 | + | off += 1 | |||
| 339 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMajorVersion)) | |||
| 340 | + | off += 2 | |||
| 341 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMinorVersion)) | |||
| 342 | + | off += 2 | |||
| 343 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.AuthorizationProtocolNameLen)) | |||
| 344 | + | off += 2 | |||
| 345 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.AuthorizationProtocolDataLen)) | |||
| 346 | + | off += 2 | |||
| 347 | + | clear(p[off : off+2]) | |||
| 348 | + | off += 2 | |||
| 349 | + | for i := range v.AuthorizationProtocolName { | |||
| 350 | + | p[off+i*1:][0] = byte(v.AuthorizationProtocolName[i]) | |||
| 351 | + | } | |||
| 352 | + | off += len(v.AuthorizationProtocolName) * 1 | |||
| 353 | + | { | |||
| 354 | + | next := (off + 3) &^ 3 | |||
| 355 | + | clear(p[off:next]) | |||
| 356 | + | off = next | |||
| 357 | + | } | |||
| 358 | + | for i := range v.AuthorizationProtocolData { | |||
| 359 | + | p[off+i*1:][0] = byte(v.AuthorizationProtocolData[i]) | |||
| 360 | + | } | |||
| 361 | + | off += len(v.AuthorizationProtocolData) * 1 | |||
| 362 | + | { | |||
| 363 | + | next := (off + 3) &^ 3 | |||
| 364 | + | clear(p[off:next]) | |||
| 365 | + | off = next | |||
| 366 | + | } | |||
| 367 | + | } | |||
| 368 | + | ||||
| 369 | + | type SetupFailed struct { | |||
| 370 | + | Status uint8 | |||
| 371 | + | ReasonLen uint8 | |||
| 372 | + | ProtocolMajorVersion uint16 | |||
| 373 | + | ProtocolMinorVersion uint16 | |||
| 374 | + | Length uint16 | |||
| 375 | + | Reason string | |||
| 376 | + | } | |||
| 377 | + | ||||
| 378 | + | const SetupFailedSize = 8 | |||
| 379 | + | ||||
| 380 | + | func (v SetupFailed) Size() int { | |||
| 381 | + | off := 0 | |||
| 382 | + | off += 1 | |||
| 383 | + | off += 1 | |||
| 384 | + | off += 2 | |||
| 385 | + | off += 2 | |||
| 386 | + | off += 2 | |||
| 387 | + | off += len(v.Reason) * 1 | |||
| 388 | + | return off | |||
| 389 | + | } | |||
| 390 | + | func (v SetupFailed) Put(p []byte) { | |||
| 391 | + | off := 0 | |||
| 392 | + | p[off:][0] = byte(v.Status) | |||
| 393 | + | off += 1 | |||
| 394 | + | p[off:][0] = byte(v.ReasonLen) | |||
| 395 | + | off += 1 | |||
| 396 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMajorVersion)) | |||
| 397 | + | off += 2 | |||
| 398 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMinorVersion)) | |||
| 399 | + | off += 2 | |||
| 400 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.Length)) | |||
| 401 | + | off += 2 | |||
| 402 | + | for i := range v.Reason { | |||
| 403 | + | p[off+i*1:][0] = byte(v.Reason[i]) | |||
| 404 | + | } | |||
| 405 | + | off += len(v.Reason) * 1 | |||
| 406 | + | } | |||
| 407 | + | ||||
| 408 | + | type SetupAuthenticate struct { | |||
| 409 | + | Status uint8 | |||
| 410 | + | Length uint16 | |||
| 411 | + | Reason string | |||
| 412 | + | } | |||
| 413 | + | ||||
| 414 | + | const SetupAuthenticateSize = 8 | |||
| 415 | + | ||||
| 416 | + | func (v SetupAuthenticate) Size() int { | |||
| 417 | + | off := 0 | |||
| 418 | + | off += 1 | |||
| 419 | + | off += 5 | |||
| 420 | + | off += 2 | |||
| 421 | + | off += len(v.Reason) * 1 | |||
| 422 | + | return off | |||
| 423 | + | } | |||
| 424 | + | func (v SetupAuthenticate) Put(p []byte) { | |||
| 425 | + | off := 0 | |||
| 426 | + | p[off:][0] = byte(v.Status) | |||
| 427 | + | off += 1 | |||
| 428 | + | clear(p[off : off+5]) | |||
| 429 | + | off += 5 | |||
| 430 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.Length)) | |||
| 431 | + | off += 2 | |||
| 432 | + | for i := range v.Reason { | |||
| 433 | + | p[off+i*1:][0] = byte(v.Reason[i]) | |||
| 434 | + | } | |||
| 435 | + | off += len(v.Reason) * 1 | |||
| 436 | + | } | |||
| 437 | + | ||||
| 438 | + | type Setup struct { | |||
| 439 | + | Status uint8 | |||
| 440 | + | ProtocolMajorVersion uint16 | |||
| 441 | + | ProtocolMinorVersion uint16 | |||
| 442 | + | Length uint16 | |||
| 443 | + | ReleaseNumber uint32 | |||
| 444 | + | ResourceIdBase uint32 | |||
| 445 | + | ResourceIdMask uint32 | |||
| 446 | + | MotionBufferSize uint32 | |||
| 447 | + | VendorLen uint16 | |||
| 448 | + | MaximumRequestLength uint16 | |||
| 449 | + | RootsLen uint8 | |||
| 450 | + | PixmapFormatsLen uint8 | |||
| 451 | + | ImageByteOrder ImageOrder | |||
| 452 | + | BitmapFormatBitOrder ImageOrder | |||
| 453 | + | BitmapFormatScanlineUnit uint8 | |||
| 454 | + | BitmapFormatScanlinePad uint8 | |||
| 455 | + | MinKeycode Keycode | |||
| 456 | + | MaxKeycode Keycode | |||
| 457 | + | Vendor string | |||
| 458 | + | PixmapFormats []Format | |||
| 459 | + | Roots []Screen | |||
| 460 | + | } | |||
| 461 | + | ||||
| 462 | + | const SetupSize = 40 | |||
| 463 | + | ||||
| 464 | + | func (v Setup) Size() int { | |||
| 465 | + | off := 0 | |||
| 466 | + | off += 1 | |||
| 467 | + | off += 1 | |||
| 468 | + | off += 2 | |||
| 469 | + | off += 2 | |||
| 470 | + | off += 2 | |||
| 471 | + | off += 4 | |||
| 472 | + | off += 4 | |||
| 473 | + | off += 4 | |||
| 474 | + | off += 4 | |||
| 475 | + | off += 2 | |||
| 476 | + | off += 2 | |||
| 477 | + | off += 1 | |||
| 478 | + | off += 1 | |||
| 479 | + | off += 1 | |||
| 480 | + | off += 1 | |||
| 481 | + | off += 1 | |||
| 482 | + | off += 1 | |||
| 483 | + | off += 1 | |||
| 484 | + | off += 1 | |||
| 485 | + | off += 4 | |||
| 486 | + | off += len(v.Vendor) * 1 | |||
| 487 | + | off = (off + 3) &^ 3 | |||
| 488 | + | off += len(v.PixmapFormats) * 8 | |||
| 489 | + | for i := range v.Roots { | |||
| 490 | + | off += v.Roots[i].Size() | |||
| 491 | + | } | |||
| 492 | + | return off | |||
| 493 | + | } | |||
| 494 | + | func (v Setup) Put(p []byte) { | |||
| 495 | + | off := 0 | |||
| 496 | + | p[off:][0] = byte(v.Status) | |||
| 497 | + | off += 1 | |||
| 498 | + | clear(p[off : off+1]) | |||
| 499 | + | off += 1 | |||
| 500 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMajorVersion)) | |||
| 501 | + | off += 2 | |||
| 502 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.ProtocolMinorVersion)) | |||
| 503 | + | off += 2 | |||
| 504 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.Length)) | |||
| 505 | + | off += 2 | |||
| 506 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.ReleaseNumber)) | |||
| 507 | + | off += 4 | |||
| 508 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.ResourceIdBase)) | |||
| 509 | + | off += 4 | |||
| 510 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.ResourceIdMask)) | |||
| 511 | + | off += 4 | |||
| 512 | + | binary.LittleEndian.PutUint32(p[off:], uint32(v.MotionBufferSize)) | |||
| 513 | + | off += 4 | |||
| 514 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.VendorLen)) | |||
| 515 | + | off += 2 | |||
| 516 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.MaximumRequestLength)) | |||
| 517 | + | off += 2 | |||
| 518 | + | p[off:][0] = byte(v.RootsLen) | |||
| 519 | + | off += 1 | |||
| 520 | + | p[off:][0] = byte(v.PixmapFormatsLen) | |||
| 521 | + | off += 1 | |||
| 522 | + | p[off:][0] = byte(v.ImageByteOrder) | |||
| 523 | + | off += 1 | |||
| 524 | + | p[off:][0] = byte(v.BitmapFormatBitOrder) | |||
| 525 | + | off += 1 | |||
| 526 | + | p[off:][0] = byte(v.BitmapFormatScanlineUnit) | |||
| 527 | + | off += 1 | |||
| 528 | + | p[off:][0] = byte(v.BitmapFormatScanlinePad) | |||
| 529 | + | off += 1 | |||
| 530 | + | p[off:][0] = byte(v.MinKeycode) | |||
| 531 | + | off += 1 | |||
| 532 | + | p[off:][0] = byte(v.MaxKeycode) | |||
| 533 | + | off += 1 | |||
| 534 | + | clear(p[off : off+4]) | |||
| 535 | + | off += 4 | |||
| 536 | + | for i := range v.Vendor { | |||
| 537 | + | p[off+i*1:][0] = byte(v.Vendor[i]) | |||
| 538 | + | } | |||
| 539 | + | off += len(v.Vendor) * 1 | |||
| 540 | + | { | |||
| 541 | + | next := (off + 3) &^ 3 | |||
| 542 | + | clear(p[off:next]) | |||
| 543 | + | off = next | |||
| 544 | + | } | |||
| 545 | + | for i := range v.PixmapFormats { | |||
| 546 | + | v.PixmapFormats[i].Put(p[off+i*8:]) | |||
| 547 | + | } | |||
| 548 | + | off += len(v.PixmapFormats) * 8 | |||
| 549 | + | for i := range v.Roots { | |||
| 550 | + | v.Roots[i].Put(p[off:]) | |||
| 551 | + | off += v.Roots[i].Size() | |||
| 552 | + | } | |||
| 553 | + | } | |||
| 554 | + | ||||
| 555 | + | type ClientMessageData struct{ raw []byte } | |||
| 556 | + | ||||
| 557 | + | const ClientMessageDataSize = 20 | |||
| 558 | + | ||||
| 559 | + | func GetClientMessageData(p []byte) ClientMessageData { return ClientMessageData{raw: p[:20]} } | |||
| 560 | + | func (v ClientMessageData) Put(p []byte) { copy(p[:20], v.raw) } | |||
| 561 | + | func (v ClientMessageData) Data8() (out [20]uint8) { | |||
| 562 | + | for i := range out { | |||
| 563 | + | out[i] = uint8(v.raw[i*1:][0]) | |||
| 564 | + | } | |||
| 565 | + | return | |||
| 566 | + | } | |||
| 567 | + | func (v ClientMessageData) Data16() (out [10]uint16) { | |||
| 568 | + | for i := range out { | |||
| 569 | + | out[i] = uint16(binary.LittleEndian.Uint16(v.raw[i*2:])) | |||
| 570 | + | } | |||
| 571 | + | return | |||
| 572 | + | } | |||
| 573 | + | func (v ClientMessageData) Data32() (out [5]uint32) { | |||
| 574 | + | for i := range out { | |||
| 575 | + | out[i] = uint32(binary.LittleEndian.Uint32(v.raw[i*4:])) | |||
| 576 | + | } | |||
| 577 | + | return | |||
| 578 | + | } | |||
| 579 | + | ||||
| 580 | + | type Timecoord struct { | |||
| 581 | + | Time Timestamp | |||
| 582 | + | X int16 | |||
| 583 | + | Y int16 | |||
| 584 | + | } | |||
| 585 | + | ||||
| 586 | + | const TimecoordSize = 8 | |||
| 587 | + | ||||
| 588 | + | func (v Timecoord) Put(p []byte) { | |||
| 589 | + | clear(p[:8]) | |||
| 590 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.Time)) | |||
| 591 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.X)) | |||
| 592 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Y)) | |||
| 593 | + | } | |||
| 594 | + | func GetTimecoord(p []byte) (v Timecoord) { | |||
| 595 | + | _ = p[7] | |||
| 596 | + | v.Time = Timestamp(binary.LittleEndian.Uint32(p[0:])) | |||
| 597 | + | v.X = int16(binary.LittleEndian.Uint16(p[4:])) | |||
| 598 | + | v.Y = int16(binary.LittleEndian.Uint16(p[6:])) | |||
| 599 | + | return | |||
| 600 | + | } | |||
| 601 | + | ||||
| 602 | + | type Fontprop struct { | |||
| 603 | + | Name Atom | |||
| 604 | + | Value uint32 | |||
| 605 | + | } | |||
| 606 | + | ||||
| 607 | + | const FontpropSize = 8 | |||
| 608 | + | ||||
| 609 | + | func (v Fontprop) Put(p []byte) { | |||
| 610 | + | clear(p[:8]) | |||
| 611 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.Name)) | |||
| 612 | + | binary.LittleEndian.PutUint32(p[4:], uint32(v.Value)) | |||
| 613 | + | } | |||
| 614 | + | func GetFontprop(p []byte) (v Fontprop) { | |||
| 615 | + | _ = p[7] | |||
| 616 | + | v.Name = Atom(binary.LittleEndian.Uint32(p[0:])) | |||
| 617 | + | v.Value = uint32(binary.LittleEndian.Uint32(p[4:])) | |||
| 618 | + | return | |||
| 619 | + | } | |||
| 620 | + | ||||
| 621 | + | type Charinfo struct { | |||
| 622 | + | LeftSideBearing int16 | |||
| 623 | + | RightSideBearing int16 | |||
| 624 | + | CharacterWidth int16 | |||
| 625 | + | Ascent int16 | |||
| 626 | + | Descent int16 | |||
| 627 | + | Attributes uint16 | |||
| 628 | + | } | |||
| 629 | + | ||||
| 630 | + | const CharinfoSize = 12 | |||
| 631 | + | ||||
| 632 | + | func (v Charinfo) Put(p []byte) { | |||
| 633 | + | clear(p[:12]) | |||
| 634 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.LeftSideBearing)) | |||
| 635 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.RightSideBearing)) | |||
| 636 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.CharacterWidth)) | |||
| 637 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Ascent)) | |||
| 638 | + | binary.LittleEndian.PutUint16(p[8:], uint16(v.Descent)) | |||
| 639 | + | binary.LittleEndian.PutUint16(p[10:], uint16(v.Attributes)) | |||
| 640 | + | } | |||
| 641 | + | func GetCharinfo(p []byte) (v Charinfo) { | |||
| 642 | + | _ = p[11] | |||
| 643 | + | v.LeftSideBearing = int16(binary.LittleEndian.Uint16(p[0:])) | |||
| 644 | + | v.RightSideBearing = int16(binary.LittleEndian.Uint16(p[2:])) | |||
| 645 | + | v.CharacterWidth = int16(binary.LittleEndian.Uint16(p[4:])) | |||
| 646 | + | v.Ascent = int16(binary.LittleEndian.Uint16(p[6:])) | |||
| 647 | + | v.Descent = int16(binary.LittleEndian.Uint16(p[8:])) | |||
| 648 | + | v.Attributes = uint16(binary.LittleEndian.Uint16(p[10:])) | |||
| 649 | + | return | |||
| 650 | + | } | |||
| 651 | + | ||||
| 652 | + | type Str struct { | |||
| 653 | + | NameLen uint8 | |||
| 654 | + | Name string | |||
| 655 | + | } | |||
| 656 | + | ||||
| 657 | + | const StrSize = 1 | |||
| 658 | + | ||||
| 659 | + | func (v Str) Size() int { off := 0; off += 1; off += len(v.Name) * 1; return off } | |||
| 660 | + | func (v Str) Put(p []byte) { | |||
| 661 | + | off := 0 | |||
| 662 | + | p[off:][0] = byte(v.NameLen) | |||
| 663 | + | off += 1 | |||
| 664 | + | for i := range v.Name { | |||
| 665 | + | p[off+i*1:][0] = byte(v.Name[i]) | |||
| 666 | + | } | |||
| 667 | + | off += len(v.Name) * 1 | |||
| 668 | + | } | |||
| 669 | + | ||||
| 670 | + | type Segment struct { | |||
| 671 | + | X1 int16 | |||
| 672 | + | Y1 int16 | |||
| 673 | + | X2 int16 | |||
| 674 | + | Y2 int16 | |||
| 675 | + | } | |||
| 676 | + | ||||
| 677 | + | const SegmentSize = 8 | |||
| 678 | + | ||||
| 679 | + | func (v Segment) Put(p []byte) { | |||
| 680 | + | clear(p[:8]) | |||
| 681 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.X1)) | |||
| 682 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Y1)) | |||
| 683 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.X2)) | |||
| 684 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Y2)) | |||
| 685 | + | } | |||
| 686 | + | func GetSegment(p []byte) (v Segment) { | |||
| 687 | + | _ = p[7] | |||
| 688 | + | v.X1 = int16(binary.LittleEndian.Uint16(p[0:])) | |||
| 689 | + | v.Y1 = int16(binary.LittleEndian.Uint16(p[2:])) | |||
| 690 | + | v.X2 = int16(binary.LittleEndian.Uint16(p[4:])) | |||
| 691 | + | v.Y2 = int16(binary.LittleEndian.Uint16(p[6:])) | |||
| 692 | + | return | |||
| 693 | + | } | |||
| 694 | + | ||||
| 695 | + | type Coloritem struct { | |||
| 696 | + | Pixel uint32 | |||
| 697 | + | Red uint16 | |||
| 698 | + | Green uint16 | |||
| 699 | + | Blue uint16 | |||
| 700 | + | Flags ColorFlag | |||
| 701 | + | } | |||
| 702 | + | ||||
| 703 | + | const ColoritemSize = 12 | |||
| 704 | + | ||||
| 705 | + | func (v Coloritem) Put(p []byte) { | |||
| 706 | + | clear(p[:12]) | |||
| 707 | + | binary.LittleEndian.PutUint32(p[0:], uint32(v.Pixel)) | |||
| 708 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Red)) | |||
| 709 | + | binary.LittleEndian.PutUint16(p[6:], uint16(v.Green)) | |||
| 710 | + | binary.LittleEndian.PutUint16(p[8:], uint16(v.Blue)) | |||
| 711 | + | p[10:][0] = byte(v.Flags) | |||
| 712 | + | } | |||
| 713 | + | func GetColoritem(p []byte) (v Coloritem) { | |||
| 714 | + | _ = p[11] | |||
| 715 | + | v.Pixel = uint32(binary.LittleEndian.Uint32(p[0:])) | |||
| 716 | + | v.Red = uint16(binary.LittleEndian.Uint16(p[4:])) | |||
| 717 | + | v.Green = uint16(binary.LittleEndian.Uint16(p[6:])) | |||
| 718 | + | v.Blue = uint16(binary.LittleEndian.Uint16(p[8:])) | |||
| 719 | + | v.Flags = ColorFlag(p[10:][0]) | |||
| 720 | + | return | |||
| 721 | + | } | |||
| 722 | + | ||||
| 723 | + | type Rgb struct { | |||
| 724 | + | Red uint16 | |||
| 725 | + | Green uint16 | |||
| 726 | + | Blue uint16 | |||
| 727 | + | } | |||
| 728 | + | ||||
| 729 | + | const RgbSize = 8 | |||
| 730 | + | ||||
| 731 | + | func (v Rgb) Put(p []byte) { | |||
| 732 | + | clear(p[:8]) | |||
| 733 | + | binary.LittleEndian.PutUint16(p[0:], uint16(v.Red)) | |||
| 734 | + | binary.LittleEndian.PutUint16(p[2:], uint16(v.Green)) | |||
| 735 | + | binary.LittleEndian.PutUint16(p[4:], uint16(v.Blue)) | |||
| 736 | + | } | |||
| 737 | + | func GetRgb(p []byte) (v Rgb) { | |||
| 738 | + | _ = p[7] | |||
| 739 | + | v.Red = uint16(binary.LittleEndian.Uint16(p[0:])) | |||
| 740 | + | v.Green = uint16(binary.LittleEndian.Uint16(p[2:])) | |||
| 741 | + | v.Blue = uint16(binary.LittleEndian.Uint16(p[4:])) | |||
| 742 | + | return | |||
| 743 | + | } | |||
| 744 | + | ||||
| 745 | + | type Host struct { | |||
| 746 | + | Family Family | |||
| 747 | + | AddressLen uint16 | |||
| 748 | + | Address []byte | |||
| 749 | + | } | |||
| 750 | + | ||||
| 751 | + | const HostSize = 4 | |||
| 752 | + | ||||
| 753 | + | func (v Host) Size() int { | |||
| 754 | + | off := 0 | |||
| 755 | + | off += 1 | |||
| 756 | + | off += 1 | |||
| 757 | + | off += 2 | |||
| 758 | + | off += len(v.Address) * 1 | |||
| 759 | + | off = (off + 3) &^ 3 | |||
| 760 | + | return off | |||
| 761 | + | } | |||
| 762 | + | func (v Host) Put(p []byte) { | |||
| 763 | + | off := 0 | |||
| 764 | + | p[off:][0] = byte(v.Family) | |||
| 765 | + | off += 1 | |||
| 766 | + | clear(p[off : off+1]) | |||
| 767 | + | off += 1 | |||
| 768 | + | binary.LittleEndian.PutUint16(p[off:], uint16(v.AddressLen)) | |||
| 769 | + | off += 2 | |||
| 770 | + | for i := range v.Address { | |||
| 771 | + | p[off+i*1:][0] = byte(v.Address[i]) | |||
| 772 | + | } | |||
| 773 | + | off += len(v.Address) * 1 | |||
| 774 | + | { | |||
| 775 | + | next := (off + 3) &^ 3 | |||
| 776 | + | clear(p[off:next]) | |||
| 777 | + | off = next | |||
| 778 | + | } | |||
| 779 | + | } | |||
| 780 | + | ||||
| 781 | + | type VisualClass uint8 | |||
| 782 | + | ||||
| 783 | + | const VisualClassStaticGray VisualClass = 0 | |||
| 784 | + | const VisualClassGrayScale VisualClass = 1 | |||
| 785 | + | const VisualClassStaticColor VisualClass = 2 | |||
| 786 | + | const VisualClassPseudoColor VisualClass = 3 | |||
| 787 | + | const VisualClassTrueColor VisualClass = 4 | |||
| 788 | + | const VisualClassDirectColor VisualClass = 5 | |||
| 789 | + | ||||
| 790 | + | type EventMask uint32 | |||
| 791 | + | ||||
| 792 | + | const EventMaskNoEvent EventMask = 0 | |||
| 793 | + | const EventMaskKeyPress EventMask = 1 | |||
| 794 | + | const EventMaskKeyRelease EventMask = 2 | |||
| 795 | + | const EventMaskButtonPress EventMask = 4 | |||
| 796 | + | const EventMaskButtonRelease EventMask = 8 | |||
| 797 | + | const EventMaskEnterWindow EventMask = 16 | |||
| 798 | + | const EventMaskLeaveWindow EventMask = 32 | |||
| 799 | + | const EventMaskPointerMotion EventMask = 64 | |||
| 800 | + | const EventMaskPointerMotionHint EventMask = 128 | |||
| 801 | + | const EventMaskButton1Motion EventMask = 256 | |||
| 802 | + | const EventMaskButton2Motion EventMask = 512 | |||
| 803 | + | const EventMaskButton3Motion EventMask = 1024 | |||
| 804 | + | const EventMaskButton4Motion EventMask = 2048 | |||
| 805 | + | const EventMaskButton5Motion EventMask = 4096 | |||
| 806 | + | const EventMaskButtonMotion EventMask = 8192 | |||
| 807 | + | const EventMaskKeymapState EventMask = 16384 | |||
| 808 | + | const EventMaskExposure EventMask = 32768 | |||
| 809 | + | const EventMaskVisibilityChange EventMask = 65536 | |||
| 810 | + | const EventMaskStructureNotify EventMask = 131072 | |||
| 811 | + | const EventMaskResizeRedirect EventMask = 262144 | |||
| 812 | + | const EventMaskSubstructureNotify EventMask = 524288 | |||
| 813 | + | const EventMaskSubstructureRedirect EventMask = 1048576 | |||
| 814 | + | const EventMaskFocusChange EventMask = 2097152 | |||
| 815 | + | const EventMaskPropertyChange EventMask = 4194304 | |||
| 816 | + | const EventMaskColorMapChange EventMask = 8388608 | |||
| 817 | + | const EventMaskOwnerGrabButton EventMask = 16777216 | |||
| 818 | + | ||||
| 819 | + | type BackingStore uint32 | |||
| 820 | + | ||||
| 821 | + | const BackingStoreNotUseful BackingStore = 0 | |||
| 822 | + | const BackingStoreWhenMapped BackingStore = 1 | |||
| 823 | + | const BackingStoreAlways BackingStore = 2 | |||
| 824 | + | ||||
| 825 | + | type ImageOrder uint8 | |||
| 826 | + | ||||
| 827 | + | const ImageOrderLSBFirst ImageOrder = 0 | |||
| 828 | + | const ImageOrderMSBFirst ImageOrder = 1 | |||
| 829 | + | ||||
| 830 | + | type ModMask uint16 | |||
| 831 | + | ||||
| 832 | + | const ModMaskShift ModMask = 1 | |||
| 833 | + | const ModMaskLock ModMask = 2 | |||
| 834 | + | const ModMaskControl ModMask = 4 | |||
| 835 | + | const ModMaskX1 ModMask = 8 | |||
| 836 | + | const ModMaskX2 ModMask = 16 | |||
| 837 | + | const ModMaskX3 ModMask = 32 | |||
| 838 | + | const ModMaskX4 ModMask = 64 | |||
| 839 | + | const ModMaskX5 ModMask = 128 | |||
| 840 | + | const ModMaskAny ModMask = 32768 | |||
| 841 | + | ||||
| 842 | + | type KeyButMask uint16 | |||
| 843 | + | ||||
| 844 | + | const KeyButMaskShift KeyButMask = 1 | |||
| 845 | + | const KeyButMaskLock KeyButMask = 2 | |||
| 846 | + | const KeyButMaskControl KeyButMask = 4 | |||
| 847 | + | const KeyButMaskMod1 KeyButMask = 8 | |||
| 848 | + | const KeyButMaskMod2 KeyButMask = 16 | |||
| 849 | + | const KeyButMaskMod3 KeyButMask = 32 | |||
| 850 | + | const KeyButMaskMod4 KeyButMask = 64 | |||
| 851 | + | const KeyButMaskMod5 KeyButMask = 128 | |||
| 852 | + | const KeyButMaskButton1 KeyButMask = 256 | |||
| 853 | + | const KeyButMaskButton2 KeyButMask = 512 | |||
| 854 | + | const KeyButMaskButton3 KeyButMask = 1024 | |||
| 855 | + | const KeyButMaskButton4 KeyButMask = 2048 | |||
| 856 | + | const KeyButMaskButton5 KeyButMask = 4096 | |||
| 857 | + | ||||
| 858 | + | const WindowNone Window = 0 | |||
| 859 | + | ||||
| 860 | + | type ButtonMask uint32 | |||
| 861 | + | ||||
| 862 | + | const ButtonMaskX1 ButtonMask = 256 | |||
| 863 | + | const ButtonMaskX2 ButtonMask = 512 | |||
| 864 | + | const ButtonMaskX3 ButtonMask = 1024 | |||
| 865 | + | const ButtonMaskX4 ButtonMask = 2048 | |||
| 866 | + | const ButtonMaskX5 ButtonMask = 4096 | |||
| 867 | + | const ButtonMaskAny ButtonMask = 32768 | |||
| 868 | + | ||||
| 869 | + | type Motion uint8 | |||
| 870 | + | ||||
| 871 | + | const MotionNormal Motion = 0 | |||
| 872 | + | const MotionHint Motion = 1 | |||
| 873 | + | ||||
| 874 | + | type NotifyDetail uint8 | |||
| 875 | + | ||||
| 876 | + | const NotifyDetailAncestor NotifyDetail = 0 | |||
| 877 | + | const NotifyDetailVirtual NotifyDetail = 1 | |||
| 878 | + | const NotifyDetailInferior NotifyDetail = 2 | |||
| 879 | + | const NotifyDetailNonlinear NotifyDetail = 3 | |||
| 880 | + | const NotifyDetailNonlinearVirtual NotifyDetail = 4 | |||
| 881 | + | const NotifyDetailPointer NotifyDetail = 5 | |||
| 882 | + | const NotifyDetailPointerRoot NotifyDetail = 6 | |||
| 883 | + | const NotifyDetailNone NotifyDetail = 7 | |||
| 884 | + | ||||
| 885 | + | type NotifyMode uint8 | |||
| 886 | + | ||||
| 887 | + | const NotifyModeNormal NotifyMode = 0 | |||
| 888 | + | const NotifyModeGrab NotifyMode = 1 | |||
| 889 | + | const NotifyModeUngrab NotifyMode = 2 | |||
| 890 | + | const NotifyModeWhileGrabbed NotifyMode = 3 | |||
| 891 | + | ||||
| 892 | + | type Visibility uint8 | |||
| 893 | + | ||||
| 894 | + | const VisibilityUnobscured Visibility = 0 | |||
| 895 | + | const VisibilityPartiallyObscured Visibility = 1 | |||
| 896 | + | const VisibilityFullyObscured Visibility = 2 | |||
| 897 | + | ||||
| 898 | + | type Place uint8 | |||
| 899 | + | ||||
| 900 | + | const PlaceOnTop Place = 0 | |||
| 901 | + | const PlaceOnBottom Place = 1 | |||
| 902 | + | ||||
| 903 | + | type Property uint8 | |||
| 904 | + | ||||
| 905 | + | const PropertyNewValue Property = 0 | |||
| 906 | + | const PropertyDelete Property = 1 | |||
| 907 | + | ||||
| 908 | + | type Time uint32 | |||
| 909 | + | ||||
| 910 | + | const TimeCurrentTime Time = 0 | |||
| 911 | + | ||||
| 912 | + | const AtomNone Atom = 0 | |||
| 913 | + | const AtomAny Atom = 0 | |||
| 914 | + | const AtomPrimary Atom = 1 | |||
| 915 | + | const AtomSecondary Atom = 2 | |||
| 916 | + | const AtomArc Atom = 3 | |||
| 917 | + | const AtomAtom Atom = 4 | |||
| 918 | + | const AtomBitmap Atom = 5 | |||
| 919 | + | const AtomCardinal Atom = 6 | |||
| 920 | + | const AtomColormap Atom = 7 | |||
| 921 | + | const AtomCursor Atom = 8 | |||
| 922 | + | const AtomCutBuffer0 Atom = 9 | |||
| 923 | + | const AtomCutBuffer1 Atom = 10 | |||
| 924 | + | const AtomCutBuffer2 Atom = 11 | |||
| 925 | + | const AtomCutBuffer3 Atom = 12 | |||
| 926 | + | const AtomCutBuffer4 Atom = 13 | |||
| 927 | + | const AtomCutBuffer5 Atom = 14 | |||
| 928 | + | const AtomCutBuffer6 Atom = 15 | |||
| 929 | + | const AtomCutBuffer7 Atom = 16 | |||
| 930 | + | const AtomDrawable Atom = 17 | |||
| 931 | + | const AtomFont Atom = 18 | |||
| 932 | + | const AtomInteger Atom = 19 | |||
| 933 | + | const AtomPixmap Atom = 20 | |||
| 934 | + | const AtomPoint Atom = 21 | |||
| 935 | + | const AtomRectangle Atom = 22 | |||
| 936 | + | const AtomResourceManager Atom = 23 | |||
| 937 | + | const AtomRgbColorMap Atom = 24 | |||
| 938 | + | const AtomRgbBestMap Atom = 25 | |||
| 939 | + | const AtomRgbBlueMap Atom = 26 | |||
| 940 | + | const AtomRgbDefaultMap Atom = 27 | |||
| 941 | + | const AtomRgbGrayMap Atom = 28 | |||
| 942 | + | const AtomRgbGreenMap Atom = 29 | |||
| 943 | + | const AtomRgbRedMap Atom = 30 | |||
| 944 | + | const AtomString Atom = 31 | |||
| 945 | + | const AtomVisualid Atom = 32 | |||
| 946 | + | const AtomWindow Atom = 33 | |||
| 947 | + | const AtomWmCommand Atom = 34 | |||
| 948 | + | const AtomWmHints Atom = 35 | |||
| 949 | + | const AtomWmClientMachine Atom = 36 | |||
| 950 | + | const AtomWmIconName Atom = 37 | |||
| 951 | + | const AtomWmIconSize Atom = 38 | |||
| 952 | + | const AtomWmName Atom = 39 | |||
| 953 | + | const AtomWmNormalHints Atom = 40 | |||
| 954 | + | const AtomWmSizeHints Atom = 41 | |||
| 955 | + | const AtomWmZoomHints Atom = 42 | |||
| 956 | + | const AtomMinSpace Atom = 43 | |||
| 957 | + | const AtomNormSpace Atom = 44 | |||
| 958 | + | const AtomMaxSpace Atom = 45 | |||
| 959 | + | const AtomEndSpace Atom = 46 | |||
| 960 | + | const AtomSuperscriptX Atom = 47 | |||
| 961 | + | const AtomSuperscriptY Atom = 48 | |||
| 962 | + | const AtomSubscriptX Atom = 49 | |||
| 963 | + | const AtomSubscriptY Atom = 50 | |||
| 964 | + | const AtomUnderlinePosition Atom = 51 | |||
| 965 | + | const AtomUnderlineThickness Atom = 52 | |||
| 966 | + | const AtomStrikeoutAscent Atom = 53 | |||
| 967 | + | const AtomStrikeoutDescent Atom = 54 | |||
| 968 | + | const AtomItalicAngle Atom = 55 | |||
| 969 | + | const AtomXHeight Atom = 56 | |||
| 970 | + | const AtomQuadWidth Atom = 57 | |||
| 971 | + | const AtomWeight Atom = 58 | |||
| 972 | + | const AtomPointSize Atom = 59 | |||
| 973 | + | const AtomResolution Atom = 60 | |||
| 974 | + | const AtomCopyright Atom = 61 | |||
| 975 | + | const AtomNotice Atom = 62 | |||
| 976 | + | const AtomFontName Atom = 63 | |||
| 977 | + | const AtomFamilyName Atom = 64 | |||
| 978 | + | const AtomFullName Atom = 65 | |||
| 979 | + | const AtomCapHeight Atom = 66 | |||
| 980 | + | const AtomWmClass Atom = 67 | |||
| 981 | + | const AtomWmTransientFor Atom = 68 | |||
| 982 | + | ||||
| 983 | + | type ColormapState uint8 | |||
| 984 | + | ||||
| 985 | + | const ColormapStateUninstalled ColormapState = 0 | |||
| 986 | + | const ColormapStateInstalled ColormapState = 1 | |||
| 987 | + | ||||
| 988 | + | const ColormapNone Colormap = 0 | |||
| 989 | + | ||||
| 990 | + | type Mapping uint8 | |||
| 991 | + | ||||
| 992 | + | const MappingModifier Mapping = 0 | |||
| 993 | + | const MappingKeyboard Mapping = 1 | |||
| 994 | + | const MappingPointer Mapping = 2 | |||
| 995 | + | ||||
| 996 | + | type WindowClass uint16 | |||
| 997 | + | ||||
| 998 | + | const WindowClassCopyFromParent WindowClass = 0 | |||
| 999 | + | const WindowClassInputOutput WindowClass = 1 | |||
| 1000 | + | const WindowClassInputOnly WindowClass = 2 | |||
| 1001 | + | ||||
| 1002 | + | type Cw uint32 | |||
| 1003 | + | ||||
| 1004 | + | const CwBackPixmap Cw = 1 | |||
| 1005 | + | const CwBackPixel Cw = 2 | |||
| 1006 | + | const CwBorderPixmap Cw = 4 | |||
| 1007 | + | const CwBorderPixel Cw = 8 | |||
| 1008 | + | const CwBitGravity Cw = 16 | |||
| 1009 | + | const CwWinGravity Cw = 32 | |||
| 1010 | + | const CwBackingStore Cw = 64 | |||
| 1011 | + | const CwBackingPlanes Cw = 128 | |||
| 1012 | + | const CwBackingPixel Cw = 256 | |||
| 1013 | + | const CwOverrideRedirect Cw = 512 | |||
| 1014 | + | const CwSaveUnder Cw = 1024 | |||
| 1015 | + | const CwEventMask Cw = 2048 | |||
| 1016 | + | const CwDontPropagate Cw = 4096 | |||
| 1017 | + | const CwColormap Cw = 8192 | |||
| 1018 | + | const CwCursor Cw = 16384 | |||
| 1019 | + | ||||
| 1020 | + | type BackPixmap uint32 | |||
| 1021 | + | ||||
| 1022 | + | const BackPixmapNone BackPixmap = 0 | |||
| 1023 | + | const BackPixmapParentRelative BackPixmap = 1 | |||
| 1024 | + | ||||
| 1025 | + | type Gravity uint32 | |||
| 1026 | + | ||||
| 1027 | + | const GravityBitForget Gravity = 0 | |||
| 1028 | + | const GravityWinUnmap Gravity = 0 | |||
| 1029 | + | const GravityNorthWest Gravity = 1 | |||
| 1030 | + | const GravityNorth Gravity = 2 | |||
| 1031 | + | const GravityNorthEast Gravity = 3 | |||
| 1032 | + | const GravityWest Gravity = 4 | |||
| 1033 | + | const GravityCenter Gravity = 5 | |||
| 1034 | + | const GravityEast Gravity = 6 | |||
| 1035 | + | const GravitySouthWest Gravity = 7 | |||
| 1036 | + | const GravitySouth Gravity = 8 | |||
| 1037 | + | const GravitySouthEast Gravity = 9 | |||
| 1038 | + | const GravityStatic Gravity = 10 | |||
| 1039 | + | ||||
| 1040 | + | type MapState uint8 | |||
| 1041 | + | ||||
| 1042 | + | const MapStateUnmapped MapState = 0 | |||
| 1043 | + | const MapStateUnviewable MapState = 1 | |||
| 1044 | + | const MapStateViewable MapState = 2 | |||
| 1045 | + | ||||
| 1046 | + | type SetMode uint8 | |||
| 1047 | + | ||||
| 1048 | + | const SetModeInsert SetMode = 0 | |||
| 1049 | + | const SetModeDelete SetMode = 1 | |||
| 1050 | + | ||||
| 1051 | + | type ConfigWindow uint16 | |||
| 1052 | + | ||||
| 1053 | + | const ConfigWindowX ConfigWindow = 1 | |||
| 1054 | + | const ConfigWindowY ConfigWindow = 2 | |||
| 1055 | + | const ConfigWindowWidth ConfigWindow = 4 | |||
| 1056 | + | const ConfigWindowHeight ConfigWindow = 8 | |||
| 1057 | + | const ConfigWindowBorderWidth ConfigWindow = 16 | |||
| 1058 | + | const ConfigWindowSibling ConfigWindow = 32 | |||
| 1059 | + | const ConfigWindowStackMode ConfigWindow = 64 | |||
| 1060 | + | ||||
| 1061 | + | type StackMode uint32 | |||
| 1062 | + | ||||
| 1063 | + | const StackModeAbove StackMode = 0 | |||
| 1064 | + | const StackModeBelow StackMode = 1 | |||
| 1065 | + | const StackModeTopIf StackMode = 2 | |||
| 1066 | + | const StackModeBottomIf StackMode = 3 | |||
| 1067 | + | const StackModeOpposite StackMode = 4 | |||
| 1068 | + | ||||
| 1069 | + | type Circulate uint8 | |||
| 1070 | + | ||||
| 1071 | + | const CirculateRaiseLowest Circulate = 0 | |||
| 1072 | + | const CirculateLowerHighest Circulate = 1 | |||
| 1073 | + | ||||
| 1074 | + | type PropMode uint8 | |||
| 1075 | + | ||||
| 1076 | + | const PropModeReplace PropMode = 0 | |||
| 1077 | + | const PropModePrepend PropMode = 1 | |||
| 1078 | + | const PropModeAppend PropMode = 2 | |||
| 1079 | + | ||||
| 1080 | + | type GetPropertyType uint32 | |||
| 1081 | + | ||||
| 1082 | + | const GetPropertyTypeAny GetPropertyType = 0 | |||
| 1083 | + | ||||
| 1084 | + | type SendEventDest uint32 | |||
| 1085 | + | ||||
| 1086 | + | const SendEventDestPointerWindow SendEventDest = 0 | |||
| 1087 | + | const SendEventDestItemFocus SendEventDest = 1 | |||
| 1088 | + | ||||
| 1089 | + | type GrabMode uint8 | |||
| 1090 | + | ||||
| 1091 | + | const GrabModeSync GrabMode = 0 | |||
| 1092 | + | const GrabModeAsync GrabMode = 1 | |||
| 1093 | + | ||||
| 1094 | + | type GrabStatus uint8 | |||
| 1095 | + | ||||
| 1096 | + | const GrabStatusSuccess GrabStatus = 0 | |||
| 1097 | + | const GrabStatusAlreadyGrabbed GrabStatus = 1 | |||
| 1098 | + | const GrabStatusInvalidTime GrabStatus = 2 | |||
| 1099 | + | const GrabStatusNotViewable GrabStatus = 3 | |||
| 1100 | + | const GrabStatusFrozen GrabStatus = 4 | |||
| 1101 | + | ||||
| 1102 | + | const CursorNone Cursor = 0 | |||
| 1103 | + | ||||
| 1104 | + | type ButtonIndex uint8 | |||
| 1105 | + | ||||
| 1106 | + | const ButtonIndexAny ButtonIndex = 0 | |||
| 1107 | + | const ButtonIndexX1 ButtonIndex = 1 | |||
| 1108 | + | const ButtonIndexX2 ButtonIndex = 2 | |||
| 1109 | + | const ButtonIndexX3 ButtonIndex = 3 | |||
| 1110 | + | const ButtonIndexX4 ButtonIndex = 4 | |||
| 1111 | + | const ButtonIndexX5 ButtonIndex = 5 | |||
| 1112 | + | ||||
| 1113 | + | type Grab uint8 | |||
| 1114 | + | ||||
| 1115 | + | const GrabAny Grab = 0 | |||
| 1116 | + | ||||
| 1117 | + | type Allow uint8 | |||
| 1118 | + | ||||
| 1119 | + | const AllowAsyncPointer Allow = 0 | |||
| 1120 | + | const AllowSyncPointer Allow = 1 | |||
| 1121 | + | const AllowReplayPointer Allow = 2 | |||
| 1122 | + | const AllowAsyncKeyboard Allow = 3 | |||
| 1123 | + | const AllowSyncKeyboard Allow = 4 | |||
| 1124 | + | const AllowReplayKeyboard Allow = 5 | |||
| 1125 | + | const AllowAsyncBoth Allow = 6 | |||
| 1126 | + | const AllowSyncBoth Allow = 7 | |||
| 1127 | + | ||||
| 1128 | + | type InputFocus uint32 | |||
| 1129 | + | ||||
| 1130 | + | const InputFocusNone InputFocus = 0 | |||
| 1131 | + | const InputFocusPointerRoot InputFocus = 1 | |||
| 1132 | + | const InputFocusParent InputFocus = 2 | |||
| 1133 | + | const InputFocusFollowKeyboard InputFocus = 3 | |||
| 1134 | + | ||||
| 1135 | + | type FontDraw uint8 | |||
| 1136 | + | ||||
| 1137 | + | const FontDrawLeftToRight FontDraw = 0 | |||
| 1138 | + | const FontDrawRightToLeft FontDraw = 1 | |||
| 1139 | + | ||||
| 1140 | + | type Gc uint32 | |||
| 1141 | + | ||||
| 1142 | + | const GcFunction Gc = 1 | |||
| 1143 | + | const GcPlaneMask Gc = 2 | |||
| 1144 | + | const GcForeground Gc = 4 | |||
| 1145 | + | const GcBackground Gc = 8 | |||
| 1146 | + | const GcLineWidth Gc = 16 | |||
| 1147 | + | const GcLineStyle Gc = 32 | |||
| 1148 | + | const GcCapStyle Gc = 64 | |||
| 1149 | + | const GcJoinStyle Gc = 128 | |||
| 1150 | + | const GcFillStyle Gc = 256 | |||
| 1151 | + | const GcFillRule Gc = 512 | |||
| 1152 | + | const GcTile Gc = 1024 | |||
| 1153 | + | const GcStipple Gc = 2048 | |||
| 1154 | + | const GcTileStippleOriginX Gc = 4096 | |||
| 1155 | + | const GcTileStippleOriginY Gc = 8192 | |||
| 1156 | + | const GcFont Gc = 16384 | |||
| 1157 | + | const GcSubwindowMode Gc = 32768 | |||
| 1158 | + | const GcGraphicsExposures Gc = 65536 | |||
| 1159 | + | const GcClipOriginX Gc = 131072 | |||
| 1160 | + | const GcClipOriginY Gc = 262144 | |||
| 1161 | + | const GcClipMask Gc = 524288 | |||
| 1162 | + | const GcDashOffset Gc = 1048576 | |||
| 1163 | + | const GcDashList Gc = 2097152 | |||
| 1164 | + | const GcArcMode Gc = 4194304 | |||
| 1165 | + | ||||
| 1166 | + | type Gx uint32 | |||
| 1167 | + | ||||
| 1168 | + | const GxClear Gx = 0 | |||
| 1169 | + | const GxAnd Gx = 1 | |||
| 1170 | + | const GxAndReverse Gx = 2 | |||
| 1171 | + | const GxCopy Gx = 3 | |||
| 1172 | + | const GxAndInverted Gx = 4 | |||
| 1173 | + | const GxNoop Gx = 5 | |||
| 1174 | + | const GxXor Gx = 6 | |||
| 1175 | + | const GxOr Gx = 7 | |||
| 1176 | + | const GxNor Gx = 8 | |||
| 1177 | + | const GxEquiv Gx = 9 | |||
| 1178 | + | const GxInvert Gx = 10 | |||
| 1179 | + | const GxOrReverse Gx = 11 | |||
| 1180 | + | const GxCopyInverted Gx = 12 | |||
| 1181 | + | const GxOrInverted Gx = 13 | |||
| 1182 | + | const GxNand Gx = 14 | |||
| 1183 | + | const GxSet Gx = 15 | |||
| 1184 | + | ||||
| 1185 | + | type LineStyle uint32 | |||
| 1186 | + | ||||
| 1187 | + | const LineStyleSolid LineStyle = 0 | |||
| 1188 | + | const LineStyleOnOffDash LineStyle = 1 | |||
| 1189 | + | const LineStyleDoubleDash LineStyle = 2 | |||
| 1190 | + | ||||
| 1191 | + | type CapStyle uint32 | |||
| 1192 | + | ||||
| 1193 | + | const CapStyleNotLast CapStyle = 0 | |||
| 1194 | + | const CapStyleButt CapStyle = 1 | |||
| 1195 | + | const CapStyleRound CapStyle = 2 | |||
| 1196 | + | const CapStyleProjecting CapStyle = 3 | |||
| 1197 | + | ||||
| 1198 | + | type JoinStyle uint32 | |||
| 1199 | + | ||||
| 1200 | + | const JoinStyleMiter JoinStyle = 0 | |||
| 1201 | + | const JoinStyleRound JoinStyle = 1 | |||
| 1202 | + | const JoinStyleBevel JoinStyle = 2 | |||
| 1203 | + | ||||
| 1204 | + | type FillStyle uint32 | |||
| 1205 | + | ||||
| 1206 | + | const FillStyleSolid FillStyle = 0 | |||
| 1207 | + | const FillStyleTiled FillStyle = 1 | |||
| 1208 | + | const FillStyleStippled FillStyle = 2 | |||
| 1209 | + | const FillStyleOpaqueStippled FillStyle = 3 | |||
| 1210 | + | ||||
| 1211 | + | type FillRule uint32 | |||
| 1212 | + | ||||
| 1213 | + | const FillRuleEvenOdd FillRule = 0 | |||
| 1214 | + | const FillRuleWinding FillRule = 1 | |||
| 1215 | + | ||||
| 1216 | + | type SubwindowMode uint32 | |||
| 1217 | + | ||||
| 1218 | + | const SubwindowModeClipByChildren SubwindowMode = 0 | |||
| 1219 | + | const SubwindowModeIncludeInferiors SubwindowMode = 1 | |||
| 1220 | + | ||||
| 1221 | + | type ArcMode uint32 | |||
| 1222 | + | ||||
| 1223 | + | const ArcModeChord ArcMode = 0 | |||
| 1224 | + | const ArcModePieSlice ArcMode = 1 | |||
| 1225 | + | ||||
| 1226 | + | type ClipOrdering uint8 | |||
| 1227 | + | ||||
| 1228 | + | const ClipOrderingUnsorted ClipOrdering = 0 | |||
| 1229 | + | const ClipOrderingYSorted ClipOrdering = 1 | |||
| 1230 | + | const ClipOrderingYXSorted ClipOrdering = 2 | |||
| 1231 | + | const ClipOrderingYXBanded ClipOrdering = 3 | |||
| 1232 | + | ||||
| 1233 | + | type CoordMode uint8 | |||
| 1234 | + | ||||
| 1235 | + | const CoordModeOrigin CoordMode = 0 | |||
| 1236 | + | const CoordModePrevious CoordMode = 1 | |||
| 1237 | + | ||||
| 1238 | + | type PolyShape uint8 | |||
| 1239 | + | ||||
| 1240 | + | const PolyShapeComplex PolyShape = 0 | |||
| 1241 | + | const PolyShapeNonconvex PolyShape = 1 | |||
| 1242 | + | const PolyShapeConvex PolyShape = 2 | |||
| 1243 | + | ||||
| 1244 | + | type ImageFormat uint8 | |||
| 1245 | + | ||||
| 1246 | + | const ImageFormatXYBitmap ImageFormat = 0 | |||
| 1247 | + | const ImageFormatXYPixmap ImageFormat = 1 | |||
| 1248 | + | const ImageFormatZPixmap ImageFormat = 2 | |||
| 1249 | + | ||||
| 1250 | + | type ColormapAlloc uint8 | |||
| 1251 | + | ||||
| 1252 | + | const ColormapAllocNone ColormapAlloc = 0 | |||
| 1253 | + | const ColormapAllocAll ColormapAlloc = 1 | |||
| 1254 | + | ||||
| 1255 | + | type ColorFlag uint8 | |||
| 1256 | + | ||||
| 1257 | + | const ColorFlagRed ColorFlag = 1 | |||
| 1258 | + | const ColorFlagGreen ColorFlag = 2 | |||
| 1259 | + | const ColorFlagBlue ColorFlag = 4 | |||
| 1260 | + | ||||
| 1261 | + | const PixmapNone Pixmap = 0 | |||
| 1262 | + | ||||
| 1263 | + | const FontNone Font = 0 | |||
| 1264 | + | ||||
| 1265 | + | type QueryShapeOf uint8 | |||
| 1266 | + | ||||
| 1267 | + | const QueryShapeOfLargestCursor QueryShapeOf = 0 | |||
| 1268 | + | const QueryShapeOfFastestTile QueryShapeOf = 1 | |||
| 1269 | + | const QueryShapeOfFastestStipple QueryShapeOf = 2 | |||
| 1270 | + | ||||
| 1271 | + | type Kb uint32 | |||
| 1272 | + | ||||
| 1273 | + | const KbKeyClickPercent Kb = 1 | |||
| 1274 | + | const KbBellPercent Kb = 2 | |||
| 1275 | + | const KbBellPitch Kb = 4 | |||
| 1276 | + | const KbBellDuration Kb = 8 | |||
| 1277 | + | const KbLed Kb = 16 | |||
| 1278 | + | const KbLedMode Kb = 32 | |||
| 1279 | + | const KbKey Kb = 64 | |||
| 1280 | + | const KbAutoRepeatMode Kb = 128 | |||
| 1281 | + | ||||
| 1282 | + | type LedMode uint32 | |||
| 1283 | + | ||||
| 1284 | + | const LedModeOff LedMode = 0 | |||
| 1285 | + | const LedModeOn LedMode = 1 | |||
| 1286 | + | ||||
| 1287 | + | type AutoRepeatMode uint32 | |||
| 1288 | + | ||||
| 1289 | + | const AutoRepeatModeOff AutoRepeatMode = 0 | |||
| 1290 | + | const AutoRepeatModeOn AutoRepeatMode = 1 | |||
| 1291 | + | const AutoRepeatModeDefault AutoRepeatMode = 2 | |||
| 1292 | + | ||||
| 1293 | + | type Blanking uint8 | |||
| 1294 | + | ||||
| 1295 | + | const BlankingNotPreferred Blanking = 0 | |||
| 1296 | + | const BlankingPreferred Blanking = 1 | |||
| 1297 | + | const BlankingDefault Blanking = 2 | |||
| 1298 | + | ||||
| 1299 | + | type Exposures uint8 | |||
| 1300 | + | ||||
| 1301 | + | const ExposuresNotAllowed Exposures = 0 | |||
| 1302 | + | const ExposuresAllowed Exposures = 1 | |||
| 1303 | + | const ExposuresDefault Exposures = 2 | |||
| 1304 | + | ||||
| 1305 | + | type HostMode uint8 | |||
| 1306 | + | ||||
| 1307 | + | const HostModeInsert HostMode = 0 | |||
| 1308 | + | const HostModeDelete HostMode = 1 | |||
| 1309 | + | ||||
| 1310 | + | type Family uint8 | |||
| 1311 | + | ||||
| 1312 | + | const FamilyInternet Family = 0 | |||
| 1313 | + | const FamilyDECnet Family = 1 | |||
| 1314 | + | const FamilyChaos Family = 2 | |||
| 1315 | + | const FamilyServerInterpreted Family = 5 | |||
| 1316 | + | const FamilyInternet6 Family = 6 | |||
| 1317 | + | ||||
| 1318 | + | type AccessControl uint8 | |||
| 1319 | + | ||||
| 1320 | + | const AccessControlDisable AccessControl = 0 | |||
| 1321 | + | const AccessControlEnable AccessControl = 1 | |||
| 1322 | + | ||||
| 1323 | + | type CloseDown uint8 | |||
| 1324 | + | ||||
| 1325 | + | const CloseDownDestroyAll CloseDown = 0 | |||
| 1326 | + | const CloseDownRetainPermanent CloseDown = 1 | |||
| 1327 | + | const CloseDownRetainTemporary CloseDown = 2 | |||
| 1328 | + | ||||
| 1329 | + | type Kill uint32 | |||
| 1330 | + | ||||
| 1331 | + | const KillAllTemporary Kill = 0 | |||
| 1332 | + | ||||
| 1333 | + | type ScreenSaver uint8 | |||
| 1334 | + | ||||
| 1335 | + | const ScreenSaverReset ScreenSaver = 0 | |||
| 1336 | + | const ScreenSaverActive ScreenSaver = 1 | |||
| 1337 | + | ||||
| 1338 | + | type MappingStatus uint8 | |||
| 1339 | + | ||||
| 1340 | + | const MappingStatusSuccess MappingStatus = 0 | |||
| 1341 | + | const MappingStatusBusy MappingStatus = 1 | |||
| 1342 | + | const MappingStatusFailure MappingStatus = 2 | |||
| 1343 | + | ||||
| 1344 | + | type MapIndex uint32 | |||
| 1345 | + | ||||
| 1346 | + | const MapIndexShift MapIndex = 0 | |||
| 1347 | + | const MapIndexLock MapIndex = 1 | |||
| 1348 | + | const MapIndexControl MapIndex = 2 | |||
| 1349 | + | const MapIndexX1 MapIndex = 3 | |||
| 1350 | + | const MapIndexX2 MapIndex = 4 | |||
| 1351 | + | const MapIndexX3 MapIndex = 5 | |||
| 1352 | + | const MapIndexX4 MapIndex = 6 | |||
| 1353 | + | const MapIndexX5 MapIndex = 7 | |||
A xproto/types_test.go +54 -0
| @@ -0,0 +1,54 @@ | |||
| 1 | + | package xproto | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "encoding/binary" | |
| 5 | + | "testing" | |
| 6 | + | ) | |
| 7 | + | ||
| 8 | + | func TestRectangleWire(t *testing.T) { | |
| 9 | + | v := Rectangle{X: -2, Y: 3, Width: 640, Height: 480} | |
| 10 | + | var p [8]byte | |
| 11 | + | v.Put(p[:]) | |
| 12 | + | want := [8]byte{254, 255, 3, 0, 128, 2, 224, 1} | |
| 13 | + | if p != want || GetRectangle(p[:]) != v { | |
| 14 | + | t.Fatalf("wire %x", p) | |
| 15 | + | } | |
| 16 | + | } | |
| 17 | + | func TestVariableStructWire(t *testing.T) { | |
| 18 | + | v := Str{NameLen: 3, Name: "abc"} | |
| 19 | + | p := make([]byte, v.Size()) | |
| 20 | + | v.Put(p) | |
| 21 | + | if string(p) != "\x03abc" { | |
| 22 | + | t.Fatalf("wire %x", p) | |
| 23 | + | } | |
| 24 | + | s := SetupRequest{ByteOrder: 'l', ProtocolMajorVersion: 11, AuthorizationProtocolNameLen: 1, AuthorizationProtocolDataLen: 2, AuthorizationProtocolName: "a", AuthorizationProtocolData: "bc"} | |
| 25 | + | p = make([]byte, s.Size()) | |
| 26 | + | s.Put(p) | |
| 27 | + | if len(p) != 20 || p[12] != 'a' || p[16] != 'b' || p[17] != 'c' || p[19] != 0 { | |
| 28 | + | t.Fatalf("aligned setup %x", p) | |
| 29 | + | } | |
| 30 | + | } | |
| 31 | + | func TestUnionView(t *testing.T) { | |
| 32 | + | var p [20]byte | |
| 33 | + | binary.LittleEndian.PutUint32(p[:], 0x12345678) | |
| 34 | + | v := GetClientMessageData(p[:]) | |
| 35 | + | if v.Data8()[0] != 0x78 || v.Data16()[0] != 0x5678 || v.Data32()[0] != 0x12345678 { | |
| 36 | + | t.Fatal("union members") | |
| 37 | + | } | |
| 38 | + | } | |
| 39 | + | func TestAllocStructPut(t *testing.T) { | |
| 40 | + | v := Rectangle{Width: 10} | |
| 41 | + | var p [8]byte | |
| 42 | + | if n := testing.AllocsPerRun(1000, func() { v.Put(p[:]); _ = GetRectangle(p[:]) }); n != 0 { | |
| 43 | + | t.Fatal(n) | |
| 44 | + | } | |
| 45 | + | } | |
| 46 | + | ||
| 47 | + | func BenchmarkRectanglePut(b *testing.B) { | |
| 48 | + | v := Rectangle{Width: 640, Height: 480} | |
| 49 | + | var p [8]byte | |
| 50 | + | b.ReportAllocs() | |
| 51 | + | for b.Loop() { | |
| 52 | + | v.Put(p[:]) | |
| 53 | + | } | |
| 54 | + | } | |
| @@ -0,0 +1,54 @@ | |||||
| 1 | + | package xproto | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "encoding/binary" | |||
| 5 | + | "testing" | |||
| 6 | + | ) | |||
| 7 | + | ||||
| 8 | + | func TestRectangleWire(t *testing.T) { | |||
| 9 | + | v := Rectangle{X: -2, Y: 3, Width: 640, Height: 480} | |||
| 10 | + | var p [8]byte | |||
| 11 | + | v.Put(p[:]) | |||
| 12 | + | want := [8]byte{254, 255, 3, 0, 128, 2, 224, 1} | |||
| 13 | + | if p != want || GetRectangle(p[:]) != v { | |||
| 14 | + | t.Fatalf("wire %x", p) | |||
| 15 | + | } | |||
| 16 | + | } | |||
| 17 | + | func TestVariableStructWire(t *testing.T) { | |||
| 18 | + | v := Str{NameLen: 3, Name: "abc"} | |||
| 19 | + | p := make([]byte, v.Size()) | |||
| 20 | + | v.Put(p) | |||
| 21 | + | if string(p) != "\x03abc" { | |||
| 22 | + | t.Fatalf("wire %x", p) | |||
| 23 | + | } | |||
| 24 | + | s := SetupRequest{ByteOrder: 'l', ProtocolMajorVersion: 11, AuthorizationProtocolNameLen: 1, AuthorizationProtocolDataLen: 2, AuthorizationProtocolName: "a", AuthorizationProtocolData: "bc"} | |||
| 25 | + | p = make([]byte, s.Size()) | |||
| 26 | + | s.Put(p) | |||
| 27 | + | if len(p) != 20 || p[12] != 'a' || p[16] != 'b' || p[17] != 'c' || p[19] != 0 { | |||
| 28 | + | t.Fatalf("aligned setup %x", p) | |||
| 29 | + | } | |||
| 30 | + | } | |||
| 31 | + | func TestUnionView(t *testing.T) { | |||
| 32 | + | var p [20]byte | |||
| 33 | + | binary.LittleEndian.PutUint32(p[:], 0x12345678) | |||
| 34 | + | v := GetClientMessageData(p[:]) | |||
| 35 | + | if v.Data8()[0] != 0x78 || v.Data16()[0] != 0x5678 || v.Data32()[0] != 0x12345678 { | |||
| 36 | + | t.Fatal("union members") | |||
| 37 | + | } | |||
| 38 | + | } | |||
| 39 | + | func TestAllocStructPut(t *testing.T) { | |||
| 40 | + | v := Rectangle{Width: 10} | |||
| 41 | + | var p [8]byte | |||
| 42 | + | if n := testing.AllocsPerRun(1000, func() { v.Put(p[:]); _ = GetRectangle(p[:]) }); n != 0 { | |||
| 43 | + | t.Fatal(n) | |||
| 44 | + | } | |||
| 45 | + | } | |||
| 46 | + | ||||
| 47 | + | func BenchmarkRectanglePut(b *testing.B) { | |||
| 48 | + | v := Rectangle{Width: 640, Height: 480} | |||
| 49 | + | var p [8]byte | |||
| 50 | + | b.ReportAllocs() | |||
| 51 | + | for b.Loop() { | |||
| 52 | + | v.Put(p[:]) | |||
| 53 | + | } | |||
| 54 | + | } | |||
Comments4 open / 4
bnema outdated
T2.1 implemented: strict source-located XML AST for all 9 pinned modules, rejection tests, parser fuzz seed. Local make check and CGO_ENABLED=0 go build ./... pass; 3-second parser fuzz run passed (416270 executions). T1.1 is on main (ba4ad52), CI run 221 green, repo public. Stopped before T2.2/T2.3 for a public naming-contract decision: xproto WINDOW xidtype and Window enum both map to Go Window under the specified rules (likewise ATOM/Atom, CURSOR/Cursor, PIXMAP/Pixmap, FONT/Font; render PICTURE/Picture). Should these enums reuse the XID type for constants, or receive a distinct name (please specify the naming rule)? No workaround chosen. T2.4 must wait for T2.2/T2.3; AST preserves expressions, imports, attributes and XML field order. No goldens captured yet.
bnema outdated
T2.2 (85a51dd) and T2.3 are implemented. Applied the decided enum/XID type reuse rule; other declaration collisions are fatal. All nine packages compile; manifest-ordered root ExtIDs, type/struct/union encoders and size checks are generated. Fixed requests include core data-byte handling, negotiated extension major opcodes, padding and sticky-error guards. Full make check passed independently after each task (unfiltered output), CGO-disabled build passed, request/Buf allocation tests passed, and benchmarks show 0 B/op, 0 allocs/op. Local xtrace is glibc execution tracing, so the permitted raw socketpair tee fallback captures independent reference encodings accepted by Xvfb. Three request goldens committed; capture update also passes with race enabled. Decisions: variable structs have owned encoding forms now (borrowed View/Iter APIs remain with list/reply tasks); generation wiring brought forward so gen-check verifies this work. xfixes signatures use render/shape types where the XML imports require them (matching actual wire types). T2.4: extend resolveRequests beyond its explicit list/switch gate, lower AST length expressions with renderExpr, add derived-length and mismatch handling, extend independent capture encoder for InternAtom/ChangeProperty/res.QueryClientIds. Buf already supports aligned reservation, zeroing, sticky errors and growth; transport/ack updates remain Phase 3. CI 222 and 223 green; checking latest run next. Keep this MR draft; do not merge.
bnema outdated
Final verification: CI 224 logs show make check and make xserver passed, as did gen-check. Additional local 10-second parser fuzz run passed (~3.57 million executions); clean CGO_ENABLED=0 go test -count=1 ./... and go build ./... passed. Both signed task commits verified with GPG. Working trees clean, origin is ermite only; MR remains WIP/unmerged.
bnema outdated
T2.4 completed in signed commit 582be88. Full make check and make xserver passed; CGO_ENABLED=0 build passed; independent raw socketpair/Xvfb tee captured InternAtom, ChangeProperty (GetProperty read-back), and XRes QueryClientIds (negotiated XRes 1.2). Race-enabled capture update passed. Allocation tests cover InternAtom, 4 KiB ChangeProperty, and fixed struct lists; all zero. Benchmarks: InternAtom 7.714 ns/op, ChangeProperty4KiB 73.58 ns/op, both 0 B/op and 0 allocs/op. Decisions: support implicit list-name_len refs used by QueryTextExtents only when no explicit field exists; reject derived length truncation with ErrBadLength; bring SendEvent fixed-array signature forward from the explicit public contract. T2.5 should remove the switch gate in resolveRequests and implement typed Values structs/setters; request list sizes/offsets now use running body offsets, with final four-byte rounding. Shared lengths stay explicit (e.g. render AddGlyphs); variable structs use Size/Put. T2.5–T2.8 and T3.1–T3.5 not started; stopping at this clean boundary due to long context. Same branch/worktree, MR draft, no tag.