1// Code generated by xtgen; DO NOT EDIT.
2package xfixes
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() uint32 {
21 return uint32(binary.LittleEndian.Uint32(r.raw[8:]))
22}
23func (r QueryVersionReply) MinorVersion() uint32 {
24 return uint32(binary.LittleEndian.Uint32(r.raw[12:]))
25}
26
27// GetCursorImageReply is a zero-copy view over a GetCursorImage 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 GetCursorImageReply struct{ raw []byte }
30
31// ParseGetCursorImageReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
32func ParseGetCursorImageReply(raw []byte) (GetCursorImageReply, bool) {
33 if len(raw) < 32 {
34 return GetCursorImageReply{}, false
35 }
36 r := GetCursorImageReply{raw: raw}
37 off := 32
38 {
39 n := (int(r.Width()) * int(r.Height()))
40 if n < 0 || n > len(r.raw) {
41 return GetCursorImageReply{}, false
42 }
43 off += n * 4
44 }
45 if off > len(r.raw) {
46 return GetCursorImageReply{}, false
47 }
48 if off > len(r.raw) {
49 return GetCursorImageReply{}, false
50 }
51 return r, true
52}
53func (r GetCursorImageReply) Raw() []byte { return r.raw }
54func (r GetCursorImageReply) X() int16 { return int16(binary.LittleEndian.Uint16(r.raw[8:])) }
55func (r GetCursorImageReply) Y() int16 { return int16(binary.LittleEndian.Uint16(r.raw[10:])) }
56func (r GetCursorImageReply) Width() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[12:])) }
57func (r GetCursorImageReply) Height() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[14:])) }
58func (r GetCursorImageReply) Xhot() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[16:])) }
59func (r GetCursorImageReply) Yhot() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[18:])) }
60func (r GetCursorImageReply) CursorSerial() uint32 {
61 return uint32(binary.LittleEndian.Uint32(r.raw[20:]))
62}
63func (r GetCursorImageReply) CursorImage() Uint32List {
64 off := 32
65 end := off + (int(r.Width())*int(r.Height()))*4
66 return Uint32List{b: r.raw[off:end:end]}
67}
68
69// FetchRegionReply is a zero-copy view over a FetchRegion reply; offsets count from reply byte 0.
70// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
71type FetchRegionReply struct{ raw []byte }
72
73// ParseFetchRegionReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
74func ParseFetchRegionReply(raw []byte) (FetchRegionReply, bool) {
75 if len(raw) < 32 {
76 return FetchRegionReply{}, false
77 }
78 r := FetchRegionReply{raw: raw}
79 off := 32
80 {
81 n := (int(binary.LittleEndian.Uint32(r.raw[4:])) / 2)
82 if n < 0 || n > len(r.raw) {
83 return FetchRegionReply{}, false
84 }
85 off += n * 8
86 }
87 if off > len(r.raw) {
88 return FetchRegionReply{}, false
89 }
90 if off > len(r.raw) {
91 return FetchRegionReply{}, false
92 }
93 return r, true
94}
95func (r FetchRegionReply) Raw() []byte { return r.raw }
96func (r FetchRegionReply) Extents() xproto.Rectangle { return xproto.GetRectangle(r.raw[8:]) }
97func (r FetchRegionReply) Rectangles() RectangleList {
98 off := 32
99 end := off + (int(binary.LittleEndian.Uint32(r.raw[4:]))/2)*8
100 return RectangleList{b: r.raw[off:end:end]}
101}
102
103// GetCursorNameReply is a zero-copy view over a GetCursorName reply; offsets count from reply byte 0.
104// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
105type GetCursorNameReply struct{ raw []byte }
106
107// ParseGetCursorNameReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
108func ParseGetCursorNameReply(raw []byte) (GetCursorNameReply, bool) {
109 if len(raw) < 32 {
110 return GetCursorNameReply{}, false
111 }
112 r := GetCursorNameReply{raw: raw}
113 off := 32
114 {
115 n := int(r.Nbytes())
116 if n < 0 || n > len(r.raw) {
117 return GetCursorNameReply{}, false
118 }
119 off += n * 1
120 }
121 if off > len(r.raw) {
122 return GetCursorNameReply{}, false
123 }
124 if off > len(r.raw) {
125 return GetCursorNameReply{}, false
126 }
127 return r, true
128}
129func (r GetCursorNameReply) Raw() []byte { return r.raw }
130func (r GetCursorNameReply) Atom() xproto.Atom {
131 return xproto.Atom(binary.LittleEndian.Uint32(r.raw[8:]))
132}
133func (r GetCursorNameReply) Nbytes() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[12:])) }
134func (r GetCursorNameReply) Name() []byte {
135 off := 32
136 end := off + int(r.Nbytes())
137 return r.raw[off:end:end]
138}
139
140// GetCursorImageAndNameReply is a zero-copy view over a GetCursorImageAndName reply; offsets count from reply byte 0.
141// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
142type GetCursorImageAndNameReply struct{ raw []byte }
143
144// ParseGetCursorImageAndNameReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
145func ParseGetCursorImageAndNameReply(raw []byte) (GetCursorImageAndNameReply, bool) {
146 if len(raw) < 32 {
147 return GetCursorImageAndNameReply{}, false
148 }
149 r := GetCursorImageAndNameReply{raw: raw}
150 off := 32
151 {
152 n := (int(r.Width()) * int(r.Height()))
153 if n < 0 || n > len(r.raw) {
154 return GetCursorImageAndNameReply{}, false
155 }
156 off += n * 4
157 }
158 if off > len(r.raw) {
159 return GetCursorImageAndNameReply{}, false
160 }
161 {
162 n := int(r.Nbytes())
163 if n < 0 || n > len(r.raw) {
164 return GetCursorImageAndNameReply{}, false
165 }
166 off += n * 1
167 }
168 if off > len(r.raw) {
169 return GetCursorImageAndNameReply{}, false
170 }
171 if off > len(r.raw) {
172 return GetCursorImageAndNameReply{}, false
173 }
174 return r, true
175}
176func (r GetCursorImageAndNameReply) Raw() []byte { return r.raw }
177func (r GetCursorImageAndNameReply) X() int16 { return int16(binary.LittleEndian.Uint16(r.raw[8:])) }
178func (r GetCursorImageAndNameReply) Y() int16 { return int16(binary.LittleEndian.Uint16(r.raw[10:])) }
179func (r GetCursorImageAndNameReply) Width() uint16 {
180 return uint16(binary.LittleEndian.Uint16(r.raw[12:]))
181}
182func (r GetCursorImageAndNameReply) Height() uint16 {
183 return uint16(binary.LittleEndian.Uint16(r.raw[14:]))
184}
185func (r GetCursorImageAndNameReply) Xhot() uint16 {
186 return uint16(binary.LittleEndian.Uint16(r.raw[16:]))
187}
188func (r GetCursorImageAndNameReply) Yhot() uint16 {
189 return uint16(binary.LittleEndian.Uint16(r.raw[18:]))
190}
191func (r GetCursorImageAndNameReply) CursorSerial() uint32 {
192 return uint32(binary.LittleEndian.Uint32(r.raw[20:]))
193}
194func (r GetCursorImageAndNameReply) CursorAtom() xproto.Atom {
195 return xproto.Atom(binary.LittleEndian.Uint32(r.raw[24:]))
196}
197func (r GetCursorImageAndNameReply) Nbytes() uint16 {
198 return uint16(binary.LittleEndian.Uint16(r.raw[28:]))
199}
200func (r GetCursorImageAndNameReply) CursorImage() Uint32List {
201 off := 32
202 end := off + (int(r.Width())*int(r.Height()))*4
203 return Uint32List{b: r.raw[off:end:end]}
204}
205func (r GetCursorImageAndNameReply) Name() []byte {
206 off := 32
207 {
208 n := (int(r.Width()) * int(r.Height()))
209 off += n * 4
210 }
211 end := off + int(r.Nbytes())
212 return r.raw[off:end:end]
213}
214
215// GetClientDisconnectModeReply is a zero-copy view over a GetClientDisconnectMode reply; offsets count from reply byte 0.
216// It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep.
217type GetClientDisconnectModeReply struct{ raw []byte }
218
219// ParseGetClientDisconnectModeReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check.
220func ParseGetClientDisconnectModeReply(raw []byte) (GetClientDisconnectModeReply, bool) {
221 if len(raw) < 32 {
222 return GetClientDisconnectModeReply{}, false
223 }
224 r := GetClientDisconnectModeReply{raw: raw}
225 return r, true
226}
227func (r GetClientDisconnectModeReply) Raw() []byte { return r.raw }
228func (r GetClientDisconnectModeReply) DisconnectMode() ClientDisconnectFlags {
229 return ClientDisconnectFlags(binary.LittleEndian.Uint32(r.raw[8:]))
230}
231
232// 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.
233type RectangleList struct{ b []byte }
234
235func (l RectangleList) Len() int { return len(l.b) / 8 }
236func (l RectangleList) At(i int) xproto.Rectangle { return xproto.GetRectangle(l.b[i*8:]) }
237
238// Uint32List is a borrowed view over a wire list of uint32. It shares the lifetime of the bytes it was taken from; copy what you keep.
239type Uint32List struct{ b []byte }
240
241func (l Uint32List) Len() int { return len(l.b) / 4 }
242func (l Uint32List) At(i int) uint32 { return uint32(binary.LittleEndian.Uint32(l.b[i*4:])) }