replies_generated.go RawHistoryFolder
1// Code generated by xtgen; DO NOT EDIT.
2package shape
3
4import "bnema.dev/xturbo/xproto"
5import "encoding/binary"
6
7// QueryVersionReply is a zero-copy view over a QueryVersion reply; offsets count from reply byte 0.
8// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
9type QueryVersionReply struct{ raw []byte }
10
11// ParseQueryVersionReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
12func ParseQueryVersionReply(raw []byte) (QueryVersionReply, bool) {
13 if len(raw) < 32 {
14 return QueryVersionReply{}, false
15 }
16 r := QueryVersionReply{raw: raw}
17 return r, true
18}
19func (r QueryVersionReply) Raw() []byte { return r.raw }
20func (r QueryVersionReply) MajorVersion() uint16 {
21 return uint16(binary.LittleEndian.Uint16(r.raw[8:]))
22}
23func (r QueryVersionReply) MinorVersion() uint16 {
24 return uint16(binary.LittleEndian.Uint16(r.raw[10:]))
25}
26
27// QueryExtentsReply is a zero-copy view over a QueryExtents reply; offsets count from reply byte 0.
28// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
29type QueryExtentsReply struct{ raw []byte }
30
31// ParseQueryExtentsReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
32func ParseQueryExtentsReply(raw []byte) (QueryExtentsReply, bool) {
33 if len(raw) < 32 {
34 return QueryExtentsReply{}, false
35 }
36 r := QueryExtentsReply{raw: raw}
37 return r, true
38}
39func (r QueryExtentsReply) Raw() []byte { return r.raw }
40func (r QueryExtentsReply) BoundingShaped() bool { return (r.raw[8:][0] != 0) }
41func (r QueryExtentsReply) ClipShaped() bool { return (r.raw[9:][0] != 0) }
42func (r QueryExtentsReply) BoundingShapeExtentsX() int16 {
43 return int16(binary.LittleEndian.Uint16(r.raw[12:]))
44}
45func (r QueryExtentsReply) BoundingShapeExtentsY() int16 {
46 return int16(binary.LittleEndian.Uint16(r.raw[14:]))
47}
48func (r QueryExtentsReply) BoundingShapeExtentsWidth() uint16 {
49 return uint16(binary.LittleEndian.Uint16(r.raw[16:]))
50}
51func (r QueryExtentsReply) BoundingShapeExtentsHeight() uint16 {
52 return uint16(binary.LittleEndian.Uint16(r.raw[18:]))
53}
54func (r QueryExtentsReply) ClipShapeExtentsX() int16 {
55 return int16(binary.LittleEndian.Uint16(r.raw[20:]))
56}
57func (r QueryExtentsReply) ClipShapeExtentsY() int16 {
58 return int16(binary.LittleEndian.Uint16(r.raw[22:]))
59}
60func (r QueryExtentsReply) ClipShapeExtentsWidth() uint16 {
61 return uint16(binary.LittleEndian.Uint16(r.raw[24:]))
62}
63func (r QueryExtentsReply) ClipShapeExtentsHeight() uint16 {
64 return uint16(binary.LittleEndian.Uint16(r.raw[26:]))
65}
66
67// InputSelectedReply is a zero-copy view over a InputSelected reply; offsets count from reply byte 0.
68// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
69type InputSelectedReply struct{ raw []byte }
70
71// ParseInputSelectedReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
72func ParseInputSelectedReply(raw []byte) (InputSelectedReply, bool) {
73 if len(raw) < 32 {
74 return InputSelectedReply{}, false
75 }
76 r := InputSelectedReply{raw: raw}
77 return r, true
78}
79func (r InputSelectedReply) Raw() []byte { return r.raw }
80func (r InputSelectedReply) Enabled() bool { return (r.raw[1:][0] != 0) }
81
82// GetRectanglesReply is a zero-copy view over a GetRectangles reply; offsets count from reply byte 0.
83// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
84type GetRectanglesReply struct{ raw []byte }
85
86// ParseGetRectanglesReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
87func ParseGetRectanglesReply(raw []byte) (GetRectanglesReply, bool) {
88 if len(raw) < 32 {
89 return GetRectanglesReply{}, false
90 }
91 r := GetRectanglesReply{raw: raw}
92 off := 32
93 {
94 n := int(r.RectanglesLen())
95 if n < 0 || n > len(r.raw) {
96 return GetRectanglesReply{}, false
97 }
98 off += n * 8
99 }
100 if off > len(r.raw) {
101 return GetRectanglesReply{}, false
102 }
103 if off > len(r.raw) {
104 return GetRectanglesReply{}, false
105 }
106 return r, true
107}
108func (r GetRectanglesReply) Raw() []byte { return r.raw }
109func (r GetRectanglesReply) Ordering() xproto.ClipOrdering { return xproto.ClipOrdering(r.raw[1:][0]) }
110func (r GetRectanglesReply) RectanglesLen() uint32 {
111 return uint32(binary.LittleEndian.Uint32(r.raw[8:]))
112}
113func (r GetRectanglesReply) Rectangles() RectangleList {
114 off := 32
115 end := off + (int(r.RectanglesLen()))*8
116 return RectangleList{b: r.raw[off:end:end]}
117}
118
119// RectangleList is a borrowed view over a wire list of xproto.Rectangle. It shares the lifetime of the bytes it was taken from; copy what you keep.
120type RectangleList struct{ b []byte }
121
122func (l RectangleList) Len() int { return len(l.b) / 8 }
123func (l RectangleList) At(i int) xproto.Rectangle { return xproto.GetRectangle(l.b[i*8:]) }