1// Code generated by xtgen; DO NOT EDIT.
2package xproto
3
4import "encoding/binary"
5import "bnema.dev/xturbo"
6
7// KindKeyPress identifies KeyPress events in xturbo.Event.Kind.
8const KindKeyPress = xturbo.EventKind(2)
9
10// KeyPressEvent is a view over a KeyPress event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
11type KeyPressEvent struct{ raw *[32]byte }
12
13// KeyPressOf views ev as KeyPress without checking ev.Kind: a wrong kind yields garbage, never a panic.
14func KeyPressOf(ev *xturbo.Event) KeyPressEvent { return KeyPressEvent{raw: &ev.Raw} }
15func (e KeyPressEvent) Raw() *[32]byte { return e.raw }
16func (e KeyPressEvent) Detail() Keycode { return Keycode(e.raw[1:][0]) }
17func (e KeyPressEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) }
18func (e KeyPressEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
19func (e KeyPressEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) }
20func (e KeyPressEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) }
21func (e KeyPressEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) }
22func (e KeyPressEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) }
23func (e KeyPressEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) }
24func (e KeyPressEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) }
25func (e KeyPressEvent) State() KeyButMask { return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:])) }
26func (e KeyPressEvent) SameScreen() bool { return (e.raw[30:][0] != 0) }
27
28// KeyPressEventData encodes a KeyPress event for SendEvent.
29type KeyPressEventData struct {
30 Detail Keycode
31 Time Timestamp
32 Root Window
33 Event Window
34 Child Window
35 RootX int16
36 RootY int16
37 EventX int16
38 EventY int16
39 State KeyButMask
40 SameScreen bool
41}
42
43// Put writes the event (code 2, pads and sequence zeroed) into dst. dst may alias
44// memory that d's borrowed fields view, such as the Event.Raw they were read from.
45func (d *KeyPressEventData) Put(dst *[32]byte) {
46 var tmp [32]byte
47 tmp[0] = 2
48 tmp[1:][0] = byte(d.Detail)
49 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time))
50 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root))
51 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event))
52 binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child))
53 binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX))
54 binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY))
55 binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX))
56 binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY))
57 binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State))
58 if d.SameScreen {
59 tmp[30:][0] = 1
60 } else {
61 tmp[30:][0] = 0
62 }
63 *dst = tmp
64}
65
66// KindKeyRelease identifies KeyRelease events in xturbo.Event.Kind.
67const KindKeyRelease = xturbo.EventKind(3)
68
69// KeyReleaseEvent shares KeyPress's layout (eventcopy).
70type KeyReleaseEvent = KeyPressEvent
71
72// KeyReleaseOf views ev as KeyRelease without checking ev.Kind.
73func KeyReleaseOf(ev *xturbo.Event) KeyReleaseEvent { return KeyPressOf(ev) }
74
75// KeyReleaseEventData encodes a KeyRelease event for SendEvent with KeyPress's fields.
76type KeyReleaseEventData KeyPressEventData
77
78// Put writes the event (code 3, pads and sequence zeroed) into dst.
79func (d *KeyReleaseEventData) Put(dst *[32]byte) { (*KeyPressEventData)(d).Put(dst); dst[0] = 3 }
80
81// KindButtonPress identifies ButtonPress events in xturbo.Event.Kind.
82const KindButtonPress = xturbo.EventKind(4)
83
84// ButtonPressEvent is a view over a ButtonPress event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
85type ButtonPressEvent struct{ raw *[32]byte }
86
87// ButtonPressOf views ev as ButtonPress without checking ev.Kind: a wrong kind yields garbage, never a panic.
88func ButtonPressOf(ev *xturbo.Event) ButtonPressEvent { return ButtonPressEvent{raw: &ev.Raw} }
89func (e ButtonPressEvent) Raw() *[32]byte { return e.raw }
90func (e ButtonPressEvent) Detail() Button { return Button(e.raw[1:][0]) }
91func (e ButtonPressEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) }
92func (e ButtonPressEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
93func (e ButtonPressEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) }
94func (e ButtonPressEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) }
95func (e ButtonPressEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) }
96func (e ButtonPressEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) }
97func (e ButtonPressEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) }
98func (e ButtonPressEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) }
99func (e ButtonPressEvent) State() KeyButMask {
100 return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:]))
101}
102func (e ButtonPressEvent) SameScreen() bool { return (e.raw[30:][0] != 0) }
103
104// ButtonPressEventData encodes a ButtonPress event for SendEvent.
105type ButtonPressEventData struct {
106 Detail Button
107 Time Timestamp
108 Root Window
109 Event Window
110 Child Window
111 RootX int16
112 RootY int16
113 EventX int16
114 EventY int16
115 State KeyButMask
116 SameScreen bool
117}
118
119// Put writes the event (code 4, pads and sequence zeroed) into dst. dst may alias
120// memory that d's borrowed fields view, such as the Event.Raw they were read from.
121func (d *ButtonPressEventData) Put(dst *[32]byte) {
122 var tmp [32]byte
123 tmp[0] = 4
124 tmp[1:][0] = byte(d.Detail)
125 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time))
126 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root))
127 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event))
128 binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child))
129 binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX))
130 binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY))
131 binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX))
132 binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY))
133 binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State))
134 if d.SameScreen {
135 tmp[30:][0] = 1
136 } else {
137 tmp[30:][0] = 0
138 }
139 *dst = tmp
140}
141
142// KindButtonRelease identifies ButtonRelease events in xturbo.Event.Kind.
143const KindButtonRelease = xturbo.EventKind(5)
144
145// ButtonReleaseEvent shares ButtonPress's layout (eventcopy).
146type ButtonReleaseEvent = ButtonPressEvent
147
148// ButtonReleaseOf views ev as ButtonRelease without checking ev.Kind.
149func ButtonReleaseOf(ev *xturbo.Event) ButtonReleaseEvent { return ButtonPressOf(ev) }
150
151// ButtonReleaseEventData encodes a ButtonRelease event for SendEvent with ButtonPress's fields.
152type ButtonReleaseEventData ButtonPressEventData
153
154// Put writes the event (code 5, pads and sequence zeroed) into dst.
155func (d *ButtonReleaseEventData) Put(dst *[32]byte) { (*ButtonPressEventData)(d).Put(dst); dst[0] = 5 }
156
157// KindMotionNotify identifies MotionNotify events in xturbo.Event.Kind.
158const KindMotionNotify = xturbo.EventKind(6)
159
160// MotionNotifyEvent is a view over a MotionNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
161type MotionNotifyEvent struct{ raw *[32]byte }
162
163// MotionNotifyOf views ev as MotionNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
164func MotionNotifyOf(ev *xturbo.Event) MotionNotifyEvent { return MotionNotifyEvent{raw: &ev.Raw} }
165func (e MotionNotifyEvent) Raw() *[32]byte { return e.raw }
166func (e MotionNotifyEvent) Detail() Motion { return Motion(e.raw[1:][0]) }
167func (e MotionNotifyEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) }
168func (e MotionNotifyEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
169func (e MotionNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) }
170func (e MotionNotifyEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) }
171func (e MotionNotifyEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) }
172func (e MotionNotifyEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) }
173func (e MotionNotifyEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) }
174func (e MotionNotifyEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) }
175func (e MotionNotifyEvent) State() KeyButMask {
176 return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:]))
177}
178func (e MotionNotifyEvent) SameScreen() bool { return (e.raw[30:][0] != 0) }
179
180// MotionNotifyEventData encodes a MotionNotify event for SendEvent.
181type MotionNotifyEventData struct {
182 Detail Motion
183 Time Timestamp
184 Root Window
185 Event Window
186 Child Window
187 RootX int16
188 RootY int16
189 EventX int16
190 EventY int16
191 State KeyButMask
192 SameScreen bool
193}
194
195// Put writes the event (code 6, pads and sequence zeroed) into dst. dst may alias
196// memory that d's borrowed fields view, such as the Event.Raw they were read from.
197func (d *MotionNotifyEventData) Put(dst *[32]byte) {
198 var tmp [32]byte
199 tmp[0] = 6
200 tmp[1:][0] = byte(d.Detail)
201 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time))
202 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root))
203 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event))
204 binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child))
205 binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX))
206 binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY))
207 binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX))
208 binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY))
209 binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State))
210 if d.SameScreen {
211 tmp[30:][0] = 1
212 } else {
213 tmp[30:][0] = 0
214 }
215 *dst = tmp
216}
217
218// KindEnterNotify identifies EnterNotify events in xturbo.Event.Kind.
219const KindEnterNotify = xturbo.EventKind(7)
220
221// EnterNotifyEvent is a view over a EnterNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
222type EnterNotifyEvent struct{ raw *[32]byte }
223
224// EnterNotifyOf views ev as EnterNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
225func EnterNotifyOf(ev *xturbo.Event) EnterNotifyEvent { return EnterNotifyEvent{raw: &ev.Raw} }
226func (e EnterNotifyEvent) Raw() *[32]byte { return e.raw }
227func (e EnterNotifyEvent) Detail() NotifyDetail { return NotifyDetail(e.raw[1:][0]) }
228func (e EnterNotifyEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) }
229func (e EnterNotifyEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
230func (e EnterNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) }
231func (e EnterNotifyEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) }
232func (e EnterNotifyEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) }
233func (e EnterNotifyEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) }
234func (e EnterNotifyEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) }
235func (e EnterNotifyEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) }
236func (e EnterNotifyEvent) State() KeyButMask {
237 return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:]))
238}
239func (e EnterNotifyEvent) Mode() NotifyMode { return NotifyMode(e.raw[30:][0]) }
240func (e EnterNotifyEvent) SameScreenFocus() byte { return byte(e.raw[31:][0]) }
241
242// EnterNotifyEventData encodes a EnterNotify event for SendEvent.
243type EnterNotifyEventData struct {
244 Detail NotifyDetail
245 Time Timestamp
246 Root Window
247 Event Window
248 Child Window
249 RootX int16
250 RootY int16
251 EventX int16
252 EventY int16
253 State KeyButMask
254 Mode NotifyMode
255 SameScreenFocus byte
256}
257
258// Put writes the event (code 7, pads and sequence zeroed) into dst. dst may alias
259// memory that d's borrowed fields view, such as the Event.Raw they were read from.
260func (d *EnterNotifyEventData) Put(dst *[32]byte) {
261 var tmp [32]byte
262 tmp[0] = 7
263 tmp[1:][0] = byte(d.Detail)
264 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time))
265 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root))
266 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event))
267 binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child))
268 binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX))
269 binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY))
270 binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX))
271 binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY))
272 binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State))
273 tmp[30:][0] = byte(d.Mode)
274 tmp[31:][0] = byte(d.SameScreenFocus)
275 *dst = tmp
276}
277
278// KindLeaveNotify identifies LeaveNotify events in xturbo.Event.Kind.
279const KindLeaveNotify = xturbo.EventKind(8)
280
281// LeaveNotifyEvent shares EnterNotify's layout (eventcopy).
282type LeaveNotifyEvent = EnterNotifyEvent
283
284// LeaveNotifyOf views ev as LeaveNotify without checking ev.Kind.
285func LeaveNotifyOf(ev *xturbo.Event) LeaveNotifyEvent { return EnterNotifyOf(ev) }
286
287// LeaveNotifyEventData encodes a LeaveNotify event for SendEvent with EnterNotify's fields.
288type LeaveNotifyEventData EnterNotifyEventData
289
290// Put writes the event (code 8, pads and sequence zeroed) into dst.
291func (d *LeaveNotifyEventData) Put(dst *[32]byte) { (*EnterNotifyEventData)(d).Put(dst); dst[0] = 8 }
292
293// KindFocusIn identifies FocusIn events in xturbo.Event.Kind.
294const KindFocusIn = xturbo.EventKind(9)
295
296// FocusInEvent is a view over a FocusIn event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
297type FocusInEvent struct{ raw *[32]byte }
298
299// FocusInOf views ev as FocusIn without checking ev.Kind: a wrong kind yields garbage, never a panic.
300func FocusInOf(ev *xturbo.Event) FocusInEvent { return FocusInEvent{raw: &ev.Raw} }
301func (e FocusInEvent) Raw() *[32]byte { return e.raw }
302func (e FocusInEvent) Detail() NotifyDetail { return NotifyDetail(e.raw[1:][0]) }
303func (e FocusInEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
304func (e FocusInEvent) Mode() NotifyMode { return NotifyMode(e.raw[8:][0]) }
305
306// FocusInEventData encodes a FocusIn event for SendEvent.
307type FocusInEventData struct {
308 Detail NotifyDetail
309 Event Window
310 Mode NotifyMode
311}
312
313// Put writes the event (code 9, pads and sequence zeroed) into dst. dst may alias
314// memory that d's borrowed fields view, such as the Event.Raw they were read from.
315func (d *FocusInEventData) Put(dst *[32]byte) {
316 var tmp [32]byte
317 tmp[0] = 9
318 tmp[1:][0] = byte(d.Detail)
319 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
320 tmp[8:][0] = byte(d.Mode)
321 *dst = tmp
322}
323
324// KindFocusOut identifies FocusOut events in xturbo.Event.Kind.
325const KindFocusOut = xturbo.EventKind(10)
326
327// FocusOutEvent shares FocusIn's layout (eventcopy).
328type FocusOutEvent = FocusInEvent
329
330// FocusOutOf views ev as FocusOut without checking ev.Kind.
331func FocusOutOf(ev *xturbo.Event) FocusOutEvent { return FocusInOf(ev) }
332
333// FocusOutEventData encodes a FocusOut event for SendEvent with FocusIn's fields.
334type FocusOutEventData FocusInEventData
335
336// Put writes the event (code 10, pads and sequence zeroed) into dst.
337func (d *FocusOutEventData) Put(dst *[32]byte) { (*FocusInEventData)(d).Put(dst); dst[0] = 10 }
338
339// KindKeymapNotify identifies KeymapNotify events in xturbo.Event.Kind.
340const KindKeymapNotify = xturbo.EventKind(11)
341
342// KeymapNotifyEvent is a view over a KeymapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
343type KeymapNotifyEvent struct{ raw *[32]byte }
344
345// KeymapNotifyOf views ev as KeymapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
346func KeymapNotifyOf(ev *xturbo.Event) KeymapNotifyEvent { return KeymapNotifyEvent{raw: &ev.Raw} }
347func (e KeymapNotifyEvent) Raw() *[32]byte { return e.raw }
348func (e KeymapNotifyEvent) Keys() []byte { off := 1; end := off + 31; return e.raw[off:end:end] }
349
350// KeymapNotifyEventData encodes a KeymapNotify event for SendEvent.
351type KeymapNotifyEventData struct {
352 Keys [31]uint8
353}
354
355// Put writes the event (code 11, pads and sequence zeroed) into dst. dst may alias
356// memory that d's borrowed fields view, such as the Event.Raw they were read from.
357func (d *KeymapNotifyEventData) Put(dst *[32]byte) {
358 var tmp [32]byte
359 tmp[0] = 11
360 for i := range d.Keys {
361 tmp[1+i*1:][0] = byte(d.Keys[i])
362 }
363 *dst = tmp
364}
365
366// KindExpose identifies Expose events in xturbo.Event.Kind.
367const KindExpose = xturbo.EventKind(12)
368
369// ExposeEvent is a view over a Expose event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
370type ExposeEvent struct{ raw *[32]byte }
371
372// ExposeOf views ev as Expose without checking ev.Kind: a wrong kind yields garbage, never a panic.
373func ExposeOf(ev *xturbo.Event) ExposeEvent { return ExposeEvent{raw: &ev.Raw} }
374func (e ExposeEvent) Raw() *[32]byte { return e.raw }
375func (e ExposeEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
376func (e ExposeEvent) X() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) }
377func (e ExposeEvent) Y() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[10:])) }
378func (e ExposeEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[12:])) }
379func (e ExposeEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[14:])) }
380func (e ExposeEvent) Count() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[16:])) }
381
382// ExposeEventData encodes a Expose event for SendEvent.
383type ExposeEventData struct {
384 Window Window
385 X uint16
386 Y uint16
387 Width uint16
388 Height uint16
389 Count uint16
390}
391
392// Put writes the event (code 12, pads and sequence zeroed) into dst. dst may alias
393// memory that d's borrowed fields view, such as the Event.Raw they were read from.
394func (d *ExposeEventData) Put(dst *[32]byte) {
395 var tmp [32]byte
396 tmp[0] = 12
397 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window))
398 binary.LittleEndian.PutUint16(tmp[8:], uint16(d.X))
399 binary.LittleEndian.PutUint16(tmp[10:], uint16(d.Y))
400 binary.LittleEndian.PutUint16(tmp[12:], uint16(d.Width))
401 binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Height))
402 binary.LittleEndian.PutUint16(tmp[16:], uint16(d.Count))
403 *dst = tmp
404}
405
406// KindGraphicsExposure identifies GraphicsExposure events in xturbo.Event.Kind.
407const KindGraphicsExposure = xturbo.EventKind(13)
408
409// GraphicsExposureEvent is a view over a GraphicsExposure event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
410type GraphicsExposureEvent struct{ raw *[32]byte }
411
412// GraphicsExposureOf views ev as GraphicsExposure without checking ev.Kind: a wrong kind yields garbage, never a panic.
413func GraphicsExposureOf(ev *xturbo.Event) GraphicsExposureEvent {
414 return GraphicsExposureEvent{raw: &ev.Raw}
415}
416func (e GraphicsExposureEvent) Raw() *[32]byte { return e.raw }
417func (e GraphicsExposureEvent) Drawable() Drawable {
418 return Drawable(binary.LittleEndian.Uint32(e.raw[4:]))
419}
420func (e GraphicsExposureEvent) X() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) }
421func (e GraphicsExposureEvent) Y() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[10:])) }
422func (e GraphicsExposureEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[12:])) }
423func (e GraphicsExposureEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[14:])) }
424func (e GraphicsExposureEvent) MinorOpcode() uint16 {
425 return uint16(binary.LittleEndian.Uint16(e.raw[16:]))
426}
427func (e GraphicsExposureEvent) Count() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[18:])) }
428func (e GraphicsExposureEvent) MajorOpcode() uint8 { return uint8(e.raw[20:][0]) }
429
430// GraphicsExposureEventData encodes a GraphicsExposure event for SendEvent.
431type GraphicsExposureEventData struct {
432 Drawable Drawable
433 X uint16
434 Y uint16
435 Width uint16
436 Height uint16
437 MinorOpcode uint16
438 Count uint16
439 MajorOpcode uint8
440}
441
442// Put writes the event (code 13, pads and sequence zeroed) into dst. dst may alias
443// memory that d's borrowed fields view, such as the Event.Raw they were read from.
444func (d *GraphicsExposureEventData) Put(dst *[32]byte) {
445 var tmp [32]byte
446 tmp[0] = 13
447 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Drawable))
448 binary.LittleEndian.PutUint16(tmp[8:], uint16(d.X))
449 binary.LittleEndian.PutUint16(tmp[10:], uint16(d.Y))
450 binary.LittleEndian.PutUint16(tmp[12:], uint16(d.Width))
451 binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Height))
452 binary.LittleEndian.PutUint16(tmp[16:], uint16(d.MinorOpcode))
453 binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Count))
454 tmp[20:][0] = byte(d.MajorOpcode)
455 *dst = tmp
456}
457
458// KindNoExposure identifies NoExposure events in xturbo.Event.Kind.
459const KindNoExposure = xturbo.EventKind(14)
460
461// NoExposureEvent is a view over a NoExposure event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
462type NoExposureEvent struct{ raw *[32]byte }
463
464// NoExposureOf views ev as NoExposure without checking ev.Kind: a wrong kind yields garbage, never a panic.
465func NoExposureOf(ev *xturbo.Event) NoExposureEvent { return NoExposureEvent{raw: &ev.Raw} }
466func (e NoExposureEvent) Raw() *[32]byte { return e.raw }
467func (e NoExposureEvent) Drawable() Drawable { return Drawable(binary.LittleEndian.Uint32(e.raw[4:])) }
468func (e NoExposureEvent) MinorOpcode() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) }
469func (e NoExposureEvent) MajorOpcode() uint8 { return uint8(e.raw[10:][0]) }
470
471// NoExposureEventData encodes a NoExposure event for SendEvent.
472type NoExposureEventData struct {
473 Drawable Drawable
474 MinorOpcode uint16
475 MajorOpcode uint8
476}
477
478// Put writes the event (code 14, pads and sequence zeroed) into dst. dst may alias
479// memory that d's borrowed fields view, such as the Event.Raw they were read from.
480func (d *NoExposureEventData) Put(dst *[32]byte) {
481 var tmp [32]byte
482 tmp[0] = 14
483 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Drawable))
484 binary.LittleEndian.PutUint16(tmp[8:], uint16(d.MinorOpcode))
485 tmp[10:][0] = byte(d.MajorOpcode)
486 *dst = tmp
487}
488
489// KindVisibilityNotify identifies VisibilityNotify events in xturbo.Event.Kind.
490const KindVisibilityNotify = xturbo.EventKind(15)
491
492// VisibilityNotifyEvent is a view over a VisibilityNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
493type VisibilityNotifyEvent struct{ raw *[32]byte }
494
495// VisibilityNotifyOf views ev as VisibilityNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
496func VisibilityNotifyOf(ev *xturbo.Event) VisibilityNotifyEvent {
497 return VisibilityNotifyEvent{raw: &ev.Raw}
498}
499func (e VisibilityNotifyEvent) Raw() *[32]byte { return e.raw }
500func (e VisibilityNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
501func (e VisibilityNotifyEvent) State() Visibility { return Visibility(e.raw[8:][0]) }
502
503// VisibilityNotifyEventData encodes a VisibilityNotify event for SendEvent.
504type VisibilityNotifyEventData struct {
505 Window Window
506 State Visibility
507}
508
509// Put writes the event (code 15, pads and sequence zeroed) into dst. dst may alias
510// memory that d's borrowed fields view, such as the Event.Raw they were read from.
511func (d *VisibilityNotifyEventData) Put(dst *[32]byte) {
512 var tmp [32]byte
513 tmp[0] = 15
514 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window))
515 tmp[8:][0] = byte(d.State)
516 *dst = tmp
517}
518
519// KindCreateNotify identifies CreateNotify events in xturbo.Event.Kind.
520const KindCreateNotify = xturbo.EventKind(16)
521
522// CreateNotifyEvent is a view over a CreateNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
523type CreateNotifyEvent struct{ raw *[32]byte }
524
525// CreateNotifyOf views ev as CreateNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
526func CreateNotifyOf(ev *xturbo.Event) CreateNotifyEvent { return CreateNotifyEvent{raw: &ev.Raw} }
527func (e CreateNotifyEvent) Raw() *[32]byte { return e.raw }
528func (e CreateNotifyEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
529func (e CreateNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
530func (e CreateNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[12:])) }
531func (e CreateNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[14:])) }
532func (e CreateNotifyEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[16:])) }
533func (e CreateNotifyEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[18:])) }
534func (e CreateNotifyEvent) BorderWidth() uint16 {
535 return uint16(binary.LittleEndian.Uint16(e.raw[20:]))
536}
537func (e CreateNotifyEvent) OverrideRedirect() bool { return (e.raw[22:][0] != 0) }
538
539// CreateNotifyEventData encodes a CreateNotify event for SendEvent.
540type CreateNotifyEventData struct {
541 Parent Window
542 Window Window
543 X int16
544 Y int16
545 Width uint16
546 Height uint16
547 BorderWidth uint16
548 OverrideRedirect bool
549}
550
551// Put writes the event (code 16, pads and sequence zeroed) into dst. dst may alias
552// memory that d's borrowed fields view, such as the Event.Raw they were read from.
553func (d *CreateNotifyEventData) Put(dst *[32]byte) {
554 var tmp [32]byte
555 tmp[0] = 16
556 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Parent))
557 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
558 binary.LittleEndian.PutUint16(tmp[12:], uint16(d.X))
559 binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Y))
560 binary.LittleEndian.PutUint16(tmp[16:], uint16(d.Width))
561 binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Height))
562 binary.LittleEndian.PutUint16(tmp[20:], uint16(d.BorderWidth))
563 if d.OverrideRedirect {
564 tmp[22:][0] = 1
565 } else {
566 tmp[22:][0] = 0
567 }
568 *dst = tmp
569}
570
571// KindDestroyNotify identifies DestroyNotify events in xturbo.Event.Kind.
572const KindDestroyNotify = xturbo.EventKind(17)
573
574// DestroyNotifyEvent is a view over a DestroyNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
575type DestroyNotifyEvent struct{ raw *[32]byte }
576
577// DestroyNotifyOf views ev as DestroyNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
578func DestroyNotifyOf(ev *xturbo.Event) DestroyNotifyEvent { return DestroyNotifyEvent{raw: &ev.Raw} }
579func (e DestroyNotifyEvent) Raw() *[32]byte { return e.raw }
580func (e DestroyNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
581func (e DestroyNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
582
583// DestroyNotifyEventData encodes a DestroyNotify event for SendEvent.
584type DestroyNotifyEventData struct {
585 Event Window
586 Window Window
587}
588
589// Put writes the event (code 17, pads and sequence zeroed) into dst. dst may alias
590// memory that d's borrowed fields view, such as the Event.Raw they were read from.
591func (d *DestroyNotifyEventData) Put(dst *[32]byte) {
592 var tmp [32]byte
593 tmp[0] = 17
594 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
595 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
596 *dst = tmp
597}
598
599// KindUnmapNotify identifies UnmapNotify events in xturbo.Event.Kind.
600const KindUnmapNotify = xturbo.EventKind(18)
601
602// UnmapNotifyEvent is a view over a UnmapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
603type UnmapNotifyEvent struct{ raw *[32]byte }
604
605// UnmapNotifyOf views ev as UnmapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
606func UnmapNotifyOf(ev *xturbo.Event) UnmapNotifyEvent { return UnmapNotifyEvent{raw: &ev.Raw} }
607func (e UnmapNotifyEvent) Raw() *[32]byte { return e.raw }
608func (e UnmapNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
609func (e UnmapNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
610func (e UnmapNotifyEvent) FromConfigure() bool { return (e.raw[12:][0] != 0) }
611
612// UnmapNotifyEventData encodes a UnmapNotify event for SendEvent.
613type UnmapNotifyEventData struct {
614 Event Window
615 Window Window
616 FromConfigure bool
617}
618
619// Put writes the event (code 18, pads and sequence zeroed) into dst. dst may alias
620// memory that d's borrowed fields view, such as the Event.Raw they were read from.
621func (d *UnmapNotifyEventData) Put(dst *[32]byte) {
622 var tmp [32]byte
623 tmp[0] = 18
624 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
625 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
626 if d.FromConfigure {
627 tmp[12:][0] = 1
628 } else {
629 tmp[12:][0] = 0
630 }
631 *dst = tmp
632}
633
634// KindMapNotify identifies MapNotify events in xturbo.Event.Kind.
635const KindMapNotify = xturbo.EventKind(19)
636
637// MapNotifyEvent is a view over a MapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
638type MapNotifyEvent struct{ raw *[32]byte }
639
640// MapNotifyOf views ev as MapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
641func MapNotifyOf(ev *xturbo.Event) MapNotifyEvent { return MapNotifyEvent{raw: &ev.Raw} }
642func (e MapNotifyEvent) Raw() *[32]byte { return e.raw }
643func (e MapNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
644func (e MapNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
645func (e MapNotifyEvent) OverrideRedirect() bool { return (e.raw[12:][0] != 0) }
646
647// MapNotifyEventData encodes a MapNotify event for SendEvent.
648type MapNotifyEventData struct {
649 Event Window
650 Window Window
651 OverrideRedirect bool
652}
653
654// Put writes the event (code 19, pads and sequence zeroed) into dst. dst may alias
655// memory that d's borrowed fields view, such as the Event.Raw they were read from.
656func (d *MapNotifyEventData) Put(dst *[32]byte) {
657 var tmp [32]byte
658 tmp[0] = 19
659 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
660 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
661 if d.OverrideRedirect {
662 tmp[12:][0] = 1
663 } else {
664 tmp[12:][0] = 0
665 }
666 *dst = tmp
667}
668
669// KindMapRequest identifies MapRequest events in xturbo.Event.Kind.
670const KindMapRequest = xturbo.EventKind(20)
671
672// MapRequestEvent is a view over a MapRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
673type MapRequestEvent struct{ raw *[32]byte }
674
675// MapRequestOf views ev as MapRequest without checking ev.Kind: a wrong kind yields garbage, never a panic.
676func MapRequestOf(ev *xturbo.Event) MapRequestEvent { return MapRequestEvent{raw: &ev.Raw} }
677func (e MapRequestEvent) Raw() *[32]byte { return e.raw }
678func (e MapRequestEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
679func (e MapRequestEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
680
681// MapRequestEventData encodes a MapRequest event for SendEvent.
682type MapRequestEventData struct {
683 Parent Window
684 Window Window
685}
686
687// Put writes the event (code 20, pads and sequence zeroed) into dst. dst may alias
688// memory that d's borrowed fields view, such as the Event.Raw they were read from.
689func (d *MapRequestEventData) Put(dst *[32]byte) {
690 var tmp [32]byte
691 tmp[0] = 20
692 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Parent))
693 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
694 *dst = tmp
695}
696
697// KindReparentNotify identifies ReparentNotify events in xturbo.Event.Kind.
698const KindReparentNotify = xturbo.EventKind(21)
699
700// ReparentNotifyEvent is a view over a ReparentNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
701type ReparentNotifyEvent struct{ raw *[32]byte }
702
703// ReparentNotifyOf views ev as ReparentNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
704func ReparentNotifyOf(ev *xturbo.Event) ReparentNotifyEvent { return ReparentNotifyEvent{raw: &ev.Raw} }
705func (e ReparentNotifyEvent) Raw() *[32]byte { return e.raw }
706func (e ReparentNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
707func (e ReparentNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
708func (e ReparentNotifyEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) }
709func (e ReparentNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[16:])) }
710func (e ReparentNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[18:])) }
711func (e ReparentNotifyEvent) OverrideRedirect() bool { return (e.raw[20:][0] != 0) }
712
713// ReparentNotifyEventData encodes a ReparentNotify event for SendEvent.
714type ReparentNotifyEventData struct {
715 Event Window
716 Window Window
717 Parent Window
718 X int16
719 Y int16
720 OverrideRedirect bool
721}
722
723// Put writes the event (code 21, pads and sequence zeroed) into dst. dst may alias
724// memory that d's borrowed fields view, such as the Event.Raw they were read from.
725func (d *ReparentNotifyEventData) Put(dst *[32]byte) {
726 var tmp [32]byte
727 tmp[0] = 21
728 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
729 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
730 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Parent))
731 binary.LittleEndian.PutUint16(tmp[16:], uint16(d.X))
732 binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Y))
733 if d.OverrideRedirect {
734 tmp[20:][0] = 1
735 } else {
736 tmp[20:][0] = 0
737 }
738 *dst = tmp
739}
740
741// KindConfigureNotify identifies ConfigureNotify events in xturbo.Event.Kind.
742const KindConfigureNotify = xturbo.EventKind(22)
743
744// ConfigureNotifyEvent is a view over a ConfigureNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
745type ConfigureNotifyEvent struct{ raw *[32]byte }
746
747// ConfigureNotifyOf views ev as ConfigureNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
748func ConfigureNotifyOf(ev *xturbo.Event) ConfigureNotifyEvent {
749 return ConfigureNotifyEvent{raw: &ev.Raw}
750}
751func (e ConfigureNotifyEvent) Raw() *[32]byte { return e.raw }
752func (e ConfigureNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
753func (e ConfigureNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
754func (e ConfigureNotifyEvent) AboveSibling() Window {
755 return Window(binary.LittleEndian.Uint32(e.raw[12:]))
756}
757func (e ConfigureNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[16:])) }
758func (e ConfigureNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[18:])) }
759func (e ConfigureNotifyEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[20:])) }
760func (e ConfigureNotifyEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[22:])) }
761func (e ConfigureNotifyEvent) BorderWidth() uint16 {
762 return uint16(binary.LittleEndian.Uint16(e.raw[24:]))
763}
764func (e ConfigureNotifyEvent) OverrideRedirect() bool { return (e.raw[26:][0] != 0) }
765
766// ConfigureNotifyEventData encodes a ConfigureNotify event for SendEvent.
767type ConfigureNotifyEventData struct {
768 Event Window
769 Window Window
770 AboveSibling Window
771 X int16
772 Y int16
773 Width uint16
774 Height uint16
775 BorderWidth uint16
776 OverrideRedirect bool
777}
778
779// Put writes the event (code 22, pads and sequence zeroed) into dst. dst may alias
780// memory that d's borrowed fields view, such as the Event.Raw they were read from.
781func (d *ConfigureNotifyEventData) Put(dst *[32]byte) {
782 var tmp [32]byte
783 tmp[0] = 22
784 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
785 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
786 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.AboveSibling))
787 binary.LittleEndian.PutUint16(tmp[16:], uint16(d.X))
788 binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Y))
789 binary.LittleEndian.PutUint16(tmp[20:], uint16(d.Width))
790 binary.LittleEndian.PutUint16(tmp[22:], uint16(d.Height))
791 binary.LittleEndian.PutUint16(tmp[24:], uint16(d.BorderWidth))
792 if d.OverrideRedirect {
793 tmp[26:][0] = 1
794 } else {
795 tmp[26:][0] = 0
796 }
797 *dst = tmp
798}
799
800// KindConfigureRequest identifies ConfigureRequest events in xturbo.Event.Kind.
801const KindConfigureRequest = xturbo.EventKind(23)
802
803// ConfigureRequestEvent is a view over a ConfigureRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
804type ConfigureRequestEvent struct{ raw *[32]byte }
805
806// ConfigureRequestOf views ev as ConfigureRequest without checking ev.Kind: a wrong kind yields garbage, never a panic.
807func ConfigureRequestOf(ev *xturbo.Event) ConfigureRequestEvent {
808 return ConfigureRequestEvent{raw: &ev.Raw}
809}
810func (e ConfigureRequestEvent) Raw() *[32]byte { return e.raw }
811func (e ConfigureRequestEvent) StackMode() StackMode { return StackMode(e.raw[1:][0]) }
812func (e ConfigureRequestEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
813func (e ConfigureRequestEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
814func (e ConfigureRequestEvent) Sibling() Window {
815 return Window(binary.LittleEndian.Uint32(e.raw[12:]))
816}
817func (e ConfigureRequestEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[16:])) }
818func (e ConfigureRequestEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[18:])) }
819func (e ConfigureRequestEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[20:])) }
820func (e ConfigureRequestEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[22:])) }
821func (e ConfigureRequestEvent) BorderWidth() uint16 {
822 return uint16(binary.LittleEndian.Uint16(e.raw[24:]))
823}
824func (e ConfigureRequestEvent) ValueMask() ConfigWindow {
825 return ConfigWindow(binary.LittleEndian.Uint16(e.raw[26:]))
826}
827
828// ConfigureRequestEventData encodes a ConfigureRequest event for SendEvent.
829type ConfigureRequestEventData struct {
830 StackMode StackMode
831 Parent Window
832 Window Window
833 Sibling Window
834 X int16
835 Y int16
836 Width uint16
837 Height uint16
838 BorderWidth uint16
839 ValueMask ConfigWindow
840}
841
842// Put writes the event (code 23, pads and sequence zeroed) into dst. dst may alias
843// memory that d's borrowed fields view, such as the Event.Raw they were read from.
844func (d *ConfigureRequestEventData) Put(dst *[32]byte) {
845 var tmp [32]byte
846 tmp[0] = 23
847 tmp[1:][0] = byte(d.StackMode)
848 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Parent))
849 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
850 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Sibling))
851 binary.LittleEndian.PutUint16(tmp[16:], uint16(d.X))
852 binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Y))
853 binary.LittleEndian.PutUint16(tmp[20:], uint16(d.Width))
854 binary.LittleEndian.PutUint16(tmp[22:], uint16(d.Height))
855 binary.LittleEndian.PutUint16(tmp[24:], uint16(d.BorderWidth))
856 binary.LittleEndian.PutUint16(tmp[26:], uint16(d.ValueMask))
857 *dst = tmp
858}
859
860// KindGravityNotify identifies GravityNotify events in xturbo.Event.Kind.
861const KindGravityNotify = xturbo.EventKind(24)
862
863// GravityNotifyEvent is a view over a GravityNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
864type GravityNotifyEvent struct{ raw *[32]byte }
865
866// GravityNotifyOf views ev as GravityNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
867func GravityNotifyOf(ev *xturbo.Event) GravityNotifyEvent { return GravityNotifyEvent{raw: &ev.Raw} }
868func (e GravityNotifyEvent) Raw() *[32]byte { return e.raw }
869func (e GravityNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
870func (e GravityNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
871func (e GravityNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[12:])) }
872func (e GravityNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[14:])) }
873
874// GravityNotifyEventData encodes a GravityNotify event for SendEvent.
875type GravityNotifyEventData struct {
876 Event Window
877 Window Window
878 X int16
879 Y int16
880}
881
882// Put writes the event (code 24, pads and sequence zeroed) into dst. dst may alias
883// memory that d's borrowed fields view, such as the Event.Raw they were read from.
884func (d *GravityNotifyEventData) Put(dst *[32]byte) {
885 var tmp [32]byte
886 tmp[0] = 24
887 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
888 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
889 binary.LittleEndian.PutUint16(tmp[12:], uint16(d.X))
890 binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Y))
891 *dst = tmp
892}
893
894// KindResizeRequest identifies ResizeRequest events in xturbo.Event.Kind.
895const KindResizeRequest = xturbo.EventKind(25)
896
897// ResizeRequestEvent is a view over a ResizeRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
898type ResizeRequestEvent struct{ raw *[32]byte }
899
900// ResizeRequestOf views ev as ResizeRequest without checking ev.Kind: a wrong kind yields garbage, never a panic.
901func ResizeRequestOf(ev *xturbo.Event) ResizeRequestEvent { return ResizeRequestEvent{raw: &ev.Raw} }
902func (e ResizeRequestEvent) Raw() *[32]byte { return e.raw }
903func (e ResizeRequestEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
904func (e ResizeRequestEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) }
905func (e ResizeRequestEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[10:])) }
906
907// ResizeRequestEventData encodes a ResizeRequest event for SendEvent.
908type ResizeRequestEventData struct {
909 Window Window
910 Width uint16
911 Height uint16
912}
913
914// Put writes the event (code 25, pads and sequence zeroed) into dst. dst may alias
915// memory that d's borrowed fields view, such as the Event.Raw they were read from.
916func (d *ResizeRequestEventData) Put(dst *[32]byte) {
917 var tmp [32]byte
918 tmp[0] = 25
919 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window))
920 binary.LittleEndian.PutUint16(tmp[8:], uint16(d.Width))
921 binary.LittleEndian.PutUint16(tmp[10:], uint16(d.Height))
922 *dst = tmp
923}
924
925// KindCirculateNotify identifies CirculateNotify events in xturbo.Event.Kind.
926const KindCirculateNotify = xturbo.EventKind(26)
927
928// CirculateNotifyEvent is a view over a CirculateNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
929type CirculateNotifyEvent struct{ raw *[32]byte }
930
931// CirculateNotifyOf views ev as CirculateNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
932func CirculateNotifyOf(ev *xturbo.Event) CirculateNotifyEvent {
933 return CirculateNotifyEvent{raw: &ev.Raw}
934}
935func (e CirculateNotifyEvent) Raw() *[32]byte { return e.raw }
936func (e CirculateNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
937func (e CirculateNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
938func (e CirculateNotifyEvent) Place() Place { return Place(e.raw[16:][0]) }
939
940// CirculateNotifyEventData encodes a CirculateNotify event for SendEvent.
941type CirculateNotifyEventData struct {
942 Event Window
943 Window Window
944 Place Place
945}
946
947// Put writes the event (code 26, pads and sequence zeroed) into dst. dst may alias
948// memory that d's borrowed fields view, such as the Event.Raw they were read from.
949func (d *CirculateNotifyEventData) Put(dst *[32]byte) {
950 var tmp [32]byte
951 tmp[0] = 26
952 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event))
953 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window))
954 tmp[16:][0] = byte(d.Place)
955 *dst = tmp
956}
957
958// KindCirculateRequest identifies CirculateRequest events in xturbo.Event.Kind.
959const KindCirculateRequest = xturbo.EventKind(27)
960
961// CirculateRequestEvent shares CirculateNotify's layout (eventcopy).
962type CirculateRequestEvent = CirculateNotifyEvent
963
964// CirculateRequestOf views ev as CirculateRequest without checking ev.Kind.
965func CirculateRequestOf(ev *xturbo.Event) CirculateRequestEvent { return CirculateNotifyOf(ev) }
966
967// CirculateRequestEventData encodes a CirculateRequest event for SendEvent with CirculateNotify's fields.
968type CirculateRequestEventData CirculateNotifyEventData
969
970// Put writes the event (code 27, pads and sequence zeroed) into dst.
971func (d *CirculateRequestEventData) Put(dst *[32]byte) {
972 (*CirculateNotifyEventData)(d).Put(dst)
973 dst[0] = 27
974}
975
976// KindPropertyNotify identifies PropertyNotify events in xturbo.Event.Kind.
977const KindPropertyNotify = xturbo.EventKind(28)
978
979// PropertyNotifyEvent is a view over a PropertyNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
980type PropertyNotifyEvent struct{ raw *[32]byte }
981
982// PropertyNotifyOf views ev as PropertyNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
983func PropertyNotifyOf(ev *xturbo.Event) PropertyNotifyEvent { return PropertyNotifyEvent{raw: &ev.Raw} }
984func (e PropertyNotifyEvent) Raw() *[32]byte { return e.raw }
985func (e PropertyNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
986func (e PropertyNotifyEvent) Atom() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[8:])) }
987func (e PropertyNotifyEvent) Time() Timestamp {
988 return Timestamp(binary.LittleEndian.Uint32(e.raw[12:]))
989}
990func (e PropertyNotifyEvent) State() Property { return Property(e.raw[16:][0]) }
991
992// PropertyNotifyEventData encodes a PropertyNotify event for SendEvent.
993type PropertyNotifyEventData struct {
994 Window Window
995 Atom Atom
996 Time Timestamp
997 State Property
998}
999
1000// Put writes the event (code 28, pads and sequence zeroed) into dst. dst may alias
1001// memory that d's borrowed fields view, such as the Event.Raw they were read from.
1002func (d *PropertyNotifyEventData) Put(dst *[32]byte) {
1003 var tmp [32]byte
1004 tmp[0] = 28
1005 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window))
1006 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Atom))
1007 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Time))
1008 tmp[16:][0] = byte(d.State)
1009 *dst = tmp
1010}
1011
1012// KindSelectionClear identifies SelectionClear events in xturbo.Event.Kind.
1013const KindSelectionClear = xturbo.EventKind(29)
1014
1015// SelectionClearEvent is a view over a SelectionClear event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
1016type SelectionClearEvent struct{ raw *[32]byte }
1017
1018// SelectionClearOf views ev as SelectionClear without checking ev.Kind: a wrong kind yields garbage, never a panic.
1019func SelectionClearOf(ev *xturbo.Event) SelectionClearEvent { return SelectionClearEvent{raw: &ev.Raw} }
1020func (e SelectionClearEvent) Raw() *[32]byte { return e.raw }
1021func (e SelectionClearEvent) Time() Timestamp {
1022 return Timestamp(binary.LittleEndian.Uint32(e.raw[4:]))
1023}
1024func (e SelectionClearEvent) Owner() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
1025func (e SelectionClearEvent) Selection() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[12:])) }
1026
1027// SelectionClearEventData encodes a SelectionClear event for SendEvent.
1028type SelectionClearEventData struct {
1029 Time Timestamp
1030 Owner Window
1031 Selection Atom
1032}
1033
1034// Put writes the event (code 29, pads and sequence zeroed) into dst. dst may alias
1035// memory that d's borrowed fields view, such as the Event.Raw they were read from.
1036func (d *SelectionClearEventData) Put(dst *[32]byte) {
1037 var tmp [32]byte
1038 tmp[0] = 29
1039 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time))
1040 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Owner))
1041 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Selection))
1042 *dst = tmp
1043}
1044
1045// KindSelectionRequest identifies SelectionRequest events in xturbo.Event.Kind.
1046const KindSelectionRequest = xturbo.EventKind(30)
1047
1048// SelectionRequestEvent is a view over a SelectionRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
1049type SelectionRequestEvent struct{ raw *[32]byte }
1050
1051// SelectionRequestOf views ev as SelectionRequest without checking ev.Kind: a wrong kind yields garbage, never a panic.
1052func SelectionRequestOf(ev *xturbo.Event) SelectionRequestEvent {
1053 return SelectionRequestEvent{raw: &ev.Raw}
1054}
1055func (e SelectionRequestEvent) Raw() *[32]byte { return e.raw }
1056func (e SelectionRequestEvent) Time() Timestamp {
1057 return Timestamp(binary.LittleEndian.Uint32(e.raw[4:]))
1058}
1059func (e SelectionRequestEvent) Owner() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) }
1060func (e SelectionRequestEvent) Requestor() Window {
1061 return Window(binary.LittleEndian.Uint32(e.raw[12:]))
1062}
1063func (e SelectionRequestEvent) Selection() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[16:])) }
1064func (e SelectionRequestEvent) Target() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[20:])) }
1065func (e SelectionRequestEvent) Property() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[24:])) }
1066
1067// SelectionRequestEventData encodes a SelectionRequest event for SendEvent.
1068type SelectionRequestEventData struct {
1069 Time Timestamp
1070 Owner Window
1071 Requestor Window
1072 Selection Atom
1073 Target Atom
1074 Property Atom
1075}
1076
1077// Put writes the event (code 30, pads and sequence zeroed) into dst. dst may alias
1078// memory that d's borrowed fields view, such as the Event.Raw they were read from.
1079func (d *SelectionRequestEventData) Put(dst *[32]byte) {
1080 var tmp [32]byte
1081 tmp[0] = 30
1082 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time))
1083 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Owner))
1084 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Requestor))
1085 binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Selection))
1086 binary.LittleEndian.PutUint32(tmp[20:], uint32(d.Target))
1087 binary.LittleEndian.PutUint32(tmp[24:], uint32(d.Property))
1088 *dst = tmp
1089}
1090
1091// KindSelectionNotify identifies SelectionNotify events in xturbo.Event.Kind.
1092const KindSelectionNotify = xturbo.EventKind(31)
1093
1094// SelectionNotifyEvent is a view over a SelectionNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
1095type SelectionNotifyEvent struct{ raw *[32]byte }
1096
1097// SelectionNotifyOf views ev as SelectionNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
1098func SelectionNotifyOf(ev *xturbo.Event) SelectionNotifyEvent {
1099 return SelectionNotifyEvent{raw: &ev.Raw}
1100}
1101func (e SelectionNotifyEvent) Raw() *[32]byte { return e.raw }
1102func (e SelectionNotifyEvent) Time() Timestamp {
1103 return Timestamp(binary.LittleEndian.Uint32(e.raw[4:]))
1104}
1105func (e SelectionNotifyEvent) Requestor() Window {
1106 return Window(binary.LittleEndian.Uint32(e.raw[8:]))
1107}
1108func (e SelectionNotifyEvent) Selection() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[12:])) }
1109func (e SelectionNotifyEvent) Target() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[16:])) }
1110func (e SelectionNotifyEvent) Property() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[20:])) }
1111
1112// SelectionNotifyEventData encodes a SelectionNotify event for SendEvent.
1113type SelectionNotifyEventData struct {
1114 Time Timestamp
1115 Requestor Window
1116 Selection Atom
1117 Target Atom
1118 Property Atom
1119}
1120
1121// Put writes the event (code 31, pads and sequence zeroed) into dst. dst may alias
1122// memory that d's borrowed fields view, such as the Event.Raw they were read from.
1123func (d *SelectionNotifyEventData) Put(dst *[32]byte) {
1124 var tmp [32]byte
1125 tmp[0] = 31
1126 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time))
1127 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Requestor))
1128 binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Selection))
1129 binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Target))
1130 binary.LittleEndian.PutUint32(tmp[20:], uint32(d.Property))
1131 *dst = tmp
1132}
1133
1134// KindColormapNotify identifies ColormapNotify events in xturbo.Event.Kind.
1135const KindColormapNotify = xturbo.EventKind(32)
1136
1137// ColormapNotifyEvent is a view over a ColormapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
1138type ColormapNotifyEvent struct{ raw *[32]byte }
1139
1140// ColormapNotifyOf views ev as ColormapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
1141func ColormapNotifyOf(ev *xturbo.Event) ColormapNotifyEvent { return ColormapNotifyEvent{raw: &ev.Raw} }
1142func (e ColormapNotifyEvent) Raw() *[32]byte { return e.raw }
1143func (e ColormapNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
1144func (e ColormapNotifyEvent) Colormap() Colormap {
1145 return Colormap(binary.LittleEndian.Uint32(e.raw[8:]))
1146}
1147func (e ColormapNotifyEvent) New() bool { return (e.raw[12:][0] != 0) }
1148func (e ColormapNotifyEvent) State() ColormapState { return ColormapState(e.raw[13:][0]) }
1149
1150// ColormapNotifyEventData encodes a ColormapNotify event for SendEvent.
1151type ColormapNotifyEventData struct {
1152 Window Window
1153 Colormap Colormap
1154 New bool
1155 State ColormapState
1156}
1157
1158// Put writes the event (code 32, pads and sequence zeroed) into dst. dst may alias
1159// memory that d's borrowed fields view, such as the Event.Raw they were read from.
1160func (d *ColormapNotifyEventData) Put(dst *[32]byte) {
1161 var tmp [32]byte
1162 tmp[0] = 32
1163 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window))
1164 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Colormap))
1165 if d.New {
1166 tmp[12:][0] = 1
1167 } else {
1168 tmp[12:][0] = 0
1169 }
1170 tmp[13:][0] = byte(d.State)
1171 *dst = tmp
1172}
1173
1174// KindClientMessage identifies ClientMessage events in xturbo.Event.Kind.
1175const KindClientMessage = xturbo.EventKind(33)
1176
1177// ClientMessageEvent is a view over a ClientMessage event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
1178type ClientMessageEvent struct{ raw *[32]byte }
1179
1180// ClientMessageOf views ev as ClientMessage without checking ev.Kind: a wrong kind yields garbage, never a panic.
1181func ClientMessageOf(ev *xturbo.Event) ClientMessageEvent { return ClientMessageEvent{raw: &ev.Raw} }
1182func (e ClientMessageEvent) Raw() *[32]byte { return e.raw }
1183func (e ClientMessageEvent) Format() uint8 { return uint8(e.raw[1:][0]) }
1184func (e ClientMessageEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) }
1185func (e ClientMessageEvent) Type() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[8:])) }
1186func (e ClientMessageEvent) Data() ClientMessageData { return GetClientMessageData(e.raw[12:]) }
1187
1188// ClientMessageEventData encodes a ClientMessage event for SendEvent.
1189type ClientMessageEventData struct {
1190 Format uint8
1191 Window Window
1192 Type Atom
1193 Data ClientMessageData
1194}
1195
1196// Put writes the event (code 33, pads and sequence zeroed) into dst. dst may alias
1197// memory that d's borrowed fields view, such as the Event.Raw they were read from.
1198func (d *ClientMessageEventData) Put(dst *[32]byte) {
1199 var tmp [32]byte
1200 tmp[0] = 33
1201 tmp[1:][0] = byte(d.Format)
1202 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window))
1203 binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Type))
1204 d.Data.Put(tmp[12:])
1205 *dst = tmp
1206}
1207
1208// KindMappingNotify identifies MappingNotify events in xturbo.Event.Kind.
1209const KindMappingNotify = xturbo.EventKind(34)
1210
1211// MappingNotifyEvent is a view over a MappingNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from.
1212type MappingNotifyEvent struct{ raw *[32]byte }
1213
1214// MappingNotifyOf views ev as MappingNotify without checking ev.Kind: a wrong kind yields garbage, never a panic.
1215func MappingNotifyOf(ev *xturbo.Event) MappingNotifyEvent { return MappingNotifyEvent{raw: &ev.Raw} }
1216func (e MappingNotifyEvent) Raw() *[32]byte { return e.raw }
1217func (e MappingNotifyEvent) Request() Mapping { return Mapping(e.raw[4:][0]) }
1218func (e MappingNotifyEvent) FirstKeycode() Keycode { return Keycode(e.raw[5:][0]) }
1219func (e MappingNotifyEvent) Count() uint8 { return uint8(e.raw[6:][0]) }
1220
1221// MappingNotifyEventData encodes a MappingNotify event for SendEvent.
1222type MappingNotifyEventData struct {
1223 Request Mapping
1224 FirstKeycode Keycode
1225 Count uint8
1226}
1227
1228// Put writes the event (code 34, pads and sequence zeroed) into dst. dst may alias
1229// memory that d's borrowed fields view, such as the Event.Raw they were read from.
1230func (d *MappingNotifyEventData) Put(dst *[32]byte) {
1231 var tmp [32]byte
1232 tmp[0] = 34
1233 tmp[4:][0] = byte(d.Request)
1234 tmp[5:][0] = byte(d.FirstKeycode)
1235 tmp[6:][0] = byte(d.Count)
1236 *dst = tmp
1237}
1238
1239// GeGenericEvent is a view over a GeGeneric generic event: the copied Event.Raw plus the borrowed Event.Tail.
1240// Tail is valid only until the Handler callback returns; copy what you keep.
1241type GeGenericEvent struct {
1242 raw *[32]byte
1243 tail []byte
1244}
1245
1246// GeGenericOf views ev as GeGeneric; false when ev is not a generic event or Tail does not match its length.
1247func GeGenericOf(ev *xturbo.Event) (GeGenericEvent, bool) {
1248 if ev.Raw[0]&0x7f != 35 || len(ev.Tail) != 4*int(binary.LittleEndian.Uint32(ev.Raw[4:])) {
1249 return GeGenericEvent{}, false
1250 }
1251 return GeGenericEvent{raw: &ev.Raw, tail: ev.Tail}, true
1252}
1253func (e GeGenericEvent) Extension() uint8 { return e.raw[1] }
1254func (e GeGenericEvent) Length() uint32 { return binary.LittleEndian.Uint32(e.raw[4:]) }
1255func (e GeGenericEvent) EventType() uint16 { return binary.LittleEndian.Uint16(e.raw[8:]) }
1256func (e GeGenericEvent) Tail() []byte { return e.tail }
1257func (e GeGenericEvent) Raw() *[32]byte { return e.raw }