1// Code generated by xtgen; DO NOT EDIT.
2package xproto
3
4import "encoding/binary"
5
6type Char2b struct {
7 Byte1 uint8
8 Byte2 uint8
9}
10
11const Char2bSize = 2
12
13func (v Char2b) Put(p []byte) { clear(p[:2]); p[0:][0] = byte(v.Byte1); p[1:][0] = byte(v.Byte2) }
14func 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
21type Window uint32
22
23type Pixmap uint32
24
25type Cursor uint32
26
27type Font uint32
28
29type Gcontext uint32
30
31type Colormap uint32
32
33type Atom uint32
34
35type Drawable uint32
36
37type Fontable uint32
38
39type Bool32 uint32
40
41type Visualid uint32
42
43type Timestamp uint32
44
45type Keysym uint32
46
47type Keycode uint8
48
49type Keycode32 uint32
50
51type Button uint8
52
53type Point struct {
54 X int16
55 Y int16
56}
57
58const PointSize = 4
59
60func (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}
65func 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
72type Rectangle struct {
73 X int16
74 Y int16
75 Width uint16
76 Height uint16
77}
78
79const RectangleSize = 8
80
81func (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}
88func 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
97type Arc struct {
98 X int16
99 Y int16
100 Width uint16
101 Height uint16
102 Angle1 int16
103 Angle2 int16
104}
105
106const ArcSize = 12
107
108func (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}
117func 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
128type Format struct {
129 Depth uint8
130 BitsPerPixel uint8
131 ScanlinePad uint8
132}
133
134const FormatSize = 8
135
136func (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}
142func 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
150type 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
160const VisualtypeSize = 24
161
162func (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}
172func 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
184type Depth struct {
185 Depth uint8
186 VisualsLen uint16
187 Visuals []Visualtype
188}
189
190const DepthSize = 8
191
192func (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}
201func (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
217type 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
237const ScreenSize = 40
238
239func (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}
262func (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
306type 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
316const SetupRequestSize = 12
317
318func (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}
333func (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
369type SetupFailed struct {
370 Status uint8
371 ReasonLen uint8
372 ProtocolMajorVersion uint16
373 ProtocolMinorVersion uint16
374 Length uint16
375 Reason string
376}
377
378const SetupFailedSize = 8
379
380func (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}
390func (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
408type SetupAuthenticate struct {
409 Status uint8
410 Length uint16
411 Reason string
412}
413
414const SetupAuthenticateSize = 8
415
416func (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}
424func (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
438type 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
462const SetupSize = 40
463
464func (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}
494func (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
555type ClientMessageData struct{ raw []byte }
556
557const ClientMessageDataSize = 20
558
559func GetClientMessageData(p []byte) ClientMessageData { return ClientMessageData{raw: p[:20]} }
560func (v ClientMessageData) Put(p []byte) { copy(p[:20], v.raw) }
561func (v ClientMessageData) Data8() (out [20]uint8) {
562 for i := range out {
563 out[i] = uint8(v.raw[i*1:][0])
564 }
565 return
566}
567func (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}
573func (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
580type Timecoord struct {
581 Time Timestamp
582 X int16
583 Y int16
584}
585
586const TimecoordSize = 8
587
588func (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}
594func 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
602type Fontprop struct {
603 Name Atom
604 Value uint32
605}
606
607const FontpropSize = 8
608
609func (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}
614func 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
621type Charinfo struct {
622 LeftSideBearing int16
623 RightSideBearing int16
624 CharacterWidth int16
625 Ascent int16
626 Descent int16
627 Attributes uint16
628}
629
630const CharinfoSize = 12
631
632func (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}
641func 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
652type Str struct {
653 NameLen uint8
654 Name string
655}
656
657const StrSize = 1
658
659func (v Str) Size() int { off := 0; off += 1; off += len(v.Name) * 1; return off }
660func (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
670type Segment struct {
671 X1 int16
672 Y1 int16
673 X2 int16
674 Y2 int16
675}
676
677const SegmentSize = 8
678
679func (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}
686func 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
695type Coloritem struct {
696 Pixel uint32
697 Red uint16
698 Green uint16
699 Blue uint16
700 Flags ColorFlag
701}
702
703const ColoritemSize = 12
704
705func (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}
713func 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
723type Rgb struct {
724 Red uint16
725 Green uint16
726 Blue uint16
727}
728
729const RgbSize = 8
730
731func (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}
737func 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
745type Host struct {
746 Family Family
747 AddressLen uint16
748 Address []byte
749}
750
751const HostSize = 4
752
753func (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}
762func (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
781type VisualClass uint8
782
783const VisualClassStaticGray VisualClass = 0
784const VisualClassGrayScale VisualClass = 1
785const VisualClassStaticColor VisualClass = 2
786const VisualClassPseudoColor VisualClass = 3
787const VisualClassTrueColor VisualClass = 4
788const VisualClassDirectColor VisualClass = 5
789
790type EventMask uint32
791
792const EventMaskNoEvent EventMask = 0
793const EventMaskKeyPress EventMask = 1
794const EventMaskKeyRelease EventMask = 2
795const EventMaskButtonPress EventMask = 4
796const EventMaskButtonRelease EventMask = 8
797const EventMaskEnterWindow EventMask = 16
798const EventMaskLeaveWindow EventMask = 32
799const EventMaskPointerMotion EventMask = 64
800const EventMaskPointerMotionHint EventMask = 128
801const EventMaskButton1Motion EventMask = 256
802const EventMaskButton2Motion EventMask = 512
803const EventMaskButton3Motion EventMask = 1024
804const EventMaskButton4Motion EventMask = 2048
805const EventMaskButton5Motion EventMask = 4096
806const EventMaskButtonMotion EventMask = 8192
807const EventMaskKeymapState EventMask = 16384
808const EventMaskExposure EventMask = 32768
809const EventMaskVisibilityChange EventMask = 65536
810const EventMaskStructureNotify EventMask = 131072
811const EventMaskResizeRedirect EventMask = 262144
812const EventMaskSubstructureNotify EventMask = 524288
813const EventMaskSubstructureRedirect EventMask = 1048576
814const EventMaskFocusChange EventMask = 2097152
815const EventMaskPropertyChange EventMask = 4194304
816const EventMaskColorMapChange EventMask = 8388608
817const EventMaskOwnerGrabButton EventMask = 16777216
818
819type BackingStore uint32
820
821const BackingStoreNotUseful BackingStore = 0
822const BackingStoreWhenMapped BackingStore = 1
823const BackingStoreAlways BackingStore = 2
824
825type ImageOrder uint8
826
827const ImageOrderLSBFirst ImageOrder = 0
828const ImageOrderMSBFirst ImageOrder = 1
829
830type ModMask uint16
831
832const ModMaskShift ModMask = 1
833const ModMaskLock ModMask = 2
834const ModMaskControl ModMask = 4
835const ModMaskX1 ModMask = 8
836const ModMaskX2 ModMask = 16
837const ModMaskX3 ModMask = 32
838const ModMaskX4 ModMask = 64
839const ModMaskX5 ModMask = 128
840const ModMaskAny ModMask = 32768
841
842type KeyButMask uint16
843
844const KeyButMaskShift KeyButMask = 1
845const KeyButMaskLock KeyButMask = 2
846const KeyButMaskControl KeyButMask = 4
847const KeyButMaskMod1 KeyButMask = 8
848const KeyButMaskMod2 KeyButMask = 16
849const KeyButMaskMod3 KeyButMask = 32
850const KeyButMaskMod4 KeyButMask = 64
851const KeyButMaskMod5 KeyButMask = 128
852const KeyButMaskButton1 KeyButMask = 256
853const KeyButMaskButton2 KeyButMask = 512
854const KeyButMaskButton3 KeyButMask = 1024
855const KeyButMaskButton4 KeyButMask = 2048
856const KeyButMaskButton5 KeyButMask = 4096
857
858const WindowNone Window = 0
859
860type ButtonMask uint32
861
862const ButtonMaskX1 ButtonMask = 256
863const ButtonMaskX2 ButtonMask = 512
864const ButtonMaskX3 ButtonMask = 1024
865const ButtonMaskX4 ButtonMask = 2048
866const ButtonMaskX5 ButtonMask = 4096
867const ButtonMaskAny ButtonMask = 32768
868
869type Motion uint8
870
871const MotionNormal Motion = 0
872const MotionHint Motion = 1
873
874type NotifyDetail uint8
875
876const NotifyDetailAncestor NotifyDetail = 0
877const NotifyDetailVirtual NotifyDetail = 1
878const NotifyDetailInferior NotifyDetail = 2
879const NotifyDetailNonlinear NotifyDetail = 3
880const NotifyDetailNonlinearVirtual NotifyDetail = 4
881const NotifyDetailPointer NotifyDetail = 5
882const NotifyDetailPointerRoot NotifyDetail = 6
883const NotifyDetailNone NotifyDetail = 7
884
885type NotifyMode uint8
886
887const NotifyModeNormal NotifyMode = 0
888const NotifyModeGrab NotifyMode = 1
889const NotifyModeUngrab NotifyMode = 2
890const NotifyModeWhileGrabbed NotifyMode = 3
891
892type Visibility uint8
893
894const VisibilityUnobscured Visibility = 0
895const VisibilityPartiallyObscured Visibility = 1
896const VisibilityFullyObscured Visibility = 2
897
898type Place uint8
899
900const PlaceOnTop Place = 0
901const PlaceOnBottom Place = 1
902
903type Property uint8
904
905const PropertyNewValue Property = 0
906const PropertyDelete Property = 1
907
908type Time uint32
909
910const TimeCurrentTime Time = 0
911
912const AtomNone Atom = 0
913const AtomAny Atom = 0
914const AtomPrimary Atom = 1
915const AtomSecondary Atom = 2
916const AtomArc Atom = 3
917const AtomAtom Atom = 4
918const AtomBitmap Atom = 5
919const AtomCardinal Atom = 6
920const AtomColormap Atom = 7
921const AtomCursor Atom = 8
922const AtomCutBuffer0 Atom = 9
923const AtomCutBuffer1 Atom = 10
924const AtomCutBuffer2 Atom = 11
925const AtomCutBuffer3 Atom = 12
926const AtomCutBuffer4 Atom = 13
927const AtomCutBuffer5 Atom = 14
928const AtomCutBuffer6 Atom = 15
929const AtomCutBuffer7 Atom = 16
930const AtomDrawable Atom = 17
931const AtomFont Atom = 18
932const AtomInteger Atom = 19
933const AtomPixmap Atom = 20
934const AtomPoint Atom = 21
935const AtomRectangle Atom = 22
936const AtomResourceManager Atom = 23
937const AtomRgbColorMap Atom = 24
938const AtomRgbBestMap Atom = 25
939const AtomRgbBlueMap Atom = 26
940const AtomRgbDefaultMap Atom = 27
941const AtomRgbGrayMap Atom = 28
942const AtomRgbGreenMap Atom = 29
943const AtomRgbRedMap Atom = 30
944const AtomString Atom = 31
945const AtomVisualid Atom = 32
946const AtomWindow Atom = 33
947const AtomWmCommand Atom = 34
948const AtomWmHints Atom = 35
949const AtomWmClientMachine Atom = 36
950const AtomWmIconName Atom = 37
951const AtomWmIconSize Atom = 38
952const AtomWmName Atom = 39
953const AtomWmNormalHints Atom = 40
954const AtomWmSizeHints Atom = 41
955const AtomWmZoomHints Atom = 42
956const AtomMinSpace Atom = 43
957const AtomNormSpace Atom = 44
958const AtomMaxSpace Atom = 45
959const AtomEndSpace Atom = 46
960const AtomSuperscriptX Atom = 47
961const AtomSuperscriptY Atom = 48
962const AtomSubscriptX Atom = 49
963const AtomSubscriptY Atom = 50
964const AtomUnderlinePosition Atom = 51
965const AtomUnderlineThickness Atom = 52
966const AtomStrikeoutAscent Atom = 53
967const AtomStrikeoutDescent Atom = 54
968const AtomItalicAngle Atom = 55
969const AtomXHeight Atom = 56
970const AtomQuadWidth Atom = 57
971const AtomWeight Atom = 58
972const AtomPointSize Atom = 59
973const AtomResolution Atom = 60
974const AtomCopyright Atom = 61
975const AtomNotice Atom = 62
976const AtomFontName Atom = 63
977const AtomFamilyName Atom = 64
978const AtomFullName Atom = 65
979const AtomCapHeight Atom = 66
980const AtomWmClass Atom = 67
981const AtomWmTransientFor Atom = 68
982
983type ColormapState uint8
984
985const ColormapStateUninstalled ColormapState = 0
986const ColormapStateInstalled ColormapState = 1
987
988const ColormapNone Colormap = 0
989
990type Mapping uint8
991
992const MappingModifier Mapping = 0
993const MappingKeyboard Mapping = 1
994const MappingPointer Mapping = 2
995
996type WindowClass uint16
997
998const WindowClassCopyFromParent WindowClass = 0
999const WindowClassInputOutput WindowClass = 1
1000const WindowClassInputOnly WindowClass = 2
1001
1002type Cw uint32
1003
1004const CwBackPixmap Cw = 1
1005const CwBackPixel Cw = 2
1006const CwBorderPixmap Cw = 4
1007const CwBorderPixel Cw = 8
1008const CwBitGravity Cw = 16
1009const CwWinGravity Cw = 32
1010const CwBackingStore Cw = 64
1011const CwBackingPlanes Cw = 128
1012const CwBackingPixel Cw = 256
1013const CwOverrideRedirect Cw = 512
1014const CwSaveUnder Cw = 1024
1015const CwEventMask Cw = 2048
1016const CwDontPropagate Cw = 4096
1017const CwColormap Cw = 8192
1018const CwCursor Cw = 16384
1019
1020type BackPixmap uint32
1021
1022const BackPixmapNone BackPixmap = 0
1023const BackPixmapParentRelative BackPixmap = 1
1024
1025type Gravity uint32
1026
1027const GravityBitForget Gravity = 0
1028const GravityWinUnmap Gravity = 0
1029const GravityNorthWest Gravity = 1
1030const GravityNorth Gravity = 2
1031const GravityNorthEast Gravity = 3
1032const GravityWest Gravity = 4
1033const GravityCenter Gravity = 5
1034const GravityEast Gravity = 6
1035const GravitySouthWest Gravity = 7
1036const GravitySouth Gravity = 8
1037const GravitySouthEast Gravity = 9
1038const GravityStatic Gravity = 10
1039
1040type MapState uint8
1041
1042const MapStateUnmapped MapState = 0
1043const MapStateUnviewable MapState = 1
1044const MapStateViewable MapState = 2
1045
1046type SetMode uint8
1047
1048const SetModeInsert SetMode = 0
1049const SetModeDelete SetMode = 1
1050
1051type ConfigWindow uint16
1052
1053const ConfigWindowX ConfigWindow = 1
1054const ConfigWindowY ConfigWindow = 2
1055const ConfigWindowWidth ConfigWindow = 4
1056const ConfigWindowHeight ConfigWindow = 8
1057const ConfigWindowBorderWidth ConfigWindow = 16
1058const ConfigWindowSibling ConfigWindow = 32
1059const ConfigWindowStackMode ConfigWindow = 64
1060
1061type StackMode uint32
1062
1063const StackModeAbove StackMode = 0
1064const StackModeBelow StackMode = 1
1065const StackModeTopIf StackMode = 2
1066const StackModeBottomIf StackMode = 3
1067const StackModeOpposite StackMode = 4
1068
1069type Circulate uint8
1070
1071const CirculateRaiseLowest Circulate = 0
1072const CirculateLowerHighest Circulate = 1
1073
1074type PropMode uint8
1075
1076const PropModeReplace PropMode = 0
1077const PropModePrepend PropMode = 1
1078const PropModeAppend PropMode = 2
1079
1080type GetPropertyType uint32
1081
1082const GetPropertyTypeAny GetPropertyType = 0
1083
1084type SendEventDest uint32
1085
1086const SendEventDestPointerWindow SendEventDest = 0
1087const SendEventDestItemFocus SendEventDest = 1
1088
1089type GrabMode uint8
1090
1091const GrabModeSync GrabMode = 0
1092const GrabModeAsync GrabMode = 1
1093
1094type GrabStatus uint8
1095
1096const GrabStatusSuccess GrabStatus = 0
1097const GrabStatusAlreadyGrabbed GrabStatus = 1
1098const GrabStatusInvalidTime GrabStatus = 2
1099const GrabStatusNotViewable GrabStatus = 3
1100const GrabStatusFrozen GrabStatus = 4
1101
1102const CursorNone Cursor = 0
1103
1104type ButtonIndex uint8
1105
1106const ButtonIndexAny ButtonIndex = 0
1107const ButtonIndexX1 ButtonIndex = 1
1108const ButtonIndexX2 ButtonIndex = 2
1109const ButtonIndexX3 ButtonIndex = 3
1110const ButtonIndexX4 ButtonIndex = 4
1111const ButtonIndexX5 ButtonIndex = 5
1112
1113type Grab uint8
1114
1115const GrabAny Grab = 0
1116
1117type Allow uint8
1118
1119const AllowAsyncPointer Allow = 0
1120const AllowSyncPointer Allow = 1
1121const AllowReplayPointer Allow = 2
1122const AllowAsyncKeyboard Allow = 3
1123const AllowSyncKeyboard Allow = 4
1124const AllowReplayKeyboard Allow = 5
1125const AllowAsyncBoth Allow = 6
1126const AllowSyncBoth Allow = 7
1127
1128type InputFocus uint32
1129
1130const InputFocusNone InputFocus = 0
1131const InputFocusPointerRoot InputFocus = 1
1132const InputFocusParent InputFocus = 2
1133const InputFocusFollowKeyboard InputFocus = 3
1134
1135type FontDraw uint8
1136
1137const FontDrawLeftToRight FontDraw = 0
1138const FontDrawRightToLeft FontDraw = 1
1139
1140type Gc uint32
1141
1142const GcFunction Gc = 1
1143const GcPlaneMask Gc = 2
1144const GcForeground Gc = 4
1145const GcBackground Gc = 8
1146const GcLineWidth Gc = 16
1147const GcLineStyle Gc = 32
1148const GcCapStyle Gc = 64
1149const GcJoinStyle Gc = 128
1150const GcFillStyle Gc = 256
1151const GcFillRule Gc = 512
1152const GcTile Gc = 1024
1153const GcStipple Gc = 2048
1154const GcTileStippleOriginX Gc = 4096
1155const GcTileStippleOriginY Gc = 8192
1156const GcFont Gc = 16384
1157const GcSubwindowMode Gc = 32768
1158const GcGraphicsExposures Gc = 65536
1159const GcClipOriginX Gc = 131072
1160const GcClipOriginY Gc = 262144
1161const GcClipMask Gc = 524288
1162const GcDashOffset Gc = 1048576
1163const GcDashList Gc = 2097152
1164const GcArcMode Gc = 4194304
1165
1166type Gx uint32
1167
1168const GxClear Gx = 0
1169const GxAnd Gx = 1
1170const GxAndReverse Gx = 2
1171const GxCopy Gx = 3
1172const GxAndInverted Gx = 4
1173const GxNoop Gx = 5
1174const GxXor Gx = 6
1175const GxOr Gx = 7
1176const GxNor Gx = 8
1177const GxEquiv Gx = 9
1178const GxInvert Gx = 10
1179const GxOrReverse Gx = 11
1180const GxCopyInverted Gx = 12
1181const GxOrInverted Gx = 13
1182const GxNand Gx = 14
1183const GxSet Gx = 15
1184
1185type LineStyle uint32
1186
1187const LineStyleSolid LineStyle = 0
1188const LineStyleOnOffDash LineStyle = 1
1189const LineStyleDoubleDash LineStyle = 2
1190
1191type CapStyle uint32
1192
1193const CapStyleNotLast CapStyle = 0
1194const CapStyleButt CapStyle = 1
1195const CapStyleRound CapStyle = 2
1196const CapStyleProjecting CapStyle = 3
1197
1198type JoinStyle uint32
1199
1200const JoinStyleMiter JoinStyle = 0
1201const JoinStyleRound JoinStyle = 1
1202const JoinStyleBevel JoinStyle = 2
1203
1204type FillStyle uint32
1205
1206const FillStyleSolid FillStyle = 0
1207const FillStyleTiled FillStyle = 1
1208const FillStyleStippled FillStyle = 2
1209const FillStyleOpaqueStippled FillStyle = 3
1210
1211type FillRule uint32
1212
1213const FillRuleEvenOdd FillRule = 0
1214const FillRuleWinding FillRule = 1
1215
1216type SubwindowMode uint32
1217
1218const SubwindowModeClipByChildren SubwindowMode = 0
1219const SubwindowModeIncludeInferiors SubwindowMode = 1
1220
1221type ArcMode uint32
1222
1223const ArcModeChord ArcMode = 0
1224const ArcModePieSlice ArcMode = 1
1225
1226type ClipOrdering uint8
1227
1228const ClipOrderingUnsorted ClipOrdering = 0
1229const ClipOrderingYSorted ClipOrdering = 1
1230const ClipOrderingYXSorted ClipOrdering = 2
1231const ClipOrderingYXBanded ClipOrdering = 3
1232
1233type CoordMode uint8
1234
1235const CoordModeOrigin CoordMode = 0
1236const CoordModePrevious CoordMode = 1
1237
1238type PolyShape uint8
1239
1240const PolyShapeComplex PolyShape = 0
1241const PolyShapeNonconvex PolyShape = 1
1242const PolyShapeConvex PolyShape = 2
1243
1244type ImageFormat uint8
1245
1246const ImageFormatXYBitmap ImageFormat = 0
1247const ImageFormatXYPixmap ImageFormat = 1
1248const ImageFormatZPixmap ImageFormat = 2
1249
1250type ColormapAlloc uint8
1251
1252const ColormapAllocNone ColormapAlloc = 0
1253const ColormapAllocAll ColormapAlloc = 1
1254
1255type ColorFlag uint8
1256
1257const ColorFlagRed ColorFlag = 1
1258const ColorFlagGreen ColorFlag = 2
1259const ColorFlagBlue ColorFlag = 4
1260
1261const PixmapNone Pixmap = 0
1262
1263const FontNone Font = 0
1264
1265type QueryShapeOf uint8
1266
1267const QueryShapeOfLargestCursor QueryShapeOf = 0
1268const QueryShapeOfFastestTile QueryShapeOf = 1
1269const QueryShapeOfFastestStipple QueryShapeOf = 2
1270
1271type Kb uint32
1272
1273const KbKeyClickPercent Kb = 1
1274const KbBellPercent Kb = 2
1275const KbBellPitch Kb = 4
1276const KbBellDuration Kb = 8
1277const KbLed Kb = 16
1278const KbLedMode Kb = 32
1279const KbKey Kb = 64
1280const KbAutoRepeatMode Kb = 128
1281
1282type LedMode uint32
1283
1284const LedModeOff LedMode = 0
1285const LedModeOn LedMode = 1
1286
1287type AutoRepeatMode uint32
1288
1289const AutoRepeatModeOff AutoRepeatMode = 0
1290const AutoRepeatModeOn AutoRepeatMode = 1
1291const AutoRepeatModeDefault AutoRepeatMode = 2
1292
1293type Blanking uint8
1294
1295const BlankingNotPreferred Blanking = 0
1296const BlankingPreferred Blanking = 1
1297const BlankingDefault Blanking = 2
1298
1299type Exposures uint8
1300
1301const ExposuresNotAllowed Exposures = 0
1302const ExposuresAllowed Exposures = 1
1303const ExposuresDefault Exposures = 2
1304
1305type HostMode uint8
1306
1307const HostModeInsert HostMode = 0
1308const HostModeDelete HostMode = 1
1309
1310type Family uint8
1311
1312const FamilyInternet Family = 0
1313const FamilyDECnet Family = 1
1314const FamilyChaos Family = 2
1315const FamilyServerInterpreted Family = 5
1316const FamilyInternet6 Family = 6
1317
1318type AccessControl uint8
1319
1320const AccessControlDisable AccessControl = 0
1321const AccessControlEnable AccessControl = 1
1322
1323type CloseDown uint8
1324
1325const CloseDownDestroyAll CloseDown = 0
1326const CloseDownRetainPermanent CloseDown = 1
1327const CloseDownRetainTemporary CloseDown = 2
1328
1329type Kill uint32
1330
1331const KillAllTemporary Kill = 0
1332
1333type ScreenSaver uint8
1334
1335const ScreenSaverReset ScreenSaver = 0
1336const ScreenSaverActive ScreenSaver = 1
1337
1338type MappingStatus uint8
1339
1340const MappingStatusSuccess MappingStatus = 0
1341const MappingStatusBusy MappingStatus = 1
1342const MappingStatusFailure MappingStatus = 2
1343
1344type MapIndex uint32
1345
1346const MapIndexShift MapIndex = 0
1347const MapIndexLock MapIndex = 1
1348const MapIndexControl MapIndex = 2
1349const MapIndexX1 MapIndex = 3
1350const MapIndexX2 MapIndex = 4
1351const MapIndexX3 MapIndex = 5
1352const MapIndexX4 MapIndex = 6
1353const MapIndexX5 MapIndex = 7