1// Code generated by wlturbo-scanner. DO NOT EDIT.
2// Protocol: wayland
3// Source: wayland.xml
4
5package core
6
7import (
8 "sync"
9
10 "github.com/bnema/wlturbo/wl"
11)
12
13// WL_SHM_POOL_ERROR_INVALID_FORMAT is the error invalid_format value.
14const WL_SHM_POOL_ERROR_INVALID_FORMAT = 0
15
16// WL_SHM_POOL_ERROR_INVALID_STRIDE is the error invalid_stride value.
17const WL_SHM_POOL_ERROR_INVALID_STRIDE = 1
18
19// WL_SHM_ERROR_INVALID_FORMAT is the error invalid_format value.
20const WL_SHM_ERROR_INVALID_FORMAT = 0
21
22// WL_SHM_ERROR_INVALID_STRIDE is the error invalid_stride value.
23const WL_SHM_ERROR_INVALID_STRIDE = 1
24
25// ERROR_INVALID_FD is the error invalid_fd value.
26const ERROR_INVALID_FD = 2
27
28// FORMAT_ARGB8888 is the format argb8888 value.
29const FORMAT_ARGB8888 = 0
30
31// FORMAT_XRGB8888 is the format xrgb8888 value.
32const FORMAT_XRGB8888 = 1
33
34// FORMAT_C8 is the format c8 value.
35const FORMAT_C8 = 0x20203843
36
37// FORMAT_RGB332 is the format rgb332 value.
38const FORMAT_RGB332 = 0x38424752
39
40// FORMAT_BGR233 is the format bgr233 value.
41const FORMAT_BGR233 = 0x38524742
42
43// FORMAT_XRGB4444 is the format xrgb4444 value.
44const FORMAT_XRGB4444 = 0x32315258
45
46// FORMAT_XBGR4444 is the format xbgr4444 value.
47const FORMAT_XBGR4444 = 0x32314258
48
49// FORMAT_RGBX4444 is the format rgbx4444 value.
50const FORMAT_RGBX4444 = 0x32315852
51
52// FORMAT_BGRX4444 is the format bgrx4444 value.
53const FORMAT_BGRX4444 = 0x32315842
54
55// FORMAT_ARGB4444 is the format argb4444 value.
56const FORMAT_ARGB4444 = 0x32315241
57
58// FORMAT_ABGR4444 is the format abgr4444 value.
59const FORMAT_ABGR4444 = 0x32314241
60
61// FORMAT_RGBA4444 is the format rgba4444 value.
62const FORMAT_RGBA4444 = 0x32314152
63
64// FORMAT_BGRA4444 is the format bgra4444 value.
65const FORMAT_BGRA4444 = 0x32314142
66
67// FORMAT_XRGB1555 is the format xrgb1555 value.
68const FORMAT_XRGB1555 = 0x35315258
69
70// FORMAT_XBGR1555 is the format xbgr1555 value.
71const FORMAT_XBGR1555 = 0x35314258
72
73// FORMAT_RGBX5551 is the format rgbx5551 value.
74const FORMAT_RGBX5551 = 0x35315852
75
76// FORMAT_BGRX5551 is the format bgrx5551 value.
77const FORMAT_BGRX5551 = 0x35315842
78
79// FORMAT_ARGB1555 is the format argb1555 value.
80const FORMAT_ARGB1555 = 0x35315241
81
82// FORMAT_ABGR1555 is the format abgr1555 value.
83const FORMAT_ABGR1555 = 0x35314241
84
85// FORMAT_RGBA5551 is the format rgba5551 value.
86const FORMAT_RGBA5551 = 0x35314152
87
88// FORMAT_BGRA5551 is the format bgra5551 value.
89const FORMAT_BGRA5551 = 0x35314142
90
91// FORMAT_RGB565 is the format rgb565 value.
92const FORMAT_RGB565 = 0x36314752
93
94// FORMAT_BGR565 is the format bgr565 value.
95const FORMAT_BGR565 = 0x36314742
96
97// FORMAT_RGB888 is the format rgb888 value.
98const FORMAT_RGB888 = 0x34324752
99
100// FORMAT_BGR888 is the format bgr888 value.
101const FORMAT_BGR888 = 0x34324742
102
103// FORMAT_XBGR8888 is the format xbgr8888 value.
104const FORMAT_XBGR8888 = 0x34324258
105
106// FORMAT_RGBX8888 is the format rgbx8888 value.
107const FORMAT_RGBX8888 = 0x34325852
108
109// FORMAT_BGRX8888 is the format bgrx8888 value.
110const FORMAT_BGRX8888 = 0x34325842
111
112// FORMAT_ABGR8888 is the format abgr8888 value.
113const FORMAT_ABGR8888 = 0x34324241
114
115// FORMAT_RGBA8888 is the format rgba8888 value.
116const FORMAT_RGBA8888 = 0x34324152
117
118// FORMAT_BGRA8888 is the format bgra8888 value.
119const FORMAT_BGRA8888 = 0x34324142
120
121// FORMAT_XRGB2101010 is the format xrgb2101010 value.
122const FORMAT_XRGB2101010 = 0x30335258
123
124// FORMAT_XBGR2101010 is the format xbgr2101010 value.
125const FORMAT_XBGR2101010 = 0x30334258
126
127// FORMAT_RGBX1010102 is the format rgbx1010102 value.
128const FORMAT_RGBX1010102 = 0x30335852
129
130// FORMAT_BGRX1010102 is the format bgrx1010102 value.
131const FORMAT_BGRX1010102 = 0x30335842
132
133// FORMAT_ARGB2101010 is the format argb2101010 value.
134const FORMAT_ARGB2101010 = 0x30335241
135
136// FORMAT_ABGR2101010 is the format abgr2101010 value.
137const FORMAT_ABGR2101010 = 0x30334241
138
139// FORMAT_RGBA1010102 is the format rgba1010102 value.
140const FORMAT_RGBA1010102 = 0x30334152
141
142// FORMAT_BGRA1010102 is the format bgra1010102 value.
143const FORMAT_BGRA1010102 = 0x30334142
144
145// FORMAT_YUYV is the format yuyv value.
146const FORMAT_YUYV = 0x56595559
147
148// FORMAT_YVYU is the format yvyu value.
149const FORMAT_YVYU = 0x55595659
150
151// FORMAT_UYVY is the format uyvy value.
152const FORMAT_UYVY = 0x59565955
153
154// FORMAT_VYUY is the format vyuy value.
155const FORMAT_VYUY = 0x59555956
156
157// FORMAT_AYUV is the format ayuv value.
158const FORMAT_AYUV = 0x56555941
159
160// FORMAT_NV12 is the format nv12 value.
161const FORMAT_NV12 = 0x3231564e
162
163// FORMAT_NV21 is the format nv21 value.
164const FORMAT_NV21 = 0x3132564e
165
166// FORMAT_NV16 is the format nv16 value.
167const FORMAT_NV16 = 0x3631564e
168
169// FORMAT_NV61 is the format nv61 value.
170const FORMAT_NV61 = 0x3136564e
171
172// FORMAT_YUV410 is the format yuv410 value.
173const FORMAT_YUV410 = 0x39565559
174
175// FORMAT_YVU410 is the format yvu410 value.
176const FORMAT_YVU410 = 0x39555659
177
178// FORMAT_YUV411 is the format yuv411 value.
179const FORMAT_YUV411 = 0x31315559
180
181// FORMAT_YVU411 is the format yvu411 value.
182const FORMAT_YVU411 = 0x31315659
183
184// FORMAT_YUV420 is the format yuv420 value.
185const FORMAT_YUV420 = 0x32315559
186
187// FORMAT_YVU420 is the format yvu420 value.
188const FORMAT_YVU420 = 0x32315659
189
190// FORMAT_YUV422 is the format yuv422 value.
191const FORMAT_YUV422 = 0x36315559
192
193// FORMAT_YVU422 is the format yvu422 value.
194const FORMAT_YVU422 = 0x36315659
195
196// FORMAT_YUV444 is the format yuv444 value.
197const FORMAT_YUV444 = 0x34325559
198
199// FORMAT_YVU444 is the format yvu444 value.
200const FORMAT_YVU444 = 0x34325659
201
202// FORMAT_R8 is the format r8 value.
203const FORMAT_R8 = 0x20203852
204
205// FORMAT_R16 is the format r16 value.
206const FORMAT_R16 = 0x20363152
207
208// FORMAT_RG88 is the format rg88 value.
209const FORMAT_RG88 = 0x38384752
210
211// FORMAT_GR88 is the format gr88 value.
212const FORMAT_GR88 = 0x38385247
213
214// FORMAT_RG1616 is the format rg1616 value.
215const FORMAT_RG1616 = 0x32334752
216
217// FORMAT_GR1616 is the format gr1616 value.
218const FORMAT_GR1616 = 0x32335247
219
220// FORMAT_XRGB16161616F is the format xrgb16161616f value.
221const FORMAT_XRGB16161616F = 0x48345258
222
223// FORMAT_XBGR16161616F is the format xbgr16161616f value.
224const FORMAT_XBGR16161616F = 0x48344258
225
226// FORMAT_ARGB16161616F is the format argb16161616f value.
227const FORMAT_ARGB16161616F = 0x48345241
228
229// FORMAT_ABGR16161616F is the format abgr16161616f value.
230const FORMAT_ABGR16161616F = 0x48344241
231
232// FORMAT_XYUV8888 is the format xyuv8888 value.
233const FORMAT_XYUV8888 = 0x56555958
234
235// FORMAT_VUY888 is the format vuy888 value.
236const FORMAT_VUY888 = 0x34325556
237
238// FORMAT_VUY101010 is the format vuy101010 value.
239const FORMAT_VUY101010 = 0x30335556
240
241// FORMAT_Y210 is the format y210 value.
242const FORMAT_Y210 = 0x30313259
243
244// FORMAT_Y212 is the format y212 value.
245const FORMAT_Y212 = 0x32313259
246
247// FORMAT_Y216 is the format y216 value.
248const FORMAT_Y216 = 0x36313259
249
250// FORMAT_Y410 is the format y410 value.
251const FORMAT_Y410 = 0x30313459
252
253// FORMAT_Y412 is the format y412 value.
254const FORMAT_Y412 = 0x32313459
255
256// FORMAT_Y416 is the format y416 value.
257const FORMAT_Y416 = 0x36313459
258
259// FORMAT_XVYU2101010 is the format xvyu2101010 value.
260const FORMAT_XVYU2101010 = 0x30335658
261
262// FORMAT_XVYU12_16161616 is the format xvyu12_16161616 value.
263const FORMAT_XVYU12_16161616 = 0x36335658
264
265// FORMAT_XVYU16161616 is the format xvyu16161616 value.
266const FORMAT_XVYU16161616 = 0x38345658
267
268// FORMAT_Y0L0 is the format y0l0 value.
269const FORMAT_Y0L0 = 0x304c3059
270
271// FORMAT_X0L0 is the format x0l0 value.
272const FORMAT_X0L0 = 0x304c3058
273
274// FORMAT_Y0L2 is the format y0l2 value.
275const FORMAT_Y0L2 = 0x324c3059
276
277// FORMAT_X0L2 is the format x0l2 value.
278const FORMAT_X0L2 = 0x324c3058
279
280// FORMAT_YUV420_8BIT is the format yuv420_8bit value.
281const FORMAT_YUV420_8BIT = 0x38305559
282
283// FORMAT_YUV420_10BIT is the format yuv420_10bit value.
284const FORMAT_YUV420_10BIT = 0x30315559
285
286// FORMAT_XRGB8888_A8 is the format xrgb8888_a8 value.
287const FORMAT_XRGB8888_A8 = 0x38415258
288
289// FORMAT_XBGR8888_A8 is the format xbgr8888_a8 value.
290const FORMAT_XBGR8888_A8 = 0x38414258
291
292// FORMAT_RGBX8888_A8 is the format rgbx8888_a8 value.
293const FORMAT_RGBX8888_A8 = 0x38415852
294
295// FORMAT_BGRX8888_A8 is the format bgrx8888_a8 value.
296const FORMAT_BGRX8888_A8 = 0x38415842
297
298// FORMAT_RGB888_A8 is the format rgb888_a8 value.
299const FORMAT_RGB888_A8 = 0x38413852
300
301// FORMAT_BGR888_A8 is the format bgr888_a8 value.
302const FORMAT_BGR888_A8 = 0x38413842
303
304// FORMAT_RGB565_A8 is the format rgb565_a8 value.
305const FORMAT_RGB565_A8 = 0x38413552
306
307// FORMAT_BGR565_A8 is the format bgr565_a8 value.
308const FORMAT_BGR565_A8 = 0x38413542
309
310// FORMAT_NV24 is the format nv24 value.
311const FORMAT_NV24 = 0x3432564e
312
313// FORMAT_NV42 is the format nv42 value.
314const FORMAT_NV42 = 0x3234564e
315
316// FORMAT_P210 is the format p210 value.
317const FORMAT_P210 = 0x30313250
318
319// FORMAT_P010 is the format p010 value.
320const FORMAT_P010 = 0x30313050
321
322// FORMAT_P012 is the format p012 value.
323const FORMAT_P012 = 0x32313050
324
325// FORMAT_P016 is the format p016 value.
326const FORMAT_P016 = 0x36313050
327
328// FORMAT_AXBXGXRX106106106106 is the format axbxgxrx106106106106 value.
329const FORMAT_AXBXGXRX106106106106 = 0x30314241
330
331// FORMAT_NV15 is the format nv15 value.
332const FORMAT_NV15 = 0x3531564e
333
334// FORMAT_Q410 is the format q410 value.
335const FORMAT_Q410 = 0x30313451
336
337// FORMAT_Q401 is the format q401 value.
338const FORMAT_Q401 = 0x31303451
339
340// FORMAT_XRGB16161616 is the format xrgb16161616 value.
341const FORMAT_XRGB16161616 = 0x38345258
342
343// FORMAT_XBGR16161616 is the format xbgr16161616 value.
344const FORMAT_XBGR16161616 = 0x38344258
345
346// FORMAT_ARGB16161616 is the format argb16161616 value.
347const FORMAT_ARGB16161616 = 0x38345241
348
349// FORMAT_ABGR16161616 is the format abgr16161616 value.
350const FORMAT_ABGR16161616 = 0x38344241
351
352// FORMAT_C1 is the format c1 value.
353const FORMAT_C1 = 0x20203143
354
355// FORMAT_C2 is the format c2 value.
356const FORMAT_C2 = 0x20203243
357
358// FORMAT_C4 is the format c4 value.
359const FORMAT_C4 = 0x20203443
360
361// FORMAT_D1 is the format d1 value.
362const FORMAT_D1 = 0x20203144
363
364// FORMAT_D2 is the format d2 value.
365const FORMAT_D2 = 0x20203244
366
367// FORMAT_D4 is the format d4 value.
368const FORMAT_D4 = 0x20203444
369
370// FORMAT_D8 is the format d8 value.
371const FORMAT_D8 = 0x20203844
372
373// FORMAT_R1 is the format r1 value.
374const FORMAT_R1 = 0x20203152
375
376// FORMAT_R2 is the format r2 value.
377const FORMAT_R2 = 0x20203252
378
379// FORMAT_R4 is the format r4 value.
380const FORMAT_R4 = 0x20203452
381
382// FORMAT_R10 is the format r10 value.
383const FORMAT_R10 = 0x20303152
384
385// FORMAT_R12 is the format r12 value.
386const FORMAT_R12 = 0x20323152
387
388// FORMAT_AVUY8888 is the format avuy8888 value.
389const FORMAT_AVUY8888 = 0x59555641
390
391// FORMAT_XVUY8888 is the format xvuy8888 value.
392const FORMAT_XVUY8888 = 0x59555658
393
394// FORMAT_P030 is the format p030 value.
395const FORMAT_P030 = 0x30333050
396
397// FORMAT_RGB161616 is the format rgb161616 value.
398const FORMAT_RGB161616 = 0x38344752
399
400// FORMAT_BGR161616 is the format bgr161616 value.
401const FORMAT_BGR161616 = 0x38344742
402
403// FORMAT_R16F is the format r16f value.
404const FORMAT_R16F = 0x48202052
405
406// FORMAT_GR1616F is the format gr1616f value.
407const FORMAT_GR1616F = 0x48205247
408
409// FORMAT_BGR161616F is the format bgr161616f value.
410const FORMAT_BGR161616F = 0x48524742
411
412// FORMAT_R32F is the format r32f value.
413const FORMAT_R32F = 0x46202052
414
415// FORMAT_GR3232F is the format gr3232f value.
416const FORMAT_GR3232F = 0x46205247
417
418// FORMAT_BGR323232F is the format bgr323232f value.
419const FORMAT_BGR323232F = 0x46524742
420
421// FORMAT_ABGR32323232F is the format abgr32323232f value.
422const FORMAT_ABGR32323232F = 0x46384241
423
424// FORMAT_NV20 is the format nv20 value.
425const FORMAT_NV20 = 0x3032564e
426
427// FORMAT_NV30 is the format nv30 value.
428const FORMAT_NV30 = 0x3033564e
429
430// FORMAT_S010 is the format s010 value.
431const FORMAT_S010 = 0x30313053
432
433// FORMAT_S210 is the format s210 value.
434const FORMAT_S210 = 0x30313253
435
436// FORMAT_S410 is the format s410 value.
437const FORMAT_S410 = 0x30313453
438
439// FORMAT_S012 is the format s012 value.
440const FORMAT_S012 = 0x32313053
441
442// FORMAT_S212 is the format s212 value.
443const FORMAT_S212 = 0x32313253
444
445// FORMAT_S412 is the format s412 value.
446const FORMAT_S412 = 0x32313453
447
448// FORMAT_S016 is the format s016 value.
449const FORMAT_S016 = 0x36313053
450
451// FORMAT_S216 is the format s216 value.
452const FORMAT_S216 = 0x36313253
453
454// FORMAT_S416 is the format s416 value.
455const FORMAT_S416 = 0x36313453
456
457// FORMAT_XVUY2101010 is the format xvuy2101010 value.
458const FORMAT_XVUY2101010 = 0x30335958
459
460// FORMAT_P230 is the format p230 value.
461const FORMAT_P230 = 0x30333250
462
463// FORMAT_T430 is the format t430 value.
464const FORMAT_T430 = 0x30333454
465
466// FORMAT_Y8 is the format y8 value.
467const FORMAT_Y8 = 0x59455247
468
469// FORMAT_XYYY2101010 is the format xyyy2101010 value.
470const FORMAT_XYYY2101010 = 0x34415059
471
472// ERROR_INVALID_FINISH is the error invalid_finish value.
473const ERROR_INVALID_FINISH = 0
474
475// WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK is the error invalid_action_mask value.
476const WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK = 1
477
478// ERROR_INVALID_ACTION is the error invalid_action value.
479const ERROR_INVALID_ACTION = 2
480
481// ERROR_INVALID_OFFER is the error invalid_offer value.
482const ERROR_INVALID_OFFER = 3
483
484// WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK is the error invalid_action_mask value.
485const WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK = 0
486
487// ERROR_INVALID_SOURCE is the error invalid_source value.
488const ERROR_INVALID_SOURCE = 1
489
490// WL_DATA_DEVICE_ERROR_ROLE is the error role value.
491const WL_DATA_DEVICE_ERROR_ROLE = 0
492
493// ERROR_USED_SOURCE is the error used_source value.
494const ERROR_USED_SOURCE = 1
495
496// DND_ACTION_NONE is the dnd_action none value.
497const DND_ACTION_NONE = 0
498
499// DND_ACTION_COPY is the dnd_action copy value.
500const DND_ACTION_COPY = 1
501
502// DND_ACTION_MOVE is the dnd_action move value.
503const DND_ACTION_MOVE = 2
504
505// DND_ACTION_ASK is the dnd_action ask value.
506const DND_ACTION_ASK = 4
507
508// WL_SHELL_ERROR_ROLE is the error role value.
509const WL_SHELL_ERROR_ROLE = 0
510
511// RESIZE_NONE is the resize none value.
512const RESIZE_NONE = 0
513
514// RESIZE_TOP is the resize top value.
515const RESIZE_TOP = 1
516
517// RESIZE_BOTTOM is the resize bottom value.
518const RESIZE_BOTTOM = 2
519
520// RESIZE_LEFT is the resize left value.
521const RESIZE_LEFT = 4
522
523// RESIZE_TOP_LEFT is the resize top_left value.
524const RESIZE_TOP_LEFT = 5
525
526// RESIZE_BOTTOM_LEFT is the resize bottom_left value.
527const RESIZE_BOTTOM_LEFT = 6
528
529// RESIZE_RIGHT is the resize right value.
530const RESIZE_RIGHT = 8
531
532// RESIZE_TOP_RIGHT is the resize top_right value.
533const RESIZE_TOP_RIGHT = 9
534
535// RESIZE_BOTTOM_RIGHT is the resize bottom_right value.
536const RESIZE_BOTTOM_RIGHT = 10
537
538// TRANSIENT_INACTIVE is the transient inactive value.
539const TRANSIENT_INACTIVE = 0x1
540
541// FULLSCREEN_METHOD_DEFAULT is the fullscreen_method default value.
542const FULLSCREEN_METHOD_DEFAULT = 0
543
544// FULLSCREEN_METHOD_SCALE is the fullscreen_method scale value.
545const FULLSCREEN_METHOD_SCALE = 1
546
547// FULLSCREEN_METHOD_DRIVER is the fullscreen_method driver value.
548const FULLSCREEN_METHOD_DRIVER = 2
549
550// FULLSCREEN_METHOD_FILL is the fullscreen_method fill value.
551const FULLSCREEN_METHOD_FILL = 3
552
553// ERROR_INVALID_SCALE is the error invalid_scale value.
554const ERROR_INVALID_SCALE = 0
555
556// ERROR_INVALID_TRANSFORM is the error invalid_transform value.
557const ERROR_INVALID_TRANSFORM = 1
558
559// ERROR_INVALID_SIZE is the error invalid_size value.
560const ERROR_INVALID_SIZE = 2
561
562// ERROR_INVALID_OFFSET is the error invalid_offset value.
563const ERROR_INVALID_OFFSET = 3
564
565// ERROR_DEFUNCT_ROLE_OBJECT is the error defunct_role_object value.
566const ERROR_DEFUNCT_ROLE_OBJECT = 4
567
568// ERROR_NO_BUFFER is the error no_buffer value.
569const ERROR_NO_BUFFER = 5
570
571// CAPABILITY_POINTER is the capability pointer value.
572const CAPABILITY_POINTER = 1
573
574// CAPABILITY_KEYBOARD is the capability keyboard value.
575const CAPABILITY_KEYBOARD = 2
576
577// CAPABILITY_TOUCH is the capability touch value.
578const CAPABILITY_TOUCH = 4
579
580// ERROR_MISSING_CAPABILITY is the error missing_capability value.
581const ERROR_MISSING_CAPABILITY = 0
582
583// WL_POINTER_ERROR_ROLE is the error role value.
584const WL_POINTER_ERROR_ROLE = 0
585
586// BUTTON_STATE_RELEASED is the button_state released value.
587const BUTTON_STATE_RELEASED = 0
588
589// BUTTON_STATE_PRESSED is the button_state pressed value.
590const BUTTON_STATE_PRESSED = 1
591
592// AXIS_VERTICAL_SCROLL is the axis vertical_scroll value.
593const AXIS_VERTICAL_SCROLL = 0
594
595// AXIS_HORIZONTAL_SCROLL is the axis horizontal_scroll value.
596const AXIS_HORIZONTAL_SCROLL = 1
597
598// AXIS_SOURCE_WHEEL is the axis_source wheel value.
599const AXIS_SOURCE_WHEEL = 0
600
601// AXIS_SOURCE_FINGER is the axis_source finger value.
602const AXIS_SOURCE_FINGER = 1
603
604// AXIS_SOURCE_CONTINUOUS is the axis_source continuous value.
605const AXIS_SOURCE_CONTINUOUS = 2
606
607// AXIS_SOURCE_WHEEL_TILT is the axis_source wheel_tilt value.
608const AXIS_SOURCE_WHEEL_TILT = 3
609
610// AXIS_RELATIVE_DIRECTION_IDENTICAL is the axis_relative_direction identical value.
611const AXIS_RELATIVE_DIRECTION_IDENTICAL = 0
612
613// AXIS_RELATIVE_DIRECTION_INVERTED is the axis_relative_direction inverted value.
614const AXIS_RELATIVE_DIRECTION_INVERTED = 1
615
616// KEYMAP_FORMAT_NO_KEYMAP is the keymap_format no_keymap value.
617const KEYMAP_FORMAT_NO_KEYMAP = 0
618
619// KEYMAP_FORMAT_XKB_V1 is the keymap_format xkb_v1 value.
620const KEYMAP_FORMAT_XKB_V1 = 1
621
622// KEY_STATE_RELEASED is the key_state released value.
623const KEY_STATE_RELEASED = 0
624
625// KEY_STATE_PRESSED is the key_state pressed value.
626const KEY_STATE_PRESSED = 1
627
628// KEY_STATE_REPEATED is the key_state repeated value.
629const KEY_STATE_REPEATED = 2
630
631// SUBPIXEL_UNKNOWN is the subpixel unknown value.
632const SUBPIXEL_UNKNOWN = 0
633
634// SUBPIXEL_NONE is the subpixel none value.
635const SUBPIXEL_NONE = 1
636
637// SUBPIXEL_HORIZONTAL_RGB is the subpixel horizontal_rgb value.
638const SUBPIXEL_HORIZONTAL_RGB = 2
639
640// SUBPIXEL_HORIZONTAL_BGR is the subpixel horizontal_bgr value.
641const SUBPIXEL_HORIZONTAL_BGR = 3
642
643// SUBPIXEL_VERTICAL_RGB is the subpixel vertical_rgb value.
644const SUBPIXEL_VERTICAL_RGB = 4
645
646// SUBPIXEL_VERTICAL_BGR is the subpixel vertical_bgr value.
647const SUBPIXEL_VERTICAL_BGR = 5
648
649// TRANSFORM_NORMAL is the transform normal value.
650const TRANSFORM_NORMAL = 0
651
652// TRANSFORM_90 is the transform 90 value.
653const TRANSFORM_90 = 1
654
655// TRANSFORM_180 is the transform 180 value.
656const TRANSFORM_180 = 2
657
658// TRANSFORM_270 is the transform 270 value.
659const TRANSFORM_270 = 3
660
661// TRANSFORM_FLIPPED is the transform flipped value.
662const TRANSFORM_FLIPPED = 4
663
664// TRANSFORM_FLIPPED_90 is the transform flipped_90 value.
665const TRANSFORM_FLIPPED_90 = 5
666
667// TRANSFORM_FLIPPED_180 is the transform flipped_180 value.
668const TRANSFORM_FLIPPED_180 = 6
669
670// TRANSFORM_FLIPPED_270 is the transform flipped_270 value.
671const TRANSFORM_FLIPPED_270 = 7
672
673// MODE_CURRENT is the mode current value.
674const MODE_CURRENT = 0x1
675
676// MODE_PREFERRED is the mode preferred value.
677const MODE_PREFERRED = 0x2
678
679// WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE is the error bad_surface value.
680const WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0
681
682// ERROR_BAD_PARENT is the error bad_parent value.
683const ERROR_BAD_PARENT = 1
684
685// WL_SUBSURFACE_ERROR_BAD_SURFACE is the error bad_surface value.
686const WL_SUBSURFACE_ERROR_BAD_SURFACE = 0
687
688// ERROR_INVALID_ACK_REMOVE is the error invalid_ack_remove value.
689const ERROR_INVALID_ACK_REMOVE = 0
690
691// CallbackInterface is the protocol interface name.
692const CallbackInterface = "wl_callback"
693
694// Callback is the generated binding for wl_callback version 1.
695type Callback struct {
696 wl.BaseProxy
697 // handlersMu guards the handler slices: a client may register or replace
698 // handlers while another goroutine dispatches events.
699 handlersMu sync.Mutex
700 onDone []func(callbackData uint32)
701}
702
703// NewCallback returns an unbound Callback.
704func NewCallback(ctx *wl.Context) *Callback {
705 obj := &Callback{}
706 obj.SetContext(ctx)
707 ctx.Register(obj)
708 return obj
709}
710
711// OnDone registers a handler for the done event.
712//
713// Handlers are appended, so a second call adds another handler rather than
714// replacing the first. Registration is safe while another goroutine dispatches.
715func (o *Callback) OnDone(handler func(callbackData uint32)) {
716 if handler == nil {
717 return
718 }
719 o.handlersMu.Lock()
720 defer o.handlersMu.Unlock()
721 o.onDone = append(o.onDone, handler)
722}
723
724// handlersForDone returns the handlers registered for done, taken
725// under the lock so a handler may register another handler while events are
726// being dispatched.
727func (o *Callback) handlersForDone() []func(callbackData uint32) {
728 o.handlersMu.Lock()
729 defer o.handlersMu.Unlock()
730 return o.onDone
731}
732
733// EventSignature returns the declared event argument types in wire order.
734func (o *Callback) EventSignature(opcode uint16) (string, bool) {
735 switch opcode {
736 case 0:
737 return "uint,", true
738 default:
739 return "", false
740 }
741}
742
743// Dispatch decodes one event on wl_callback and calls the registered handlers.
744func (o *Callback) Dispatch(event *wl.Event) {
745 switch event.Opcode {
746 case 0: // done
747 callbackData := event.Uint32()
748
749 for i, handler := range o.handlersForDone() {
750 _ = i
751 handler(callbackData)
752 }
753 o.Context().Unregister(o)
754 default:
755 }
756}
757
758// CompositorInterface is the protocol interface name.
759const CompositorInterface = "wl_compositor"
760
761// Compositor is the generated binding for wl_compositor version 7.
762type Compositor struct {
763 wl.BaseProxy
764}
765
766// NewCompositor returns an unbound Compositor.
767func NewCompositor(ctx *wl.Context) *Compositor {
768 obj := &Compositor{}
769 obj.SetContext(ctx)
770 ctx.Register(obj)
771 return obj
772}
773
774// Ask the compositor to create a new surface.
775func (o *Compositor) CreateSurface() (*Surface, error) {
776 child := &Surface{}
777 child.SetContext(o.Context())
778 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_compositor.create_surface", Child: child}, child); err != nil {
779 return nil, err
780 }
781 return child, nil
782}
783
784// Ask the compositor to create a new region.
785func (o *Compositor) CreateRegion() (*Region, error) {
786 child := &Region{}
787 child.SetContext(o.Context())
788 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_compositor.create_region", Child: child}, child); err != nil {
789 return nil, err
790 }
791 return child, nil
792}
793
794// This request destroys the wl_compositor. This has no effect on any other objects.
795func (o *Compositor) Release() error {
796 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_compositor.release", Since: 7, Destructor: true}); err != nil {
797 return err
798 }
799 return nil
800}
801
802// EventSignature returns the declared event argument types in wire order.
803func (o *Compositor) EventSignature(opcode uint16) (string, bool) {
804 switch opcode {
805 default:
806 return "", false
807 }
808}
809
810// Dispatch decodes one event on wl_compositor and calls the registered handlers.
811func (o *Compositor) Dispatch(event *wl.Event) {
812 switch event.Opcode {
813 default:
814 }
815}
816
817// ShmPoolInterface is the protocol interface name.
818const ShmPoolInterface = "wl_shm_pool"
819
820// ShmPool is the generated binding for wl_shm_pool version 3.
821type ShmPool struct {
822 wl.BaseProxy
823}
824
825// NewShmPool returns an unbound ShmPool.
826func NewShmPool(ctx *wl.Context) *ShmPool {
827 obj := &ShmPool{}
828 obj.SetContext(ctx)
829 ctx.Register(obj)
830 return obj
831}
832
833// Create a wl_buffer object from the pool. The buffer is created offset bytes into the pool and has width and height as specified. The stride argument specifies the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event. A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating a buffer from it.
834func (o *ShmPool) CreateBuffer(offset int32, width int32, height int32, stride int32, format uint32) (*Buffer, error) {
835 child := &Buffer{}
836 child.SetContext(o.Context())
837 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shm_pool.create_buffer", Child: child}, child, offset, width, height, stride, format); err != nil {
838 return nil, err
839 }
840 return child, nil
841}
842
843// Destroy the shared memory pool. The mmapped memory will be released when all buffers that have been created from this pool are gone.
844func (o *ShmPool) Destroy() error {
845 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shm_pool.destroy", Destructor: true}); err != nil {
846 return err
847 }
848 return nil
849}
850
851// This request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger. This request only changes the amount of bytes that are mmapped by the server and does not touch the file corresponding to the file descriptor passed at creation time. It is the client's responsibility to ensure that the file is at least as big as the new pool size.
852func (o *ShmPool) Resize(size int32) error {
853 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_shm_pool.resize"}, size); err != nil {
854 return err
855 }
856 return nil
857}
858
859// EventSignature returns the declared event argument types in wire order.
860func (o *ShmPool) EventSignature(opcode uint16) (string, bool) {
861 switch opcode {
862 default:
863 return "", false
864 }
865}
866
867// Dispatch decodes one event on wl_shm_pool and calls the registered handlers.
868func (o *ShmPool) Dispatch(event *wl.Event) {
869 switch event.Opcode {
870 default:
871 }
872}
873
874// ShmInterface is the protocol interface name.
875const ShmInterface = "wl_shm"
876
877// Shm is the generated binding for wl_shm version 3.
878type Shm struct {
879 wl.BaseProxy
880 // handlersMu guards the handler slices: a client may register or replace
881 // handlers while another goroutine dispatches events.
882 handlersMu sync.Mutex
883 onFormat []func(format uint32)
884}
885
886// NewShm returns an unbound Shm.
887func NewShm(ctx *wl.Context) *Shm {
888 obj := &Shm{}
889 obj.SetContext(ctx)
890 ctx.Register(obj)
891 return obj
892}
893
894// Create a new wl_shm_pool object. The pool can be used to create shared memory based buffer objects. The server will mmap size bytes of the passed file descriptor, to use as backing memory for the pool.
895func (o *Shm) CreatePool(fd int, size int32) (*ShmPool, error) {
896 child := &ShmPool{}
897 child.SetContext(o.Context())
898 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shm.create_pool", Child: child, FDs: []int{fd}}, child, uintptr(fd), size); err != nil {
899 return nil, err
900 }
901 return child, nil
902}
903
904// Using this request a client can tell the server that it is not going to use the shm object anymore. Objects created via this interface remain unaffected.
905func (o *Shm) Release() error {
906 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shm.release", Since: 2, Destructor: true}); err != nil {
907 return err
908 }
909 return nil
910}
911
912// OnFormat registers a handler for the format event.
913//
914// Handlers are appended, so a second call adds another handler rather than
915// replacing the first. Registration is safe while another goroutine dispatches.
916func (o *Shm) OnFormat(handler func(format uint32)) {
917 if handler == nil {
918 return
919 }
920 o.handlersMu.Lock()
921 defer o.handlersMu.Unlock()
922 o.onFormat = append(o.onFormat, handler)
923}
924
925// handlersForFormat returns the handlers registered for format, taken
926// under the lock so a handler may register another handler while events are
927// being dispatched.
928func (o *Shm) handlersForFormat() []func(format uint32) {
929 o.handlersMu.Lock()
930 defer o.handlersMu.Unlock()
931 return o.onFormat
932}
933
934// EventSignature returns the declared event argument types in wire order.
935func (o *Shm) EventSignature(opcode uint16) (string, bool) {
936 switch opcode {
937 case 0:
938 return "uint,", true
939 default:
940 return "", false
941 }
942}
943
944// Dispatch decodes one event on wl_shm and calls the registered handlers.
945func (o *Shm) Dispatch(event *wl.Event) {
946 switch event.Opcode {
947 case 0: // format
948 format := event.Uint32()
949
950 for i, handler := range o.handlersForFormat() {
951 _ = i
952 handler(format)
953 }
954 default:
955 }
956}
957
958// BufferInterface is the protocol interface name.
959const BufferInterface = "wl_buffer"
960
961// Buffer is the generated binding for wl_buffer version 1.
962type Buffer struct {
963 wl.BaseProxy
964 // handlersMu guards the handler slices: a client may register or replace
965 // handlers while another goroutine dispatches events.
966 handlersMu sync.Mutex
967 onRelease []func()
968}
969
970// NewBuffer returns an unbound Buffer.
971func NewBuffer(ctx *wl.Context) *Buffer {
972 obj := &Buffer{}
973 obj.SetContext(ctx)
974 ctx.Register(obj)
975 return obj
976}
977
978// Destroy a buffer. If and how you need to release the backing storage is defined by the buffer factory interface. For possible side-effects to a surface, see wl_surface.attach.
979func (o *Buffer) Destroy() error {
980 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_buffer.destroy", Destructor: true}); err != nil {
981 return err
982 }
983 return nil
984}
985
986// OnRelease registers a handler for the release event.
987//
988// Handlers are appended, so a second call adds another handler rather than
989// replacing the first. Registration is safe while another goroutine dispatches.
990func (o *Buffer) OnRelease(handler func()) {
991 if handler == nil {
992 return
993 }
994 o.handlersMu.Lock()
995 defer o.handlersMu.Unlock()
996 o.onRelease = append(o.onRelease, handler)
997}
998
999// handlersForRelease returns the handlers registered for release, taken
1000// under the lock so a handler may register another handler while events are
1001// being dispatched.
1002func (o *Buffer) handlersForRelease() []func() {
1003 o.handlersMu.Lock()
1004 defer o.handlersMu.Unlock()
1005 return o.onRelease
1006}
1007
1008// EventSignature returns the declared event argument types in wire order.
1009func (o *Buffer) EventSignature(opcode uint16) (string, bool) {
1010 switch opcode {
1011 case 0:
1012 return "", true
1013 default:
1014 return "", false
1015 }
1016}
1017
1018// Dispatch decodes one event on wl_buffer and calls the registered handlers.
1019func (o *Buffer) Dispatch(event *wl.Event) {
1020 switch event.Opcode {
1021 case 0: // release
1022
1023 for i, handler := range o.handlersForRelease() {
1024 _ = i
1025 handler()
1026 }
1027 default:
1028 }
1029}
1030
1031// DataOfferInterface is the protocol interface name.
1032const DataOfferInterface = "wl_data_offer"
1033
1034// DataOffer is the generated binding for wl_data_offer version 4.
1035type DataOffer struct {
1036 wl.BaseProxy
1037 // handlersMu guards the handler slices: a client may register or replace
1038 // handlers while another goroutine dispatches events.
1039 handlersMu sync.Mutex
1040 onOffer []func(mimeType string)
1041 onSourceActions []func(sourceActions uint32)
1042 onAction []func(dndAction uint32)
1043}
1044
1045// NewDataOffer returns an unbound DataOffer.
1046func NewDataOffer(ctx *wl.Context) *DataOffer {
1047 obj := &DataOffer{}
1048 obj.SetContext(ctx)
1049 ctx.Register(obj)
1050 return obj
1051}
1052
1053// Indicate that the client can accept the given mime type, or NULL for not accepted. For objects of version 2 or older, this request is used by the client to give feedback whether the client can receive the given mime type, or NULL if none is accepted; the feedback does not determine whether the drag-and-drop operation succeeds or not. For objects of version 3 or newer, this request determines the final result of the drag-and-drop operation. If the end result is that no mime types were accepted, the drag-and-drop operation will be cancelled and the corresponding drag source will receive wl_data_source.cancelled. Clients may still use this event in conjunction with wl_data_source.action for feedback.
1054func (o *DataOffer) Accept(serial uint32, mimeType string) error {
1055 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_offer.accept"}, serial, mimeType); err != nil {
1056 return err
1057 }
1058 return nil
1059}
1060
1061// To transfer the offered data, the client issues this request and indicates the mime type it wants to receive. The transfer happens through the passed file descriptor (typically created with the pipe system call). The source client writes the data in the mime type representation requested and then closes the file descriptor. The receiving client reads from the read end of the pipe until EOF and then closes its end, at which point the transfer is complete. This request may happen multiple times for different mime types, both before and after wl_data_device.drop. Drag-and-drop destination clients may preemptively fetch data or examine it more closely to determine acceptance.
1062func (o *DataOffer) Receive(mimeType string, fd int) error {
1063 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_offer.receive", FDs: []int{fd}}, mimeType, uintptr(fd)); err != nil {
1064 return err
1065 }
1066 return nil
1067}
1068
1069// Destroy the data offer.
1070func (o *DataOffer) Destroy() error {
1071 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_offer.destroy", Destructor: true}); err != nil {
1072 return err
1073 }
1074 return nil
1075}
1076
1077// Notifies the compositor that the drag destination successfully finished the drag-and-drop operation. Upon receiving this request, the compositor will emit wl_data_source.dnd_finished on the drag source client. It is a client error to perform other requests than wl_data_offer.destroy after this one. It is also an error to perform this request after a NULL mime type has been set in wl_data_offer.accept or no action was received through wl_data_offer.action. If wl_data_offer.finish request is received for a non drag and drop operation, the invalid_finish protocol error is raised.
1078func (o *DataOffer) Finish() error {
1079 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_data_offer.finish", Since: 3}); err != nil {
1080 return err
1081 }
1082 return nil
1083}
1084
1085// Sets the actions that the destination side client supports for this operation. This request may trigger the emission of wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. This request can be called multiple times throughout the drag-and-drop operation, typically in response to wl_data_device.enter or wl_data_device.motion events. This request determines the final result of the drag-and-drop operation. If the end result is that no action is accepted, the drag source will receive wl_data_source.cancelled. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, and the preferred_action argument must only contain one of those values set, otherwise it will result in a protocol error. While managing an "ask" action, the destination drag-and-drop client may perform further wl_data_offer.receive requests, and is expected to perform one last wl_data_offer.set_actions request with a preferred action other than "ask" (and optionally wl_data_offer.accept) before requesting wl_data_offer.finish, in order to convey the action selected by the user. If the preferred action is not in the wl_data_offer.source_actions mask, an error will be raised. If the "ask" action is dismissed (e.g. user cancellation), the client is expected to perform wl_data_offer.destroy right away. This request can only be made on drag-and-drop offers, a protocol error will be raised otherwise.
1086func (o *DataOffer) SetActions(dndActions uint32, preferredAction uint32) error {
1087 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_data_offer.set_actions", Since: 3}, dndActions, preferredAction); err != nil {
1088 return err
1089 }
1090 return nil
1091}
1092
1093// OnOffer registers a handler for the offer event.
1094//
1095// Handlers are appended, so a second call adds another handler rather than
1096// replacing the first. Registration is safe while another goroutine dispatches.
1097func (o *DataOffer) OnOffer(handler func(mimeType string)) {
1098 if handler == nil {
1099 return
1100 }
1101 o.handlersMu.Lock()
1102 defer o.handlersMu.Unlock()
1103 o.onOffer = append(o.onOffer, handler)
1104}
1105
1106// handlersForOffer returns the handlers registered for offer, taken
1107// under the lock so a handler may register another handler while events are
1108// being dispatched.
1109func (o *DataOffer) handlersForOffer() []func(mimeType string) {
1110 o.handlersMu.Lock()
1111 defer o.handlersMu.Unlock()
1112 return o.onOffer
1113}
1114
1115// OnSourceActions registers a handler for the source_actions event.
1116//
1117// Handlers are appended, so a second call adds another handler rather than
1118// replacing the first. Registration is safe while another goroutine dispatches.
1119func (o *DataOffer) OnSourceActions(handler func(sourceActions uint32)) {
1120 if handler == nil {
1121 return
1122 }
1123 o.handlersMu.Lock()
1124 defer o.handlersMu.Unlock()
1125 o.onSourceActions = append(o.onSourceActions, handler)
1126}
1127
1128// handlersForSourceActions returns the handlers registered for source_actions, taken
1129// under the lock so a handler may register another handler while events are
1130// being dispatched.
1131func (o *DataOffer) handlersForSourceActions() []func(sourceActions uint32) {
1132 o.handlersMu.Lock()
1133 defer o.handlersMu.Unlock()
1134 return o.onSourceActions
1135}
1136
1137// OnAction registers a handler for the action event.
1138//
1139// Handlers are appended, so a second call adds another handler rather than
1140// replacing the first. Registration is safe while another goroutine dispatches.
1141func (o *DataOffer) OnAction(handler func(dndAction uint32)) {
1142 if handler == nil {
1143 return
1144 }
1145 o.handlersMu.Lock()
1146 defer o.handlersMu.Unlock()
1147 o.onAction = append(o.onAction, handler)
1148}
1149
1150// handlersForAction returns the handlers registered for action, taken
1151// under the lock so a handler may register another handler while events are
1152// being dispatched.
1153func (o *DataOffer) handlersForAction() []func(dndAction uint32) {
1154 o.handlersMu.Lock()
1155 defer o.handlersMu.Unlock()
1156 return o.onAction
1157}
1158
1159// EventSignature returns the declared event argument types in wire order.
1160func (o *DataOffer) EventSignature(opcode uint16) (string, bool) {
1161 switch opcode {
1162 case 0:
1163 return "string,", true
1164 case 1:
1165 return "uint,", true
1166 case 2:
1167 return "uint,", true
1168 default:
1169 return "", false
1170 }
1171}
1172
1173// Dispatch decodes one event on wl_data_offer and calls the registered handlers.
1174func (o *DataOffer) Dispatch(event *wl.Event) {
1175 switch event.Opcode {
1176 case 0: // offer
1177 mimeType := event.String()
1178
1179 for i, handler := range o.handlersForOffer() {
1180 _ = i
1181 handler(mimeType)
1182 }
1183 case 1: // source_actions
1184 sourceActions := event.Uint32()
1185
1186 for i, handler := range o.handlersForSourceActions() {
1187 _ = i
1188 handler(sourceActions)
1189 }
1190 case 2: // action
1191 dndAction := event.Uint32()
1192
1193 for i, handler := range o.handlersForAction() {
1194 _ = i
1195 handler(dndAction)
1196 }
1197 default:
1198 }
1199}
1200
1201// DataSourceInterface is the protocol interface name.
1202const DataSourceInterface = "wl_data_source"
1203
1204// DataSource is the generated binding for wl_data_source version 4.
1205type DataSource struct {
1206 wl.BaseProxy
1207 // handlersMu guards the handler slices: a client may register or replace
1208 // handlers while another goroutine dispatches events.
1209 handlersMu sync.Mutex
1210 onTarget []func(mimeType string)
1211 onSend []func(mimeType string, fd *wl.OwnedFD)
1212 onCancelled []func()
1213 onDndDropPerformed []func()
1214 onDndFinished []func()
1215 onAction []func(dndAction uint32)
1216}
1217
1218// NewDataSource returns an unbound DataSource.
1219func NewDataSource(ctx *wl.Context) *DataSource {
1220 obj := &DataSource{}
1221 obj.SetContext(ctx)
1222 ctx.Register(obj)
1223 return obj
1224}
1225
1226// This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types.
1227func (o *DataSource) Offer(mimeType string) error {
1228 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_source.offer"}, mimeType); err != nil {
1229 return err
1230 }
1231 return nil
1232}
1233
1234// Destroy the data source.
1235func (o *DataSource) Destroy() error {
1236 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_source.destroy", Destructor: true}); err != nil {
1237 return err
1238 }
1239 return nil
1240}
1241
1242// Sets the actions that the source side client supports for this operation. This request may trigger wl_data_source.action and wl_data_offer.action events if the compositor needs to change the selected action. The dnd_actions argument must contain only values expressed in the wl_data_device_manager.dnd_actions enum, otherwise it will result in a protocol error. This request must be made once only, and can only be made on sources used in drag-and-drop, so it must be performed before wl_data_device.start_drag. Attempting to use the source other than for drag-and-drop will raise a protocol error.
1243func (o *DataSource) SetActions(dndActions uint32) error {
1244 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_source.set_actions", Since: 3}, dndActions); err != nil {
1245 return err
1246 }
1247 return nil
1248}
1249
1250// OnTarget registers a handler for the target event.
1251//
1252// Handlers are appended, so a second call adds another handler rather than
1253// replacing the first. Registration is safe while another goroutine dispatches.
1254func (o *DataSource) OnTarget(handler func(mimeType string)) {
1255 if handler == nil {
1256 return
1257 }
1258 o.handlersMu.Lock()
1259 defer o.handlersMu.Unlock()
1260 o.onTarget = append(o.onTarget, handler)
1261}
1262
1263// handlersForTarget returns the handlers registered for target, taken
1264// under the lock so a handler may register another handler while events are
1265// being dispatched.
1266func (o *DataSource) handlersForTarget() []func(mimeType string) {
1267 o.handlersMu.Lock()
1268 defer o.handlersMu.Unlock()
1269 return o.onTarget
1270}
1271
1272// OnSend registers a handler for the send event.
1273//
1274// Handlers are appended, so a second call adds another handler rather than
1275// replacing the first. Registration is safe while another goroutine dispatches.
1276func (o *DataSource) OnSend(handler func(mimeType string, fd *wl.OwnedFD)) {
1277 if handler == nil {
1278 return
1279 }
1280 o.handlersMu.Lock()
1281 defer o.handlersMu.Unlock()
1282 o.onSend = append(o.onSend, handler)
1283}
1284
1285// handlersForSend returns the handlers registered for send, taken
1286// under the lock so a handler may register another handler while events are
1287// being dispatched.
1288func (o *DataSource) handlersForSend() []func(mimeType string, fd *wl.OwnedFD) {
1289 o.handlersMu.Lock()
1290 defer o.handlersMu.Unlock()
1291 return o.onSend
1292}
1293
1294// OnCancelled registers a handler for the cancelled event.
1295//
1296// Handlers are appended, so a second call adds another handler rather than
1297// replacing the first. Registration is safe while another goroutine dispatches.
1298func (o *DataSource) OnCancelled(handler func()) {
1299 if handler == nil {
1300 return
1301 }
1302 o.handlersMu.Lock()
1303 defer o.handlersMu.Unlock()
1304 o.onCancelled = append(o.onCancelled, handler)
1305}
1306
1307// handlersForCancelled returns the handlers registered for cancelled, taken
1308// under the lock so a handler may register another handler while events are
1309// being dispatched.
1310func (o *DataSource) handlersForCancelled() []func() {
1311 o.handlersMu.Lock()
1312 defer o.handlersMu.Unlock()
1313 return o.onCancelled
1314}
1315
1316// OnDndDropPerformed registers a handler for the dnd_drop_performed event.
1317//
1318// Handlers are appended, so a second call adds another handler rather than
1319// replacing the first. Registration is safe while another goroutine dispatches.
1320func (o *DataSource) OnDndDropPerformed(handler func()) {
1321 if handler == nil {
1322 return
1323 }
1324 o.handlersMu.Lock()
1325 defer o.handlersMu.Unlock()
1326 o.onDndDropPerformed = append(o.onDndDropPerformed, handler)
1327}
1328
1329// handlersForDndDropPerformed returns the handlers registered for dnd_drop_performed, taken
1330// under the lock so a handler may register another handler while events are
1331// being dispatched.
1332func (o *DataSource) handlersForDndDropPerformed() []func() {
1333 o.handlersMu.Lock()
1334 defer o.handlersMu.Unlock()
1335 return o.onDndDropPerformed
1336}
1337
1338// OnDndFinished registers a handler for the dnd_finished event.
1339//
1340// Handlers are appended, so a second call adds another handler rather than
1341// replacing the first. Registration is safe while another goroutine dispatches.
1342func (o *DataSource) OnDndFinished(handler func()) {
1343 if handler == nil {
1344 return
1345 }
1346 o.handlersMu.Lock()
1347 defer o.handlersMu.Unlock()
1348 o.onDndFinished = append(o.onDndFinished, handler)
1349}
1350
1351// handlersForDndFinished returns the handlers registered for dnd_finished, taken
1352// under the lock so a handler may register another handler while events are
1353// being dispatched.
1354func (o *DataSource) handlersForDndFinished() []func() {
1355 o.handlersMu.Lock()
1356 defer o.handlersMu.Unlock()
1357 return o.onDndFinished
1358}
1359
1360// OnAction registers a handler for the action event.
1361//
1362// Handlers are appended, so a second call adds another handler rather than
1363// replacing the first. Registration is safe while another goroutine dispatches.
1364func (o *DataSource) OnAction(handler func(dndAction uint32)) {
1365 if handler == nil {
1366 return
1367 }
1368 o.handlersMu.Lock()
1369 defer o.handlersMu.Unlock()
1370 o.onAction = append(o.onAction, handler)
1371}
1372
1373// handlersForAction returns the handlers registered for action, taken
1374// under the lock so a handler may register another handler while events are
1375// being dispatched.
1376func (o *DataSource) handlersForAction() []func(dndAction uint32) {
1377 o.handlersMu.Lock()
1378 defer o.handlersMu.Unlock()
1379 return o.onAction
1380}
1381
1382// EventSignature returns the declared event argument types in wire order.
1383func (o *DataSource) EventSignature(opcode uint16) (string, bool) {
1384 switch opcode {
1385 case 0:
1386 return "string,", true
1387 case 1:
1388 return "string,fd,", true
1389 case 2:
1390 return "", true
1391 case 3:
1392 return "", true
1393 case 4:
1394 return "", true
1395 case 5:
1396 return "uint,", true
1397 default:
1398 return "", false
1399 }
1400}
1401
1402// Dispatch decodes one event on wl_data_source and calls the registered handlers.
1403func (o *DataSource) Dispatch(event *wl.Event) {
1404 switch event.Opcode {
1405 case 0: // target
1406 mimeType := event.String()
1407
1408 for i, handler := range o.handlersForTarget() {
1409 _ = i
1410 handler(mimeType)
1411 }
1412 case 1: // send
1413 mimeType := event.String()
1414 fd := event.FD()
1415 ownedfd := fd
1416 defer ownedfd.Close()
1417
1418 for i, handler := range o.handlersForSend() {
1419 if i > 0 {
1420 fd = nil
1421 }
1422 handler(mimeType, fd)
1423 }
1424 case 2: // cancelled
1425
1426 for i, handler := range o.handlersForCancelled() {
1427 _ = i
1428 handler()
1429 }
1430 case 3: // dnd_drop_performed
1431
1432 for i, handler := range o.handlersForDndDropPerformed() {
1433 _ = i
1434 handler()
1435 }
1436 case 4: // dnd_finished
1437
1438 for i, handler := range o.handlersForDndFinished() {
1439 _ = i
1440 handler()
1441 }
1442 case 5: // action
1443 dndAction := event.Uint32()
1444
1445 for i, handler := range o.handlersForAction() {
1446 _ = i
1447 handler(dndAction)
1448 }
1449 default:
1450 }
1451}
1452
1453// DataDeviceInterface is the protocol interface name.
1454const DataDeviceInterface = "wl_data_device"
1455
1456// DataDevice is the generated binding for wl_data_device version 4.
1457type DataDevice struct {
1458 wl.BaseProxy
1459 // handlersMu guards the handler slices: a client may register or replace
1460 // handlers while another goroutine dispatches events.
1461 handlersMu sync.Mutex
1462 onDataOffer []func(idObject *DataOffer)
1463 onEnter []func(serial uint32, surfaceID uint32, x wl.Fixed, y wl.Fixed, idID uint32)
1464 onLeave []func()
1465 onMotion []func(time uint32, x wl.Fixed, y wl.Fixed)
1466 onDrop []func()
1467 onSelection []func(idID uint32)
1468}
1469
1470// NewDataDevice returns an unbound DataDevice.
1471func NewDataDevice(ctx *wl.Context) *DataDevice {
1472 obj := &DataDevice{}
1473 obj.SetContext(ctx)
1474 ctx.Register(obj)
1475 return obj
1476}
1477
1478// This request asks the compositor to start a drag-and-drop operation on behalf of the client. The source argument is the data source that provides the data for the eventual data transfer. If source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally. If source is destroyed, the drag-and-drop session will be cancelled. The origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial. The icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.offset requests can move the relative position. Attach requests must be confirmed with wl_surface.commit as usual. The icon surface is given the role of a drag-and-drop icon. If the icon surface already has another role, it raises a protocol error. The input region is ignored for wl_surfaces with the role of a drag-and-drop icon. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error.
1479func (o *DataDevice) StartDrag(source *DataSource, origin *Surface, icon *Surface, serial uint32) error {
1480 var arg0 wl.Object
1481 if source != nil {
1482 arg0 = source
1483 }
1484 var arg1 wl.Object
1485 if origin != nil {
1486 arg1 = origin
1487 }
1488 var arg2 wl.Object
1489 if icon != nil {
1490 arg2 = icon
1491 }
1492 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_device.start_drag"}, arg0, arg1, arg2, serial); err != nil {
1493 return err
1494 }
1495 return nil
1496}
1497
1498// This request asks the compositor to set the selection to the data from the source on behalf of the client. To unset the selection, set the source to NULL. The given source may not be used in any further set_selection or start_drag requests. Attempting to reuse a previously-used source may send a used_source error.
1499func (o *DataDevice) SetSelection(source *DataSource, serial uint32) error {
1500 var arg0 wl.Object
1501 if source != nil {
1502 arg0 = source
1503 }
1504 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_device.set_selection"}, arg0, serial); err != nil {
1505 return err
1506 }
1507 return nil
1508}
1509
1510// This request destroys the data device.
1511func (o *DataDevice) Release() error {
1512 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_device.release", Since: 2, Destructor: true}); err != nil {
1513 return err
1514 }
1515 return nil
1516}
1517
1518// OnDataOffer registers a handler for the data_offer event.
1519//
1520// Handlers are appended, so a second call adds another handler rather than
1521// replacing the first. Registration is safe while another goroutine dispatches.
1522func (o *DataDevice) OnDataOffer(handler func(idObject *DataOffer)) {
1523 if handler == nil {
1524 return
1525 }
1526 o.handlersMu.Lock()
1527 defer o.handlersMu.Unlock()
1528 o.onDataOffer = append(o.onDataOffer, handler)
1529}
1530
1531// handlersForDataOffer returns the handlers registered for data_offer, taken
1532// under the lock so a handler may register another handler while events are
1533// being dispatched.
1534func (o *DataDevice) handlersForDataOffer() []func(idObject *DataOffer) {
1535 o.handlersMu.Lock()
1536 defer o.handlersMu.Unlock()
1537 return o.onDataOffer
1538}
1539
1540// OnEnter registers a handler for the enter event.
1541//
1542// Handlers are appended, so a second call adds another handler rather than
1543// replacing the first. Registration is safe while another goroutine dispatches.
1544func (o *DataDevice) OnEnter(handler func(serial uint32, surfaceID uint32, x wl.Fixed, y wl.Fixed, idID uint32)) {
1545 if handler == nil {
1546 return
1547 }
1548 o.handlersMu.Lock()
1549 defer o.handlersMu.Unlock()
1550 o.onEnter = append(o.onEnter, handler)
1551}
1552
1553// handlersForEnter returns the handlers registered for enter, taken
1554// under the lock so a handler may register another handler while events are
1555// being dispatched.
1556func (o *DataDevice) handlersForEnter() []func(serial uint32, surfaceID uint32, x wl.Fixed, y wl.Fixed, idID uint32) {
1557 o.handlersMu.Lock()
1558 defer o.handlersMu.Unlock()
1559 return o.onEnter
1560}
1561
1562// OnLeave registers a handler for the leave event.
1563//
1564// Handlers are appended, so a second call adds another handler rather than
1565// replacing the first. Registration is safe while another goroutine dispatches.
1566func (o *DataDevice) OnLeave(handler func()) {
1567 if handler == nil {
1568 return
1569 }
1570 o.handlersMu.Lock()
1571 defer o.handlersMu.Unlock()
1572 o.onLeave = append(o.onLeave, handler)
1573}
1574
1575// handlersForLeave returns the handlers registered for leave, taken
1576// under the lock so a handler may register another handler while events are
1577// being dispatched.
1578func (o *DataDevice) handlersForLeave() []func() {
1579 o.handlersMu.Lock()
1580 defer o.handlersMu.Unlock()
1581 return o.onLeave
1582}
1583
1584// OnMotion registers a handler for the motion event.
1585//
1586// Handlers are appended, so a second call adds another handler rather than
1587// replacing the first. Registration is safe while another goroutine dispatches.
1588func (o *DataDevice) OnMotion(handler func(time uint32, x wl.Fixed, y wl.Fixed)) {
1589 if handler == nil {
1590 return
1591 }
1592 o.handlersMu.Lock()
1593 defer o.handlersMu.Unlock()
1594 o.onMotion = append(o.onMotion, handler)
1595}
1596
1597// handlersForMotion returns the handlers registered for motion, taken
1598// under the lock so a handler may register another handler while events are
1599// being dispatched.
1600func (o *DataDevice) handlersForMotion() []func(time uint32, x wl.Fixed, y wl.Fixed) {
1601 o.handlersMu.Lock()
1602 defer o.handlersMu.Unlock()
1603 return o.onMotion
1604}
1605
1606// OnDrop registers a handler for the drop event.
1607//
1608// Handlers are appended, so a second call adds another handler rather than
1609// replacing the first. Registration is safe while another goroutine dispatches.
1610func (o *DataDevice) OnDrop(handler func()) {
1611 if handler == nil {
1612 return
1613 }
1614 o.handlersMu.Lock()
1615 defer o.handlersMu.Unlock()
1616 o.onDrop = append(o.onDrop, handler)
1617}
1618
1619// handlersForDrop returns the handlers registered for drop, taken
1620// under the lock so a handler may register another handler while events are
1621// being dispatched.
1622func (o *DataDevice) handlersForDrop() []func() {
1623 o.handlersMu.Lock()
1624 defer o.handlersMu.Unlock()
1625 return o.onDrop
1626}
1627
1628// OnSelection registers a handler for the selection event.
1629//
1630// Handlers are appended, so a second call adds another handler rather than
1631// replacing the first. Registration is safe while another goroutine dispatches.
1632func (o *DataDevice) OnSelection(handler func(idID uint32)) {
1633 if handler == nil {
1634 return
1635 }
1636 o.handlersMu.Lock()
1637 defer o.handlersMu.Unlock()
1638 o.onSelection = append(o.onSelection, handler)
1639}
1640
1641// handlersForSelection returns the handlers registered for selection, taken
1642// under the lock so a handler may register another handler while events are
1643// being dispatched.
1644func (o *DataDevice) handlersForSelection() []func(idID uint32) {
1645 o.handlersMu.Lock()
1646 defer o.handlersMu.Unlock()
1647 return o.onSelection
1648}
1649
1650// EventSignature returns the declared event argument types in wire order.
1651func (o *DataDevice) EventSignature(opcode uint16) (string, bool) {
1652 switch opcode {
1653 case 0:
1654 return "new_id,", true
1655 case 1:
1656 return "uint,object,fixed,fixed,object,", true
1657 case 2:
1658 return "", true
1659 case 3:
1660 return "uint,fixed,fixed,", true
1661 case 4:
1662 return "", true
1663 case 5:
1664 return "object,", true
1665 default:
1666 return "", false
1667 }
1668}
1669
1670// Dispatch decodes one event on wl_data_device and calls the registered handlers.
1671func (o *DataDevice) Dispatch(event *wl.Event) {
1672 switch event.Opcode {
1673 case 0: // data_offer
1674 idID := event.Uint32()
1675 idObject := &DataOffer{}
1676 idObject.SetContext(o.Context())
1677 idObject.SetID(idID)
1678 idObject.SetVersion(o.Version())
1679 o.Context().Register(idObject)
1680
1681 for i, handler := range o.handlersForDataOffer() {
1682 _ = i
1683 handler(idObject)
1684 }
1685 case 1: // enter
1686 serial := event.Uint32()
1687 surfaceID := event.Uint32()
1688 x := event.Fixed()
1689 y := event.Fixed()
1690 idID := event.Uint32()
1691
1692 for i, handler := range o.handlersForEnter() {
1693 _ = i
1694 handler(serial, surfaceID, x, y, idID)
1695 }
1696 case 2: // leave
1697
1698 for i, handler := range o.handlersForLeave() {
1699 _ = i
1700 handler()
1701 }
1702 case 3: // motion
1703 time := event.Uint32()
1704 x := event.Fixed()
1705 y := event.Fixed()
1706
1707 for i, handler := range o.handlersForMotion() {
1708 _ = i
1709 handler(time, x, y)
1710 }
1711 case 4: // drop
1712
1713 for i, handler := range o.handlersForDrop() {
1714 _ = i
1715 handler()
1716 }
1717 case 5: // selection
1718 idID := event.Uint32()
1719
1720 for i, handler := range o.handlersForSelection() {
1721 _ = i
1722 handler(idID)
1723 }
1724 default:
1725 }
1726}
1727
1728// DataDeviceManagerInterface is the protocol interface name.
1729const DataDeviceManagerInterface = "wl_data_device_manager"
1730
1731// DataDeviceManager is the generated binding for wl_data_device_manager version 4.
1732type DataDeviceManager struct {
1733 wl.BaseProxy
1734}
1735
1736// NewDataDeviceManager returns an unbound DataDeviceManager.
1737func NewDataDeviceManager(ctx *wl.Context) *DataDeviceManager {
1738 obj := &DataDeviceManager{}
1739 obj.SetContext(ctx)
1740 ctx.Register(obj)
1741 return obj
1742}
1743
1744// Create a new data source.
1745func (o *DataDeviceManager) CreateDataSource() (*DataSource, error) {
1746 child := &DataSource{}
1747 child.SetContext(o.Context())
1748 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_data_device_manager.create_data_source", Child: child}, child); err != nil {
1749 return nil, err
1750 }
1751 return child, nil
1752}
1753
1754// Create a new data device for a given seat.
1755func (o *DataDeviceManager) GetDataDevice(seat *Seat) (*DataDevice, error) {
1756 var arg1 wl.Object
1757 if seat != nil {
1758 arg1 = seat
1759 }
1760 child := &DataDevice{}
1761 child.SetContext(o.Context())
1762 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_data_device_manager.get_data_device", Child: child}, child, arg1); err != nil {
1763 return nil, err
1764 }
1765 return child, nil
1766}
1767
1768// This request destroys the wl_data_device_manager. This has no effect on any other objects.
1769func (o *DataDeviceManager) Release() error {
1770 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_data_device_manager.release", Since: 4, Destructor: true}); err != nil {
1771 return err
1772 }
1773 return nil
1774}
1775
1776// EventSignature returns the declared event argument types in wire order.
1777func (o *DataDeviceManager) EventSignature(opcode uint16) (string, bool) {
1778 switch opcode {
1779 default:
1780 return "", false
1781 }
1782}
1783
1784// Dispatch decodes one event on wl_data_device_manager and calls the registered handlers.
1785func (o *DataDeviceManager) Dispatch(event *wl.Event) {
1786 switch event.Opcode {
1787 default:
1788 }
1789}
1790
1791// ShellInterface is the protocol interface name.
1792const ShellInterface = "wl_shell"
1793
1794// Shell is the generated binding for wl_shell version 1.
1795type Shell struct {
1796 wl.BaseProxy
1797}
1798
1799// NewShell returns an unbound Shell.
1800func NewShell(ctx *wl.Context) *Shell {
1801 obj := &Shell{}
1802 obj.SetContext(ctx)
1803 ctx.Register(obj)
1804 return obj
1805}
1806
1807// Create a shell surface for an existing surface. This gives the wl_surface the role of a shell surface. If the wl_surface already has another role, it raises a protocol error. Only one shell surface can be associated with a given surface.
1808func (o *Shell) GetShellSurface(surface *Surface) (*ShellSurface, error) {
1809 var arg1 wl.Object
1810 if surface != nil {
1811 arg1 = surface
1812 }
1813 child := &ShellSurface{}
1814 child.SetContext(o.Context())
1815 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shell.get_shell_surface", Child: child}, child, arg1); err != nil {
1816 return nil, err
1817 }
1818 return child, nil
1819}
1820
1821// EventSignature returns the declared event argument types in wire order.
1822func (o *Shell) EventSignature(opcode uint16) (string, bool) {
1823 switch opcode {
1824 default:
1825 return "", false
1826 }
1827}
1828
1829// Dispatch decodes one event on wl_shell and calls the registered handlers.
1830func (o *Shell) Dispatch(event *wl.Event) {
1831 switch event.Opcode {
1832 default:
1833 }
1834}
1835
1836// ShellSurfaceInterface is the protocol interface name.
1837const ShellSurfaceInterface = "wl_shell_surface"
1838
1839// ShellSurface is the generated binding for wl_shell_surface version 1.
1840type ShellSurface struct {
1841 wl.BaseProxy
1842 // handlersMu guards the handler slices: a client may register or replace
1843 // handlers while another goroutine dispatches events.
1844 handlersMu sync.Mutex
1845 onPing []func(serial uint32)
1846 onConfigure []func(edges uint32, width int32, height int32)
1847 onPopupDone []func()
1848}
1849
1850// NewShellSurface returns an unbound ShellSurface.
1851func NewShellSurface(ctx *wl.Context) *ShellSurface {
1852 obj := &ShellSurface{}
1853 obj.SetContext(ctx)
1854 ctx.Register(obj)
1855 return obj
1856}
1857
1858// A client must respond to a ping event with a pong request or the client may be deemed unresponsive.
1859func (o *ShellSurface) Pong(serial uint32) error {
1860 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_shell_surface.pong"}, serial); err != nil {
1861 return err
1862 }
1863 return nil
1864}
1865
1866// Start a pointer-driven move of the surface. This request must be used in response to a button press event. The server may ignore move requests depending on the state of the surface (e.g. fullscreen or maximized).
1867func (o *ShellSurface) Move(seat *Seat, serial uint32) error {
1868 var arg0 wl.Object
1869 if seat != nil {
1870 arg0 = seat
1871 }
1872 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_shell_surface.move"}, arg0, serial); err != nil {
1873 return err
1874 }
1875 return nil
1876}
1877
1878// Start a pointer-driven resizing of the surface. This request must be used in response to a button press event. The server may ignore resize requests depending on the state of the surface (e.g. fullscreen or maximized).
1879func (o *ShellSurface) Resize(seat *Seat, serial uint32, edges uint32) error {
1880 var arg0 wl.Object
1881 if seat != nil {
1882 arg0 = seat
1883 }
1884 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_shell_surface.resize"}, arg0, serial, edges); err != nil {
1885 return err
1886 }
1887 return nil
1888}
1889
1890// Map the surface as a toplevel surface. A toplevel surface is not fullscreen, maximized or transient.
1891func (o *ShellSurface) SetToplevel() error {
1892 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_shell_surface.set_toplevel"}); err != nil {
1893 return err
1894 }
1895 return nil
1896}
1897
1898// Map the surface relative to an existing surface. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates. The flags argument controls details of the transient behaviour.
1899func (o *ShellSurface) SetTransient(parent *Surface, x int32, y int32, flags uint32) error {
1900 var arg0 wl.Object
1901 if parent != nil {
1902 arg0 = parent
1903 }
1904 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_shell_surface.set_transient"}, arg0, x, y, flags); err != nil {
1905 return err
1906 }
1907 return nil
1908}
1909
1910// Map the surface as a fullscreen surface. If an output parameter is given then the surface will be made fullscreen on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The client may specify a method to resolve a size conflict between the output size and the surface size - this is provided through the method parameter. The framerate parameter is used only when the method is set to "driver", to indicate the preferred framerate. A value of 0 indicates that the client does not care about framerate. The framerate is specified in mHz, that is framerate of 60000 is 60Hz. A method of "scale" or "driver" implies a scaling operation of the surface, either via a direct scaling operation or a change of the output mode. This will override any kind of output scaling, so that mapping a surface with a buffer size equal to the mode can fill the screen independent of buffer_scale. A method of "fill" means we don't scale up the buffer, however any output scale is applied. This means that you may run into an edge case where the application maps a buffer with the same size of the output mode but buffer_scale 1 (thus making a surface larger than the output). In this case it is allowed to downscale the results to fit the screen. The compositor must reply to this request with a configure event with the dimensions for the output on which the surface will be made fullscreen.
1911func (o *ShellSurface) SetFullscreen(method uint32, framerate uint32, output *Output) error {
1912 var arg2 wl.Object
1913 if output != nil {
1914 arg2 = output
1915 }
1916 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_shell_surface.set_fullscreen"}, method, framerate, arg2); err != nil {
1917 return err
1918 }
1919 return nil
1920}
1921
1922// Map the surface as a popup. A popup surface is a transient surface with an added pointer grab. An existing implicit grab will be changed to owner-events mode, and the popup grab will continue after the implicit grab ends (i.e. releasing the mouse button does not cause the popup to be unmapped). The popup grab continues until the window is destroyed or a mouse button is pressed in any other client's window. A click in any of the client's surfaces is reported as normal, however, clicks in other clients' surfaces will be discarded and trigger the callback. The x and y arguments specify the location of the upper left corner of the surface relative to the upper left corner of the parent surface, in surface-local coordinates.
1923func (o *ShellSurface) SetPopup(seat *Seat, serial uint32, parent *Surface, x int32, y int32, flags uint32) error {
1924 var arg0 wl.Object
1925 if seat != nil {
1926 arg0 = seat
1927 }
1928 var arg2 wl.Object
1929 if parent != nil {
1930 arg2 = parent
1931 }
1932 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "wl_shell_surface.set_popup"}, arg0, serial, arg2, x, y, flags); err != nil {
1933 return err
1934 }
1935 return nil
1936}
1937
1938// Map the surface as a maximized surface. If an output parameter is given then the surface will be maximized on that output. If the client does not specify the output then the compositor will apply its policy - usually choosing the output on which the surface has the biggest surface area. The compositor will reply with a configure event telling the expected new surface size. The operation is completed on the next buffer attach to this surface. A maximized surface typically fills the entire output it is bound to, except for desktop elements such as panels. This is the main difference between a maximized shell surface and a fullscreen shell surface. The details depend on the compositor implementation.
1939func (o *ShellSurface) SetMaximized(output *Output) error {
1940 var arg0 wl.Object
1941 if output != nil {
1942 arg0 = output
1943 }
1944 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "wl_shell_surface.set_maximized"}, arg0); err != nil {
1945 return err
1946 }
1947 return nil
1948}
1949
1950// Set a short title for the surface. This string may be used to identify the surface in a task bar, window list, or other user interface elements provided by the compositor. The string must be encoded in UTF-8.
1951func (o *ShellSurface) SetTitle(title string) error {
1952 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "wl_shell_surface.set_title"}, title); err != nil {
1953 return err
1954 }
1955 return nil
1956}
1957
1958// Set a class for the surface. The surface class identifies the general class of applications to which the surface belongs. A common convention is to use the file name (or the full path if it is a non-standard location) of the application's .desktop file as the class.
1959func (o *ShellSurface) SetClass(class string) error {
1960 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "wl_shell_surface.set_class"}, class); err != nil {
1961 return err
1962 }
1963 return nil
1964}
1965
1966// OnPing registers a handler for the ping event.
1967//
1968// Handlers are appended, so a second call adds another handler rather than
1969// replacing the first. Registration is safe while another goroutine dispatches.
1970func (o *ShellSurface) OnPing(handler func(serial uint32)) {
1971 if handler == nil {
1972 return
1973 }
1974 o.handlersMu.Lock()
1975 defer o.handlersMu.Unlock()
1976 o.onPing = append(o.onPing, handler)
1977}
1978
1979// handlersForPing returns the handlers registered for ping, taken
1980// under the lock so a handler may register another handler while events are
1981// being dispatched.
1982func (o *ShellSurface) handlersForPing() []func(serial uint32) {
1983 o.handlersMu.Lock()
1984 defer o.handlersMu.Unlock()
1985 return o.onPing
1986}
1987
1988// OnConfigure registers a handler for the configure event.
1989//
1990// Handlers are appended, so a second call adds another handler rather than
1991// replacing the first. Registration is safe while another goroutine dispatches.
1992func (o *ShellSurface) OnConfigure(handler func(edges uint32, width int32, height int32)) {
1993 if handler == nil {
1994 return
1995 }
1996 o.handlersMu.Lock()
1997 defer o.handlersMu.Unlock()
1998 o.onConfigure = append(o.onConfigure, handler)
1999}
2000
2001// handlersForConfigure returns the handlers registered for configure, taken
2002// under the lock so a handler may register another handler while events are
2003// being dispatched.
2004func (o *ShellSurface) handlersForConfigure() []func(edges uint32, width int32, height int32) {
2005 o.handlersMu.Lock()
2006 defer o.handlersMu.Unlock()
2007 return o.onConfigure
2008}
2009
2010// OnPopupDone registers a handler for the popup_done event.
2011//
2012// Handlers are appended, so a second call adds another handler rather than
2013// replacing the first. Registration is safe while another goroutine dispatches.
2014func (o *ShellSurface) OnPopupDone(handler func()) {
2015 if handler == nil {
2016 return
2017 }
2018 o.handlersMu.Lock()
2019 defer o.handlersMu.Unlock()
2020 o.onPopupDone = append(o.onPopupDone, handler)
2021}
2022
2023// handlersForPopupDone returns the handlers registered for popup_done, taken
2024// under the lock so a handler may register another handler while events are
2025// being dispatched.
2026func (o *ShellSurface) handlersForPopupDone() []func() {
2027 o.handlersMu.Lock()
2028 defer o.handlersMu.Unlock()
2029 return o.onPopupDone
2030}
2031
2032// EventSignature returns the declared event argument types in wire order.
2033func (o *ShellSurface) EventSignature(opcode uint16) (string, bool) {
2034 switch opcode {
2035 case 0:
2036 return "uint,", true
2037 case 1:
2038 return "uint,int,int,", true
2039 case 2:
2040 return "", true
2041 default:
2042 return "", false
2043 }
2044}
2045
2046// Dispatch decodes one event on wl_shell_surface and calls the registered handlers.
2047func (o *ShellSurface) Dispatch(event *wl.Event) {
2048 switch event.Opcode {
2049 case 0: // ping
2050 serial := event.Uint32()
2051
2052 for i, handler := range o.handlersForPing() {
2053 _ = i
2054 handler(serial)
2055 }
2056 case 1: // configure
2057 edges := event.Uint32()
2058 width := event.Int32()
2059 height := event.Int32()
2060
2061 for i, handler := range o.handlersForConfigure() {
2062 _ = i
2063 handler(edges, width, height)
2064 }
2065 case 2: // popup_done
2066
2067 for i, handler := range o.handlersForPopupDone() {
2068 _ = i
2069 handler()
2070 }
2071 default:
2072 }
2073}
2074
2075// SurfaceInterface is the protocol interface name.
2076const SurfaceInterface = "wl_surface"
2077
2078// Surface is the generated binding for wl_surface version 7.
2079type Surface struct {
2080 wl.BaseProxy
2081 // handlersMu guards the handler slices: a client may register or replace
2082 // handlers while another goroutine dispatches events.
2083 handlersMu sync.Mutex
2084 onEnter []func(outputID uint32)
2085 onLeave []func(outputID uint32)
2086 onPreferredBufferScale []func(factor int32)
2087 onPreferredBufferTransform []func(transform uint32)
2088}
2089
2090// NewSurface returns an unbound Surface.
2091func NewSurface(ctx *wl.Context) *Surface {
2092 obj := &Surface{}
2093 obj.SetContext(ctx)
2094 ctx.Register(obj)
2095 return obj
2096}
2097
2098// Deletes the surface and invalidates its object ID.
2099func (o *Surface) Destroy() error {
2100 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_surface.destroy", Destructor: true}); err != nil {
2101 return err
2102 }
2103 return nil
2104}
2105
2106// Set a buffer as the content of this surface. The new size of the surface is calculated based on the buffer size transformed by the inverse buffer_transform and the inverse buffer_scale. This means that at commit time the supplied buffer size must be an integer multiple of the buffer_scale. If that's not the case, an invalid_size error is sent. The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. Setting anything other than 0 as x and y arguments is discouraged, and should instead be replaced with using the separate wl_surface.offset request. When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an 'invalid_offset' error being raised. The x and y arguments are ignored and do not change the pending state. To achieve equivalent semantics, use wl_surface.offset. Surface contents are double-buffered state, see wl_surface.commit. The initial surface contents are void; there is no content. wl_surface.attach assigns the given wl_buffer as the pending wl_buffer. wl_surface.commit makes the pending wl_buffer the new surface contents, and the size of the surface becomes the size calculated from the wl_buffer, as described above. After commit, there is no pending buffer until the next attach. Committing a pending wl_buffer allows the compositor to read the pixels in the wl_buffer. The compositor may access the pixels at any time after the wl_surface.commit request. When the compositor will not access the pixels anymore, it will send the wl_buffer.release event. Only after receiving wl_buffer.release, the client may reuse the wl_buffer. A wl_buffer that has been attached and then replaced by another attach instead of committed will not receive a release event, and is not used by the compositor. If a pending wl_buffer has been committed to more than one wl_surface, the delivery of wl_buffer.release events becomes undefined. A well behaved client should not rely on wl_buffer.release events in this case. Instead, clients hitting this case should use wl_surface.get_release or use a protocol extension providing per-commit release notifications (if none of these options are available, a fallback can be implemented by creating multiple wl_buffer objects from the same backing storage). Destroying the wl_buffer after wl_buffer.release does not change the surface contents. Destroying the wl_buffer before wl_buffer.release is allowed as long as the underlying buffer storage isn't re-used (this can happen e.g. on client process termination). However, if the client destroys the wl_buffer before receiving the wl_buffer.release event and mutates the underlying buffer storage, the surface contents become undefined immediately. If wl_surface.attach is sent with a NULL wl_buffer, the following wl_surface.commit will remove the surface content. If a pending wl_buffer has been destroyed, the result is not specified. Many compositors are known to remove the surface content on the following wl_surface.commit, but this behaviour is not universal. Clients seeking to maximise compatibility should not destroy pending buffers and should ensure that they explicitly remove content from surfaces, even after destroying buffers.
2107func (o *Surface) Attach(buffer *Buffer, x int32, y int32) error {
2108 var arg0 wl.Object
2109 if buffer != nil {
2110 arg0 = buffer
2111 }
2112 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_surface.attach"}, arg0, x, y); err != nil {
2113 return err
2114 }
2115 return nil
2116}
2117
2118// This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in surface-local coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. Note! New clients should not use this request. Instead damage can be posted with wl_surface.damage_buffer which uses buffer coordinates instead of surface coordinates.
2119func (o *Surface) Damage(x int32, y int32, width int32, height int32) error {
2120 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_surface.damage"}, x, y, width, height); err != nil {
2121 return err
2122 }
2123 return nil
2124}
2125
2126// Request a notification when it is a good time to start drawing a new frame, by creating a frame callback. This is useful for throttling redrawing operations, and driving animations. When a client is animating on a wl_surface, it can use the 'frame' request to get notified when it is a good time to draw and commit the next frame of animation. If the client commits an update earlier than that, it is likely that some updates will not make it to the display, and the client is wasting resources by drawing too often. The frame request will take effect on the next wl_surface.commit. The notification will only be posted for one frame unless requested again. For a wl_surface, the notifications are posted in the order the frame requests were committed. The server must send the notifications so that a client will not send excessive updates, while still allowing the highest possible update rate for clients that wait for the reply before drawing again. The server should give some time for the client to draw and commit after sending the frame callback events to let it hit the next output refresh. A server should avoid signaling the frame callbacks if the surface is not visible in any way, e.g. the surface is off-screen, or completely obscured by other opaque surfaces. The object returned by this request will be destroyed by the compositor after the callback is fired and as such the client must not attempt to use it after that point. The callback_data passed in the callback is the current time, in milliseconds, with an undefined base.
2127func (o *Surface) Frame() (*Callback, error) {
2128 child := &Callback{}
2129 child.SetContext(o.Context())
2130 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_surface.frame", Child: child}, child); err != nil {
2131 return nil, err
2132 }
2133 return child, nil
2134}
2135
2136// This request sets the region of the surface that contains opaque content. The opaque region is an optimization hint for the compositor that lets it optimize the redrawing of content behind opaque regions. Setting an opaque region is not required for correct behaviour, but marking transparent content as opaque will result in repaint artifacts. The opaque region is specified in surface-local coordinates. The compositor ignores the parts of the opaque region that fall outside of the surface. Opaque region is double-buffered state, see wl_surface.commit. wl_surface.set_opaque_region changes the pending opaque region. wl_surface.commit copies the pending region to the current region. Otherwise, the pending and current regions are never changed. The initial value for an opaque region is empty. Setting the pending opaque region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the pending opaque region to be set to empty.
2137func (o *Surface) SetOpaqueRegion(region *Region) error {
2138 var arg0 wl.Object
2139 if region != nil {
2140 arg0 = region
2141 }
2142 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_surface.set_opaque_region"}, arg0); err != nil {
2143 return err
2144 }
2145 return nil
2146}
2147
2148// This request sets the region of the surface that can receive pointer and touch events. Input events happening outside of this region will try the next surface in the server surface stack. The compositor ignores the parts of the input region that fall outside of the surface. The input region is specified in surface-local coordinates. Input region is double-buffered state, see wl_surface.commit. wl_surface.set_input_region changes the pending input region. wl_surface.commit copies the pending region to the current region. Otherwise the pending and current regions are never changed, except cursor and icon surfaces are special cases, see wl_pointer.set_cursor and wl_data_device.start_drag. The initial value for an input region is infinite. That means the whole surface will accept input. Setting the pending input region has copy semantics, and the wl_region object can be destroyed immediately. A NULL wl_region causes the input region to be set to infinite.
2149func (o *Surface) SetInputRegion(region *Region) error {
2150 var arg0 wl.Object
2151 if region != nil {
2152 arg0 = region
2153 }
2154 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_surface.set_input_region"}, arg0); err != nil {
2155 return err
2156 }
2157 return nil
2158}
2159
2160// Surface state (input, opaque, and damage regions, attached buffers, etc.) is double-buffered. Protocol requests modify the pending state, as opposed to the active state in use by the compositor. All requests that need a commit to become effective are documented to affect double-buffered state. Other interfaces may add further double-buffered surface state. A commit request atomically creates a Content Update (CU) from the pending state, even if the pending state has not been touched. The content update is placed at the end of a per-surface queue until it becomes active. After commit, the new pending state is as documented for each related request. A CU is either a Desync Content Update (DCU) or a Sync Content Update (SCU). If the surface is effectively synchronized at the commit request, it is a SCU, otherwise a DCU. When a surface transitions from effectively synchronized to effectively desynchronized, all SCUs in its queue which are not reachable by any DCU become DCUs and dependency edges from outside the queue to these CUs are removed. See wl_subsurface for the definition of 'effectively synchronized' and 'effectively desynchronized'. When a CU is placed in the queue, the CU has a dependency on the CU in front of it and to the SCU at end of the queue of every direct child surface if that SCU exists and does not have another dependent. This can form a directed acyclic graph of CUs with dependencies as edges. In addition to surface state, the CU can have constraints that must be satisfied before it can be applied. Other interfaces may add CU constraints. All DCUs which do not have a SCU in front of themselves in their queue, are candidates. If the graph that's reachable by a candidate does not have any unsatisfied constraints, the entire graph must be applied atomically. When a CU is applied, the wl_buffer is applied before all other state. This means that all coordinates in double-buffered state are relative to the newly attached wl_buffers, except for wl_surface.attach itself. If there is no newly attached wl_buffer, the coordinates are relative to the previous content update.
2161func (o *Surface) Commit() error {
2162 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 6, Name: "wl_surface.commit"}); err != nil {
2163 return err
2164 }
2165 return nil
2166}
2167
2168// This request sets the transformation that the client has already applied to the content of the buffer. The accepted values for the transform parameter are the values for wl_output.transform. The compositor applies the inverse of this transformation whenever it uses the buffer contents. Buffer transform is double-buffered state, see wl_surface.commit. A newly created surface has its buffer transformation set to normal. wl_surface.set_buffer_transform changes the pending buffer transformation. wl_surface.commit copies the pending buffer transformation to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to render content according to the output transform, thus permitting the compositor to use certain optimizations even if the display is rotated. Using hardware overlays and scanning out a client buffer for fullscreen surfaces are examples of such optimizations. Those optimizations are highly dependent on the compositor implementation, so the use of this request should be considered on a case-by-case basis. Note that if the transform value includes 90 or 270 degree rotation, the width of the buffer will become the surface height and the height of the buffer will become the surface width. If transform is not one of the values from the wl_output.transform enum the invalid_transform protocol error is raised.
2169func (o *Surface) SetBufferTransform(transform int32) error {
2170 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 7, Name: "wl_surface.set_buffer_transform", Since: 2}, transform); err != nil {
2171 return err
2172 }
2173 return nil
2174}
2175
2176// This request sets an optional scaling factor on how the compositor interprets the contents of the buffer attached to the window. Buffer scale is double-buffered state, see wl_surface.commit. A newly created surface has its buffer scale set to 1. wl_surface.set_buffer_scale changes the pending buffer scale. wl_surface.commit copies the pending buffer scale to the current one. Otherwise, the pending and current values are never changed. The purpose of this request is to allow clients to supply higher resolution buffer data for use on high resolution outputs. It is intended that you pick the same buffer scale as the scale of the output that the surface is displayed on. This means the compositor can avoid scaling when rendering the surface on that output. Note that if the scale is larger than 1, then you have to attach a buffer that is larger (by a factor of scale in each dimension) than the desired surface size. If scale is not greater than 0 the invalid_scale protocol error is raised.
2177func (o *Surface) SetBufferScale(scale int32) error {
2178 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 8, Name: "wl_surface.set_buffer_scale", Since: 3}, scale); err != nil {
2179 return err
2180 }
2181 return nil
2182}
2183
2184// This request is used to describe the regions where the pending buffer is different from the current surface contents, and where the surface therefore needs to be repainted. The compositor ignores the parts of the damage that fall outside of the surface. Damage is double-buffered state, see wl_surface.commit. The damage rectangle is specified in buffer coordinates, where x and y specify the upper left corner of the damage rectangle. The initial value for pending damage is empty: no damage. wl_surface.damage_buffer adds pending damage: the new pending damage is the union of old pending damage and the given rectangle. wl_surface.commit assigns pending damage as the current damage, and clears pending damage. The server will clear the current damage as it repaints the surface. This request differs from wl_surface.damage in only one way - it takes damage in buffer coordinates instead of surface-local coordinates. While this generally is more intuitive than surface coordinates, it is especially desirable when using wp_viewport or when a drawing library (like EGL) is unaware of buffer scale and buffer transform. Note: Because buffer transformation changes and damage requests may be interleaved in the protocol stream, it is impossible to determine the actual mapping between surface and buffer damage until wl_surface.commit time. Therefore, compositors wishing to take both kinds of damage into account will have to accumulate damage from the two requests separately and only transform from one to the other after receiving the wl_surface.commit.
2185func (o *Surface) DamageBuffer(x int32, y int32, width int32, height int32) error {
2186 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 9, Name: "wl_surface.damage_buffer", Since: 4}, x, y, width, height); err != nil {
2187 return err
2188 }
2189 return nil
2190}
2191
2192// The x and y arguments specify the location of the new pending buffer's upper left corner, relative to the current buffer's upper left corner, in surface-local coordinates. In other words, the x and y, combined with the new surface size define in which directions the surface's size changes. The exact semantics of wl_surface.offset are role-specific. Refer to the documentation of specific roles for more information. Surface location offset is double-buffered state, see wl_surface.commit. This request is semantically equivalent to and the replaces the x and y arguments in the wl_surface.attach request in wl_surface versions prior to 5. See wl_surface.attach for details.
2193func (o *Surface) Offset(x int32, y int32) error {
2194 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 10, Name: "wl_surface.offset", Since: 5}, x, y); err != nil {
2195 return err
2196 }
2197 return nil
2198}
2199
2200// Create a callback for the release of the buffer attached by the client with wl_surface.attach. The compositor will release the buffer when it has finished its usage of the underlying storage for the relevant commit. Once the client receives this event, and assuming the associated buffer is not pending release from other wl_surface.commit requests, the client can safely re-use the buffer. Release callbacks are double-buffered state, and will be associated with the pending buffer at wl_surface.commit time. The callback_data passed in the wl_callback.done event is unused and is always zero. Sending this request without attaching a non-null buffer in the same content update is a protocol error. The compositor will send the no_buffer error in this case.
2201func (o *Surface) GetRelease() (*Callback, error) {
2202 child := &Callback{}
2203 child.SetContext(o.Context())
2204 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 11, Name: "wl_surface.get_release", Since: 7, Child: child}, child); err != nil {
2205 return nil, err
2206 }
2207 return child, nil
2208}
2209
2210// OnEnter registers a handler for the enter event.
2211//
2212// Handlers are appended, so a second call adds another handler rather than
2213// replacing the first. Registration is safe while another goroutine dispatches.
2214func (o *Surface) OnEnter(handler func(outputID uint32)) {
2215 if handler == nil {
2216 return
2217 }
2218 o.handlersMu.Lock()
2219 defer o.handlersMu.Unlock()
2220 o.onEnter = append(o.onEnter, handler)
2221}
2222
2223// handlersForEnter returns the handlers registered for enter, taken
2224// under the lock so a handler may register another handler while events are
2225// being dispatched.
2226func (o *Surface) handlersForEnter() []func(outputID uint32) {
2227 o.handlersMu.Lock()
2228 defer o.handlersMu.Unlock()
2229 return o.onEnter
2230}
2231
2232// OnLeave registers a handler for the leave event.
2233//
2234// Handlers are appended, so a second call adds another handler rather than
2235// replacing the first. Registration is safe while another goroutine dispatches.
2236func (o *Surface) OnLeave(handler func(outputID uint32)) {
2237 if handler == nil {
2238 return
2239 }
2240 o.handlersMu.Lock()
2241 defer o.handlersMu.Unlock()
2242 o.onLeave = append(o.onLeave, handler)
2243}
2244
2245// handlersForLeave returns the handlers registered for leave, taken
2246// under the lock so a handler may register another handler while events are
2247// being dispatched.
2248func (o *Surface) handlersForLeave() []func(outputID uint32) {
2249 o.handlersMu.Lock()
2250 defer o.handlersMu.Unlock()
2251 return o.onLeave
2252}
2253
2254// OnPreferredBufferScale registers a handler for the preferred_buffer_scale event.
2255//
2256// Handlers are appended, so a second call adds another handler rather than
2257// replacing the first. Registration is safe while another goroutine dispatches.
2258func (o *Surface) OnPreferredBufferScale(handler func(factor int32)) {
2259 if handler == nil {
2260 return
2261 }
2262 o.handlersMu.Lock()
2263 defer o.handlersMu.Unlock()
2264 o.onPreferredBufferScale = append(o.onPreferredBufferScale, handler)
2265}
2266
2267// handlersForPreferredBufferScale returns the handlers registered for preferred_buffer_scale, taken
2268// under the lock so a handler may register another handler while events are
2269// being dispatched.
2270func (o *Surface) handlersForPreferredBufferScale() []func(factor int32) {
2271 o.handlersMu.Lock()
2272 defer o.handlersMu.Unlock()
2273 return o.onPreferredBufferScale
2274}
2275
2276// OnPreferredBufferTransform registers a handler for the preferred_buffer_transform event.
2277//
2278// Handlers are appended, so a second call adds another handler rather than
2279// replacing the first. Registration is safe while another goroutine dispatches.
2280func (o *Surface) OnPreferredBufferTransform(handler func(transform uint32)) {
2281 if handler == nil {
2282 return
2283 }
2284 o.handlersMu.Lock()
2285 defer o.handlersMu.Unlock()
2286 o.onPreferredBufferTransform = append(o.onPreferredBufferTransform, handler)
2287}
2288
2289// handlersForPreferredBufferTransform returns the handlers registered for preferred_buffer_transform, taken
2290// under the lock so a handler may register another handler while events are
2291// being dispatched.
2292func (o *Surface) handlersForPreferredBufferTransform() []func(transform uint32) {
2293 o.handlersMu.Lock()
2294 defer o.handlersMu.Unlock()
2295 return o.onPreferredBufferTransform
2296}
2297
2298// EventSignature returns the declared event argument types in wire order.
2299func (o *Surface) EventSignature(opcode uint16) (string, bool) {
2300 switch opcode {
2301 case 0:
2302 return "object,", true
2303 case 1:
2304 return "object,", true
2305 case 2:
2306 return "int,", true
2307 case 3:
2308 return "uint,", true
2309 default:
2310 return "", false
2311 }
2312}
2313
2314// Dispatch decodes one event on wl_surface and calls the registered handlers.
2315func (o *Surface) Dispatch(event *wl.Event) {
2316 switch event.Opcode {
2317 case 0: // enter
2318 outputID := event.Uint32()
2319
2320 for i, handler := range o.handlersForEnter() {
2321 _ = i
2322 handler(outputID)
2323 }
2324 case 1: // leave
2325 outputID := event.Uint32()
2326
2327 for i, handler := range o.handlersForLeave() {
2328 _ = i
2329 handler(outputID)
2330 }
2331 case 2: // preferred_buffer_scale
2332 factor := event.Int32()
2333
2334 for i, handler := range o.handlersForPreferredBufferScale() {
2335 _ = i
2336 handler(factor)
2337 }
2338 case 3: // preferred_buffer_transform
2339 transform := event.Uint32()
2340
2341 for i, handler := range o.handlersForPreferredBufferTransform() {
2342 _ = i
2343 handler(transform)
2344 }
2345 default:
2346 }
2347}
2348
2349// SeatInterface is the protocol interface name.
2350const SeatInterface = "wl_seat"
2351
2352// Seat is the generated binding for wl_seat version 11.
2353type Seat struct {
2354 wl.BaseProxy
2355 // handlersMu guards the handler slices: a client may register or replace
2356 // handlers while another goroutine dispatches events.
2357 handlersMu sync.Mutex
2358 onCapabilities []func(capabilities uint32)
2359 onName []func(name string)
2360}
2361
2362// NewSeat returns an unbound Seat.
2363func NewSeat(ctx *wl.Context) *Seat {
2364 obj := &Seat{}
2365 obj.SetContext(ctx)
2366 ctx.Register(obj)
2367 return obj
2368}
2369
2370// The ID provided will be initialized to the wl_pointer interface for this seat. This request only takes effect if the seat has the pointer capability, or has had the pointer capability in the past. It is a protocol violation to issue this request on a seat that has never had the pointer capability. The missing_capability error will be sent in this case.
2371func (o *Seat) GetPointer() (*Pointer, error) {
2372 child := &Pointer{}
2373 child.SetContext(o.Context())
2374 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_seat.get_pointer", Child: child}, child); err != nil {
2375 return nil, err
2376 }
2377 return child, nil
2378}
2379
2380// The ID provided will be initialized to the wl_keyboard interface for this seat. This request only takes effect if the seat has the keyboard capability, or has had the keyboard capability in the past. It is a protocol violation to issue this request on a seat that has never had the keyboard capability. The missing_capability error will be sent in this case.
2381func (o *Seat) GetKeyboard() (*Keyboard, error) {
2382 child := &Keyboard{}
2383 child.SetContext(o.Context())
2384 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_seat.get_keyboard", Child: child}, child); err != nil {
2385 return nil, err
2386 }
2387 return child, nil
2388}
2389
2390// The ID provided will be initialized to the wl_touch interface for this seat. This request only takes effect if the seat has the touch capability, or has had the touch capability in the past. It is a protocol violation to issue this request on a seat that has never had the touch capability. The missing_capability error will be sent in this case.
2391func (o *Seat) GetTouch() (*Touch, error) {
2392 child := &Touch{}
2393 child.SetContext(o.Context())
2394 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_seat.get_touch", Child: child}, child); err != nil {
2395 return nil, err
2396 }
2397 return child, nil
2398}
2399
2400// Using this request a client can tell the server that it is not going to use the seat object anymore.
2401func (o *Seat) Release() error {
2402 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_seat.release", Since: 5, Destructor: true}); err != nil {
2403 return err
2404 }
2405 return nil
2406}
2407
2408// OnCapabilities registers a handler for the capabilities event.
2409//
2410// Handlers are appended, so a second call adds another handler rather than
2411// replacing the first. Registration is safe while another goroutine dispatches.
2412func (o *Seat) OnCapabilities(handler func(capabilities uint32)) {
2413 if handler == nil {
2414 return
2415 }
2416 o.handlersMu.Lock()
2417 defer o.handlersMu.Unlock()
2418 o.onCapabilities = append(o.onCapabilities, handler)
2419}
2420
2421// handlersForCapabilities returns the handlers registered for capabilities, taken
2422// under the lock so a handler may register another handler while events are
2423// being dispatched.
2424func (o *Seat) handlersForCapabilities() []func(capabilities uint32) {
2425 o.handlersMu.Lock()
2426 defer o.handlersMu.Unlock()
2427 return o.onCapabilities
2428}
2429
2430// OnName registers a handler for the name event.
2431//
2432// Handlers are appended, so a second call adds another handler rather than
2433// replacing the first. Registration is safe while another goroutine dispatches.
2434func (o *Seat) OnName(handler func(name string)) {
2435 if handler == nil {
2436 return
2437 }
2438 o.handlersMu.Lock()
2439 defer o.handlersMu.Unlock()
2440 o.onName = append(o.onName, handler)
2441}
2442
2443// handlersForName returns the handlers registered for name, taken
2444// under the lock so a handler may register another handler while events are
2445// being dispatched.
2446func (o *Seat) handlersForName() []func(name string) {
2447 o.handlersMu.Lock()
2448 defer o.handlersMu.Unlock()
2449 return o.onName
2450}
2451
2452// EventSignature returns the declared event argument types in wire order.
2453func (o *Seat) EventSignature(opcode uint16) (string, bool) {
2454 switch opcode {
2455 case 0:
2456 return "uint,", true
2457 case 1:
2458 return "string,", true
2459 default:
2460 return "", false
2461 }
2462}
2463
2464// Dispatch decodes one event on wl_seat and calls the registered handlers.
2465func (o *Seat) Dispatch(event *wl.Event) {
2466 switch event.Opcode {
2467 case 0: // capabilities
2468 capabilities := event.Uint32()
2469
2470 for i, handler := range o.handlersForCapabilities() {
2471 _ = i
2472 handler(capabilities)
2473 }
2474 case 1: // name
2475 name := event.String()
2476
2477 for i, handler := range o.handlersForName() {
2478 _ = i
2479 handler(name)
2480 }
2481 default:
2482 }
2483}
2484
2485// PointerInterface is the protocol interface name.
2486const PointerInterface = "wl_pointer"
2487
2488// Pointer is the generated binding for wl_pointer version 11.
2489type Pointer struct {
2490 wl.BaseProxy
2491 // handlersMu guards the handler slices: a client may register or replace
2492 // handlers while another goroutine dispatches events.
2493 handlersMu sync.Mutex
2494 onEnter []func(serial uint32, surfaceID uint32, surfaceX wl.Fixed, surfaceY wl.Fixed)
2495 onLeave []func(serial uint32, surfaceID uint32)
2496 onMotion []func(time uint32, surfaceX wl.Fixed, surfaceY wl.Fixed)
2497 onButton []func(serial uint32, time uint32, button uint32, state uint32)
2498 onAxis []func(time uint32, axis uint32, value wl.Fixed)
2499 onFrame []func()
2500 onAxisSource []func(axisSource uint32)
2501 onAxisStop []func(time uint32, axis uint32)
2502 onAxisDiscrete []func(axis uint32, discrete int32)
2503 onAxisValue120 []func(axis uint32, value120 int32)
2504 onAxisRelativeDirection []func(axis uint32, direction uint32)
2505 onWarp []func(surfaceX wl.Fixed, surfaceY wl.Fixed)
2506}
2507
2508// NewPointer returns an unbound Pointer.
2509func NewPointer(ctx *wl.Context) *Pointer {
2510 obj := &Pointer{}
2511 obj.SetContext(ctx)
2512 ctx.Register(obj)
2513 return obj
2514}
2515
2516// Set the pointer surface, i.e., the surface that contains the pointer image (cursor). This request gives the surface the role of a cursor. If the surface already has another role, it raises a protocol error. The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the pointer image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On wl_surface.offset requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. The offset must be applied by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The input region is ignored for wl_surfaces with the role of a cursor. When the use as a cursor ends, the wl_surface is unmapped. The serial parameter must match the latest wl_pointer.enter serial number sent to the client. Otherwise the request will be ignored.
2517func (o *Pointer) SetCursor(serial uint32, surface *Surface, hotspotX int32, hotspotY int32) error {
2518 var arg1 wl.Object
2519 if surface != nil {
2520 arg1 = surface
2521 }
2522 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_pointer.set_cursor"}, serial, arg1, hotspotX, hotspotY); err != nil {
2523 return err
2524 }
2525 return nil
2526}
2527
2528// Using this request a client can tell the server that it is not going to use the pointer object anymore. This request destroys the pointer proxy object, so clients must not call wl_pointer_destroy() after using this request.
2529func (o *Pointer) Release() error {
2530 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_pointer.release", Since: 3, Destructor: true}); err != nil {
2531 return err
2532 }
2533 return nil
2534}
2535
2536// OnEnter registers a handler for the enter event.
2537//
2538// Handlers are appended, so a second call adds another handler rather than
2539// replacing the first. Registration is safe while another goroutine dispatches.
2540func (o *Pointer) OnEnter(handler func(serial uint32, surfaceID uint32, surfaceX wl.Fixed, surfaceY wl.Fixed)) {
2541 if handler == nil {
2542 return
2543 }
2544 o.handlersMu.Lock()
2545 defer o.handlersMu.Unlock()
2546 o.onEnter = append(o.onEnter, handler)
2547}
2548
2549// handlersForEnter returns the handlers registered for enter, taken
2550// under the lock so a handler may register another handler while events are
2551// being dispatched.
2552func (o *Pointer) handlersForEnter() []func(serial uint32, surfaceID uint32, surfaceX wl.Fixed, surfaceY wl.Fixed) {
2553 o.handlersMu.Lock()
2554 defer o.handlersMu.Unlock()
2555 return o.onEnter
2556}
2557
2558// OnLeave registers a handler for the leave event.
2559//
2560// Handlers are appended, so a second call adds another handler rather than
2561// replacing the first. Registration is safe while another goroutine dispatches.
2562func (o *Pointer) OnLeave(handler func(serial uint32, surfaceID uint32)) {
2563 if handler == nil {
2564 return
2565 }
2566 o.handlersMu.Lock()
2567 defer o.handlersMu.Unlock()
2568 o.onLeave = append(o.onLeave, handler)
2569}
2570
2571// handlersForLeave returns the handlers registered for leave, taken
2572// under the lock so a handler may register another handler while events are
2573// being dispatched.
2574func (o *Pointer) handlersForLeave() []func(serial uint32, surfaceID uint32) {
2575 o.handlersMu.Lock()
2576 defer o.handlersMu.Unlock()
2577 return o.onLeave
2578}
2579
2580// OnMotion registers a handler for the motion event.
2581//
2582// Handlers are appended, so a second call adds another handler rather than
2583// replacing the first. Registration is safe while another goroutine dispatches.
2584func (o *Pointer) OnMotion(handler func(time uint32, surfaceX wl.Fixed, surfaceY wl.Fixed)) {
2585 if handler == nil {
2586 return
2587 }
2588 o.handlersMu.Lock()
2589 defer o.handlersMu.Unlock()
2590 o.onMotion = append(o.onMotion, handler)
2591}
2592
2593// handlersForMotion returns the handlers registered for motion, taken
2594// under the lock so a handler may register another handler while events are
2595// being dispatched.
2596func (o *Pointer) handlersForMotion() []func(time uint32, surfaceX wl.Fixed, surfaceY wl.Fixed) {
2597 o.handlersMu.Lock()
2598 defer o.handlersMu.Unlock()
2599 return o.onMotion
2600}
2601
2602// OnButton registers a handler for the button event.
2603//
2604// Handlers are appended, so a second call adds another handler rather than
2605// replacing the first. Registration is safe while another goroutine dispatches.
2606func (o *Pointer) OnButton(handler func(serial uint32, time uint32, button uint32, state uint32)) {
2607 if handler == nil {
2608 return
2609 }
2610 o.handlersMu.Lock()
2611 defer o.handlersMu.Unlock()
2612 o.onButton = append(o.onButton, handler)
2613}
2614
2615// handlersForButton returns the handlers registered for button, taken
2616// under the lock so a handler may register another handler while events are
2617// being dispatched.
2618func (o *Pointer) handlersForButton() []func(serial uint32, time uint32, button uint32, state uint32) {
2619 o.handlersMu.Lock()
2620 defer o.handlersMu.Unlock()
2621 return o.onButton
2622}
2623
2624// OnAxis registers a handler for the axis event.
2625//
2626// Handlers are appended, so a second call adds another handler rather than
2627// replacing the first. Registration is safe while another goroutine dispatches.
2628func (o *Pointer) OnAxis(handler func(time uint32, axis uint32, value wl.Fixed)) {
2629 if handler == nil {
2630 return
2631 }
2632 o.handlersMu.Lock()
2633 defer o.handlersMu.Unlock()
2634 o.onAxis = append(o.onAxis, handler)
2635}
2636
2637// handlersForAxis returns the handlers registered for axis, taken
2638// under the lock so a handler may register another handler while events are
2639// being dispatched.
2640func (o *Pointer) handlersForAxis() []func(time uint32, axis uint32, value wl.Fixed) {
2641 o.handlersMu.Lock()
2642 defer o.handlersMu.Unlock()
2643 return o.onAxis
2644}
2645
2646// OnFrame registers a handler for the frame event.
2647//
2648// Handlers are appended, so a second call adds another handler rather than
2649// replacing the first. Registration is safe while another goroutine dispatches.
2650func (o *Pointer) OnFrame(handler func()) {
2651 if handler == nil {
2652 return
2653 }
2654 o.handlersMu.Lock()
2655 defer o.handlersMu.Unlock()
2656 o.onFrame = append(o.onFrame, handler)
2657}
2658
2659// handlersForFrame returns the handlers registered for frame, taken
2660// under the lock so a handler may register another handler while events are
2661// being dispatched.
2662func (o *Pointer) handlersForFrame() []func() {
2663 o.handlersMu.Lock()
2664 defer o.handlersMu.Unlock()
2665 return o.onFrame
2666}
2667
2668// OnAxisSource registers a handler for the axis_source event.
2669//
2670// Handlers are appended, so a second call adds another handler rather than
2671// replacing the first. Registration is safe while another goroutine dispatches.
2672func (o *Pointer) OnAxisSource(handler func(axisSource uint32)) {
2673 if handler == nil {
2674 return
2675 }
2676 o.handlersMu.Lock()
2677 defer o.handlersMu.Unlock()
2678 o.onAxisSource = append(o.onAxisSource, handler)
2679}
2680
2681// handlersForAxisSource returns the handlers registered for axis_source, taken
2682// under the lock so a handler may register another handler while events are
2683// being dispatched.
2684func (o *Pointer) handlersForAxisSource() []func(axisSource uint32) {
2685 o.handlersMu.Lock()
2686 defer o.handlersMu.Unlock()
2687 return o.onAxisSource
2688}
2689
2690// OnAxisStop registers a handler for the axis_stop event.
2691//
2692// Handlers are appended, so a second call adds another handler rather than
2693// replacing the first. Registration is safe while another goroutine dispatches.
2694func (o *Pointer) OnAxisStop(handler func(time uint32, axis uint32)) {
2695 if handler == nil {
2696 return
2697 }
2698 o.handlersMu.Lock()
2699 defer o.handlersMu.Unlock()
2700 o.onAxisStop = append(o.onAxisStop, handler)
2701}
2702
2703// handlersForAxisStop returns the handlers registered for axis_stop, taken
2704// under the lock so a handler may register another handler while events are
2705// being dispatched.
2706func (o *Pointer) handlersForAxisStop() []func(time uint32, axis uint32) {
2707 o.handlersMu.Lock()
2708 defer o.handlersMu.Unlock()
2709 return o.onAxisStop
2710}
2711
2712// OnAxisDiscrete registers a handler for the axis_discrete event.
2713//
2714// Handlers are appended, so a second call adds another handler rather than
2715// replacing the first. Registration is safe while another goroutine dispatches.
2716func (o *Pointer) OnAxisDiscrete(handler func(axis uint32, discrete int32)) {
2717 if handler == nil {
2718 return
2719 }
2720 o.handlersMu.Lock()
2721 defer o.handlersMu.Unlock()
2722 o.onAxisDiscrete = append(o.onAxisDiscrete, handler)
2723}
2724
2725// handlersForAxisDiscrete returns the handlers registered for axis_discrete, taken
2726// under the lock so a handler may register another handler while events are
2727// being dispatched.
2728func (o *Pointer) handlersForAxisDiscrete() []func(axis uint32, discrete int32) {
2729 o.handlersMu.Lock()
2730 defer o.handlersMu.Unlock()
2731 return o.onAxisDiscrete
2732}
2733
2734// OnAxisValue120 registers a handler for the axis_value120 event.
2735//
2736// Handlers are appended, so a second call adds another handler rather than
2737// replacing the first. Registration is safe while another goroutine dispatches.
2738func (o *Pointer) OnAxisValue120(handler func(axis uint32, value120 int32)) {
2739 if handler == nil {
2740 return
2741 }
2742 o.handlersMu.Lock()
2743 defer o.handlersMu.Unlock()
2744 o.onAxisValue120 = append(o.onAxisValue120, handler)
2745}
2746
2747// handlersForAxisValue120 returns the handlers registered for axis_value120, taken
2748// under the lock so a handler may register another handler while events are
2749// being dispatched.
2750func (o *Pointer) handlersForAxisValue120() []func(axis uint32, value120 int32) {
2751 o.handlersMu.Lock()
2752 defer o.handlersMu.Unlock()
2753 return o.onAxisValue120
2754}
2755
2756// OnAxisRelativeDirection registers a handler for the axis_relative_direction event.
2757//
2758// Handlers are appended, so a second call adds another handler rather than
2759// replacing the first. Registration is safe while another goroutine dispatches.
2760func (o *Pointer) OnAxisRelativeDirection(handler func(axis uint32, direction uint32)) {
2761 if handler == nil {
2762 return
2763 }
2764 o.handlersMu.Lock()
2765 defer o.handlersMu.Unlock()
2766 o.onAxisRelativeDirection = append(o.onAxisRelativeDirection, handler)
2767}
2768
2769// handlersForAxisRelativeDirection returns the handlers registered for axis_relative_direction, taken
2770// under the lock so a handler may register another handler while events are
2771// being dispatched.
2772func (o *Pointer) handlersForAxisRelativeDirection() []func(axis uint32, direction uint32) {
2773 o.handlersMu.Lock()
2774 defer o.handlersMu.Unlock()
2775 return o.onAxisRelativeDirection
2776}
2777
2778// OnWarp registers a handler for the warp event.
2779//
2780// Handlers are appended, so a second call adds another handler rather than
2781// replacing the first. Registration is safe while another goroutine dispatches.
2782func (o *Pointer) OnWarp(handler func(surfaceX wl.Fixed, surfaceY wl.Fixed)) {
2783 if handler == nil {
2784 return
2785 }
2786 o.handlersMu.Lock()
2787 defer o.handlersMu.Unlock()
2788 o.onWarp = append(o.onWarp, handler)
2789}
2790
2791// handlersForWarp returns the handlers registered for warp, taken
2792// under the lock so a handler may register another handler while events are
2793// being dispatched.
2794func (o *Pointer) handlersForWarp() []func(surfaceX wl.Fixed, surfaceY wl.Fixed) {
2795 o.handlersMu.Lock()
2796 defer o.handlersMu.Unlock()
2797 return o.onWarp
2798}
2799
2800// EventSignature returns the declared event argument types in wire order.
2801func (o *Pointer) EventSignature(opcode uint16) (string, bool) {
2802 switch opcode {
2803 case 0:
2804 return "uint,object,fixed,fixed,", true
2805 case 1:
2806 return "uint,object,", true
2807 case 2:
2808 return "uint,fixed,fixed,", true
2809 case 3:
2810 return "uint,uint,uint,uint,", true
2811 case 4:
2812 return "uint,uint,fixed,", true
2813 case 5:
2814 return "", true
2815 case 6:
2816 return "uint,", true
2817 case 7:
2818 return "uint,uint,", true
2819 case 8:
2820 return "uint,int,", true
2821 case 9:
2822 return "uint,int,", true
2823 case 10:
2824 return "uint,uint,", true
2825 case 11:
2826 return "fixed,fixed,", true
2827 default:
2828 return "", false
2829 }
2830}
2831
2832// Dispatch decodes one event on wl_pointer and calls the registered handlers.
2833func (o *Pointer) Dispatch(event *wl.Event) {
2834 switch event.Opcode {
2835 case 0: // enter
2836 serial := event.Uint32()
2837 surfaceID := event.Uint32()
2838 surfaceX := event.Fixed()
2839 surfaceY := event.Fixed()
2840
2841 for i, handler := range o.handlersForEnter() {
2842 _ = i
2843 handler(serial, surfaceID, surfaceX, surfaceY)
2844 }
2845 case 1: // leave
2846 serial := event.Uint32()
2847 surfaceID := event.Uint32()
2848
2849 for i, handler := range o.handlersForLeave() {
2850 _ = i
2851 handler(serial, surfaceID)
2852 }
2853 case 2: // motion
2854 time := event.Uint32()
2855 surfaceX := event.Fixed()
2856 surfaceY := event.Fixed()
2857
2858 for i, handler := range o.handlersForMotion() {
2859 _ = i
2860 handler(time, surfaceX, surfaceY)
2861 }
2862 case 3: // button
2863 serial := event.Uint32()
2864 time := event.Uint32()
2865 button := event.Uint32()
2866 state := event.Uint32()
2867
2868 for i, handler := range o.handlersForButton() {
2869 _ = i
2870 handler(serial, time, button, state)
2871 }
2872 case 4: // axis
2873 time := event.Uint32()
2874 axis := event.Uint32()
2875 value := event.Fixed()
2876
2877 for i, handler := range o.handlersForAxis() {
2878 _ = i
2879 handler(time, axis, value)
2880 }
2881 case 5: // frame
2882
2883 for i, handler := range o.handlersForFrame() {
2884 _ = i
2885 handler()
2886 }
2887 case 6: // axis_source
2888 axisSource := event.Uint32()
2889
2890 for i, handler := range o.handlersForAxisSource() {
2891 _ = i
2892 handler(axisSource)
2893 }
2894 case 7: // axis_stop
2895 time := event.Uint32()
2896 axis := event.Uint32()
2897
2898 for i, handler := range o.handlersForAxisStop() {
2899 _ = i
2900 handler(time, axis)
2901 }
2902 case 8: // axis_discrete
2903 axis := event.Uint32()
2904 discrete := event.Int32()
2905
2906 for i, handler := range o.handlersForAxisDiscrete() {
2907 _ = i
2908 handler(axis, discrete)
2909 }
2910 case 9: // axis_value120
2911 axis := event.Uint32()
2912 value120 := event.Int32()
2913
2914 for i, handler := range o.handlersForAxisValue120() {
2915 _ = i
2916 handler(axis, value120)
2917 }
2918 case 10: // axis_relative_direction
2919 axis := event.Uint32()
2920 direction := event.Uint32()
2921
2922 for i, handler := range o.handlersForAxisRelativeDirection() {
2923 _ = i
2924 handler(axis, direction)
2925 }
2926 case 11: // warp
2927 surfaceX := event.Fixed()
2928 surfaceY := event.Fixed()
2929
2930 for i, handler := range o.handlersForWarp() {
2931 _ = i
2932 handler(surfaceX, surfaceY)
2933 }
2934 default:
2935 }
2936}
2937
2938// KeyboardInterface is the protocol interface name.
2939const KeyboardInterface = "wl_keyboard"
2940
2941// Keyboard is the generated binding for wl_keyboard version 11.
2942type Keyboard struct {
2943 wl.BaseProxy
2944 // handlersMu guards the handler slices: a client may register or replace
2945 // handlers while another goroutine dispatches events.
2946 handlersMu sync.Mutex
2947 onKeymap []func(format uint32, fd *wl.OwnedFD, size uint32)
2948 onEnter []func(serial uint32, surfaceID uint32, keys []byte)
2949 onLeave []func(serial uint32, surfaceID uint32)
2950 onKey []func(serial uint32, time uint32, key uint32, state uint32)
2951 onModifiers []func(serial uint32, modsDepressed uint32, modsLatched uint32, modsLocked uint32, group uint32)
2952 onRepeatInfo []func(rate int32, delay int32)
2953}
2954
2955// NewKeyboard returns an unbound Keyboard.
2956func NewKeyboard(ctx *wl.Context) *Keyboard {
2957 obj := &Keyboard{}
2958 obj.SetContext(ctx)
2959 ctx.Register(obj)
2960 return obj
2961}
2962
2963// release the keyboard object
2964func (o *Keyboard) Release() error {
2965 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_keyboard.release", Since: 3, Destructor: true}); err != nil {
2966 return err
2967 }
2968 return nil
2969}
2970
2971// OnKeymap registers a handler for the keymap event.
2972//
2973// Handlers are appended, so a second call adds another handler rather than
2974// replacing the first. Registration is safe while another goroutine dispatches.
2975func (o *Keyboard) OnKeymap(handler func(format uint32, fd *wl.OwnedFD, size uint32)) {
2976 if handler == nil {
2977 return
2978 }
2979 o.handlersMu.Lock()
2980 defer o.handlersMu.Unlock()
2981 o.onKeymap = append(o.onKeymap, handler)
2982}
2983
2984// handlersForKeymap returns the handlers registered for keymap, taken
2985// under the lock so a handler may register another handler while events are
2986// being dispatched.
2987func (o *Keyboard) handlersForKeymap() []func(format uint32, fd *wl.OwnedFD, size uint32) {
2988 o.handlersMu.Lock()
2989 defer o.handlersMu.Unlock()
2990 return o.onKeymap
2991}
2992
2993// OnEnter registers a handler for the enter event.
2994//
2995// Handlers are appended, so a second call adds another handler rather than
2996// replacing the first. Registration is safe while another goroutine dispatches.
2997func (o *Keyboard) OnEnter(handler func(serial uint32, surfaceID uint32, keys []byte)) {
2998 if handler == nil {
2999 return
3000 }
3001 o.handlersMu.Lock()
3002 defer o.handlersMu.Unlock()
3003 o.onEnter = append(o.onEnter, handler)
3004}
3005
3006// handlersForEnter returns the handlers registered for enter, taken
3007// under the lock so a handler may register another handler while events are
3008// being dispatched.
3009func (o *Keyboard) handlersForEnter() []func(serial uint32, surfaceID uint32, keys []byte) {
3010 o.handlersMu.Lock()
3011 defer o.handlersMu.Unlock()
3012 return o.onEnter
3013}
3014
3015// OnLeave registers a handler for the leave event.
3016//
3017// Handlers are appended, so a second call adds another handler rather than
3018// replacing the first. Registration is safe while another goroutine dispatches.
3019func (o *Keyboard) OnLeave(handler func(serial uint32, surfaceID uint32)) {
3020 if handler == nil {
3021 return
3022 }
3023 o.handlersMu.Lock()
3024 defer o.handlersMu.Unlock()
3025 o.onLeave = append(o.onLeave, handler)
3026}
3027
3028// handlersForLeave returns the handlers registered for leave, taken
3029// under the lock so a handler may register another handler while events are
3030// being dispatched.
3031func (o *Keyboard) handlersForLeave() []func(serial uint32, surfaceID uint32) {
3032 o.handlersMu.Lock()
3033 defer o.handlersMu.Unlock()
3034 return o.onLeave
3035}
3036
3037// OnKey registers a handler for the key event.
3038//
3039// Handlers are appended, so a second call adds another handler rather than
3040// replacing the first. Registration is safe while another goroutine dispatches.
3041func (o *Keyboard) OnKey(handler func(serial uint32, time uint32, key uint32, state uint32)) {
3042 if handler == nil {
3043 return
3044 }
3045 o.handlersMu.Lock()
3046 defer o.handlersMu.Unlock()
3047 o.onKey = append(o.onKey, handler)
3048}
3049
3050// handlersForKey returns the handlers registered for key, taken
3051// under the lock so a handler may register another handler while events are
3052// being dispatched.
3053func (o *Keyboard) handlersForKey() []func(serial uint32, time uint32, key uint32, state uint32) {
3054 o.handlersMu.Lock()
3055 defer o.handlersMu.Unlock()
3056 return o.onKey
3057}
3058
3059// OnModifiers registers a handler for the modifiers event.
3060//
3061// Handlers are appended, so a second call adds another handler rather than
3062// replacing the first. Registration is safe while another goroutine dispatches.
3063func (o *Keyboard) OnModifiers(handler func(serial uint32, modsDepressed uint32, modsLatched uint32, modsLocked uint32, group uint32)) {
3064 if handler == nil {
3065 return
3066 }
3067 o.handlersMu.Lock()
3068 defer o.handlersMu.Unlock()
3069 o.onModifiers = append(o.onModifiers, handler)
3070}
3071
3072// handlersForModifiers returns the handlers registered for modifiers, taken
3073// under the lock so a handler may register another handler while events are
3074// being dispatched.
3075func (o *Keyboard) handlersForModifiers() []func(serial uint32, modsDepressed uint32, modsLatched uint32, modsLocked uint32, group uint32) {
3076 o.handlersMu.Lock()
3077 defer o.handlersMu.Unlock()
3078 return o.onModifiers
3079}
3080
3081// OnRepeatInfo registers a handler for the repeat_info event.
3082//
3083// Handlers are appended, so a second call adds another handler rather than
3084// replacing the first. Registration is safe while another goroutine dispatches.
3085func (o *Keyboard) OnRepeatInfo(handler func(rate int32, delay int32)) {
3086 if handler == nil {
3087 return
3088 }
3089 o.handlersMu.Lock()
3090 defer o.handlersMu.Unlock()
3091 o.onRepeatInfo = append(o.onRepeatInfo, handler)
3092}
3093
3094// handlersForRepeatInfo returns the handlers registered for repeat_info, taken
3095// under the lock so a handler may register another handler while events are
3096// being dispatched.
3097func (o *Keyboard) handlersForRepeatInfo() []func(rate int32, delay int32) {
3098 o.handlersMu.Lock()
3099 defer o.handlersMu.Unlock()
3100 return o.onRepeatInfo
3101}
3102
3103// EventSignature returns the declared event argument types in wire order.
3104func (o *Keyboard) EventSignature(opcode uint16) (string, bool) {
3105 switch opcode {
3106 case 0:
3107 return "uint,fd,uint,", true
3108 case 1:
3109 return "uint,object,array,", true
3110 case 2:
3111 return "uint,object,", true
3112 case 3:
3113 return "uint,uint,uint,uint,", true
3114 case 4:
3115 return "uint,uint,uint,uint,uint,", true
3116 case 5:
3117 return "int,int,", true
3118 default:
3119 return "", false
3120 }
3121}
3122
3123// Dispatch decodes one event on wl_keyboard and calls the registered handlers.
3124func (o *Keyboard) Dispatch(event *wl.Event) {
3125 switch event.Opcode {
3126 case 0: // keymap
3127 format := event.Uint32()
3128 fd := event.FD()
3129 size := event.Uint32()
3130 ownedfd := fd
3131 defer ownedfd.Close()
3132
3133 for i, handler := range o.handlersForKeymap() {
3134 if i > 0 {
3135 fd = nil
3136 }
3137 handler(format, fd, size)
3138 }
3139 case 1: // enter
3140 serial := event.Uint32()
3141 surfaceID := event.Uint32()
3142 keys := event.Array()
3143
3144 for i, handler := range o.handlersForEnter() {
3145 _ = i
3146 handler(serial, surfaceID, keys)
3147 }
3148 case 2: // leave
3149 serial := event.Uint32()
3150 surfaceID := event.Uint32()
3151
3152 for i, handler := range o.handlersForLeave() {
3153 _ = i
3154 handler(serial, surfaceID)
3155 }
3156 case 3: // key
3157 serial := event.Uint32()
3158 time := event.Uint32()
3159 key := event.Uint32()
3160 state := event.Uint32()
3161
3162 for i, handler := range o.handlersForKey() {
3163 _ = i
3164 handler(serial, time, key, state)
3165 }
3166 case 4: // modifiers
3167 serial := event.Uint32()
3168 modsDepressed := event.Uint32()
3169 modsLatched := event.Uint32()
3170 modsLocked := event.Uint32()
3171 group := event.Uint32()
3172
3173 for i, handler := range o.handlersForModifiers() {
3174 _ = i
3175 handler(serial, modsDepressed, modsLatched, modsLocked, group)
3176 }
3177 case 5: // repeat_info
3178 rate := event.Int32()
3179 delay := event.Int32()
3180
3181 for i, handler := range o.handlersForRepeatInfo() {
3182 _ = i
3183 handler(rate, delay)
3184 }
3185 default:
3186 }
3187}
3188
3189// TouchInterface is the protocol interface name.
3190const TouchInterface = "wl_touch"
3191
3192// Touch is the generated binding for wl_touch version 11.
3193type Touch struct {
3194 wl.BaseProxy
3195 // handlersMu guards the handler slices: a client may register or replace
3196 // handlers while another goroutine dispatches events.
3197 handlersMu sync.Mutex
3198 onDown []func(serial uint32, time uint32, surfaceID uint32, id int32, x wl.Fixed, y wl.Fixed)
3199 onUp []func(serial uint32, time uint32, id int32)
3200 onMotion []func(time uint32, id int32, x wl.Fixed, y wl.Fixed)
3201 onFrame []func()
3202 onCancel []func()
3203 onShape []func(id int32, major wl.Fixed, minor wl.Fixed)
3204 onOrientation []func(id int32, orientation wl.Fixed)
3205}
3206
3207// NewTouch returns an unbound Touch.
3208func NewTouch(ctx *wl.Context) *Touch {
3209 obj := &Touch{}
3210 obj.SetContext(ctx)
3211 ctx.Register(obj)
3212 return obj
3213}
3214
3215// release the touch object
3216func (o *Touch) Release() error {
3217 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_touch.release", Since: 3, Destructor: true}); err != nil {
3218 return err
3219 }
3220 return nil
3221}
3222
3223// OnDown registers a handler for the down event.
3224//
3225// Handlers are appended, so a second call adds another handler rather than
3226// replacing the first. Registration is safe while another goroutine dispatches.
3227func (o *Touch) OnDown(handler func(serial uint32, time uint32, surfaceID uint32, id int32, x wl.Fixed, y wl.Fixed)) {
3228 if handler == nil {
3229 return
3230 }
3231 o.handlersMu.Lock()
3232 defer o.handlersMu.Unlock()
3233 o.onDown = append(o.onDown, handler)
3234}
3235
3236// handlersForDown returns the handlers registered for down, taken
3237// under the lock so a handler may register another handler while events are
3238// being dispatched.
3239func (o *Touch) handlersForDown() []func(serial uint32, time uint32, surfaceID uint32, id int32, x wl.Fixed, y wl.Fixed) {
3240 o.handlersMu.Lock()
3241 defer o.handlersMu.Unlock()
3242 return o.onDown
3243}
3244
3245// OnUp registers a handler for the up event.
3246//
3247// Handlers are appended, so a second call adds another handler rather than
3248// replacing the first. Registration is safe while another goroutine dispatches.
3249func (o *Touch) OnUp(handler func(serial uint32, time uint32, id int32)) {
3250 if handler == nil {
3251 return
3252 }
3253 o.handlersMu.Lock()
3254 defer o.handlersMu.Unlock()
3255 o.onUp = append(o.onUp, handler)
3256}
3257
3258// handlersForUp returns the handlers registered for up, taken
3259// under the lock so a handler may register another handler while events are
3260// being dispatched.
3261func (o *Touch) handlersForUp() []func(serial uint32, time uint32, id int32) {
3262 o.handlersMu.Lock()
3263 defer o.handlersMu.Unlock()
3264 return o.onUp
3265}
3266
3267// OnMotion registers a handler for the motion event.
3268//
3269// Handlers are appended, so a second call adds another handler rather than
3270// replacing the first. Registration is safe while another goroutine dispatches.
3271func (o *Touch) OnMotion(handler func(time uint32, id int32, x wl.Fixed, y wl.Fixed)) {
3272 if handler == nil {
3273 return
3274 }
3275 o.handlersMu.Lock()
3276 defer o.handlersMu.Unlock()
3277 o.onMotion = append(o.onMotion, handler)
3278}
3279
3280// handlersForMotion returns the handlers registered for motion, taken
3281// under the lock so a handler may register another handler while events are
3282// being dispatched.
3283func (o *Touch) handlersForMotion() []func(time uint32, id int32, x wl.Fixed, y wl.Fixed) {
3284 o.handlersMu.Lock()
3285 defer o.handlersMu.Unlock()
3286 return o.onMotion
3287}
3288
3289// OnFrame registers a handler for the frame event.
3290//
3291// Handlers are appended, so a second call adds another handler rather than
3292// replacing the first. Registration is safe while another goroutine dispatches.
3293func (o *Touch) OnFrame(handler func()) {
3294 if handler == nil {
3295 return
3296 }
3297 o.handlersMu.Lock()
3298 defer o.handlersMu.Unlock()
3299 o.onFrame = append(o.onFrame, handler)
3300}
3301
3302// handlersForFrame returns the handlers registered for frame, taken
3303// under the lock so a handler may register another handler while events are
3304// being dispatched.
3305func (o *Touch) handlersForFrame() []func() {
3306 o.handlersMu.Lock()
3307 defer o.handlersMu.Unlock()
3308 return o.onFrame
3309}
3310
3311// OnCancel registers a handler for the cancel event.
3312//
3313// Handlers are appended, so a second call adds another handler rather than
3314// replacing the first. Registration is safe while another goroutine dispatches.
3315func (o *Touch) OnCancel(handler func()) {
3316 if handler == nil {
3317 return
3318 }
3319 o.handlersMu.Lock()
3320 defer o.handlersMu.Unlock()
3321 o.onCancel = append(o.onCancel, handler)
3322}
3323
3324// handlersForCancel returns the handlers registered for cancel, taken
3325// under the lock so a handler may register another handler while events are
3326// being dispatched.
3327func (o *Touch) handlersForCancel() []func() {
3328 o.handlersMu.Lock()
3329 defer o.handlersMu.Unlock()
3330 return o.onCancel
3331}
3332
3333// OnShape registers a handler for the shape event.
3334//
3335// Handlers are appended, so a second call adds another handler rather than
3336// replacing the first. Registration is safe while another goroutine dispatches.
3337func (o *Touch) OnShape(handler func(id int32, major wl.Fixed, minor wl.Fixed)) {
3338 if handler == nil {
3339 return
3340 }
3341 o.handlersMu.Lock()
3342 defer o.handlersMu.Unlock()
3343 o.onShape = append(o.onShape, handler)
3344}
3345
3346// handlersForShape returns the handlers registered for shape, taken
3347// under the lock so a handler may register another handler while events are
3348// being dispatched.
3349func (o *Touch) handlersForShape() []func(id int32, major wl.Fixed, minor wl.Fixed) {
3350 o.handlersMu.Lock()
3351 defer o.handlersMu.Unlock()
3352 return o.onShape
3353}
3354
3355// OnOrientation registers a handler for the orientation event.
3356//
3357// Handlers are appended, so a second call adds another handler rather than
3358// replacing the first. Registration is safe while another goroutine dispatches.
3359func (o *Touch) OnOrientation(handler func(id int32, orientation wl.Fixed)) {
3360 if handler == nil {
3361 return
3362 }
3363 o.handlersMu.Lock()
3364 defer o.handlersMu.Unlock()
3365 o.onOrientation = append(o.onOrientation, handler)
3366}
3367
3368// handlersForOrientation returns the handlers registered for orientation, taken
3369// under the lock so a handler may register another handler while events are
3370// being dispatched.
3371func (o *Touch) handlersForOrientation() []func(id int32, orientation wl.Fixed) {
3372 o.handlersMu.Lock()
3373 defer o.handlersMu.Unlock()
3374 return o.onOrientation
3375}
3376
3377// EventSignature returns the declared event argument types in wire order.
3378func (o *Touch) EventSignature(opcode uint16) (string, bool) {
3379 switch opcode {
3380 case 0:
3381 return "uint,uint,object,int,fixed,fixed,", true
3382 case 1:
3383 return "uint,uint,int,", true
3384 case 2:
3385 return "uint,int,fixed,fixed,", true
3386 case 3:
3387 return "", true
3388 case 4:
3389 return "", true
3390 case 5:
3391 return "int,fixed,fixed,", true
3392 case 6:
3393 return "int,fixed,", true
3394 default:
3395 return "", false
3396 }
3397}
3398
3399// Dispatch decodes one event on wl_touch and calls the registered handlers.
3400func (o *Touch) Dispatch(event *wl.Event) {
3401 switch event.Opcode {
3402 case 0: // down
3403 serial := event.Uint32()
3404 time := event.Uint32()
3405 surfaceID := event.Uint32()
3406 id := event.Int32()
3407 x := event.Fixed()
3408 y := event.Fixed()
3409
3410 for i, handler := range o.handlersForDown() {
3411 _ = i
3412 handler(serial, time, surfaceID, id, x, y)
3413 }
3414 case 1: // up
3415 serial := event.Uint32()
3416 time := event.Uint32()
3417 id := event.Int32()
3418
3419 for i, handler := range o.handlersForUp() {
3420 _ = i
3421 handler(serial, time, id)
3422 }
3423 case 2: // motion
3424 time := event.Uint32()
3425 id := event.Int32()
3426 x := event.Fixed()
3427 y := event.Fixed()
3428
3429 for i, handler := range o.handlersForMotion() {
3430 _ = i
3431 handler(time, id, x, y)
3432 }
3433 case 3: // frame
3434
3435 for i, handler := range o.handlersForFrame() {
3436 _ = i
3437 handler()
3438 }
3439 case 4: // cancel
3440
3441 for i, handler := range o.handlersForCancel() {
3442 _ = i
3443 handler()
3444 }
3445 case 5: // shape
3446 id := event.Int32()
3447 major := event.Fixed()
3448 minor := event.Fixed()
3449
3450 for i, handler := range o.handlersForShape() {
3451 _ = i
3452 handler(id, major, minor)
3453 }
3454 case 6: // orientation
3455 id := event.Int32()
3456 orientation := event.Fixed()
3457
3458 for i, handler := range o.handlersForOrientation() {
3459 _ = i
3460 handler(id, orientation)
3461 }
3462 default:
3463 }
3464}
3465
3466// OutputInterface is the protocol interface name.
3467const OutputInterface = "wl_output"
3468
3469// Output is the generated binding for wl_output version 4.
3470type Output struct {
3471 wl.BaseProxy
3472 // handlersMu guards the handler slices: a client may register or replace
3473 // handlers while another goroutine dispatches events.
3474 handlersMu sync.Mutex
3475 onGeometry []func(x int32, y int32, physicalWidth int32, physicalHeight int32, subpixel int32, make string, model string, transform int32)
3476 onMode []func(flags uint32, width int32, height int32, refresh int32)
3477 onDone []func()
3478 onScale []func(factor int32)
3479 onName []func(name string)
3480 onDescription []func(description string)
3481}
3482
3483// NewOutput returns an unbound Output.
3484func NewOutput(ctx *wl.Context) *Output {
3485 obj := &Output{}
3486 obj.SetContext(ctx)
3487 ctx.Register(obj)
3488 return obj
3489}
3490
3491// Using this request a client can tell the server that it is not going to use the output object anymore.
3492func (o *Output) Release() error {
3493 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_output.release", Since: 3, Destructor: true}); err != nil {
3494 return err
3495 }
3496 return nil
3497}
3498
3499// OnGeometry registers a handler for the geometry event.
3500//
3501// Handlers are appended, so a second call adds another handler rather than
3502// replacing the first. Registration is safe while another goroutine dispatches.
3503func (o *Output) OnGeometry(handler func(x int32, y int32, physicalWidth int32, physicalHeight int32, subpixel int32, make string, model string, transform int32)) {
3504 if handler == nil {
3505 return
3506 }
3507 o.handlersMu.Lock()
3508 defer o.handlersMu.Unlock()
3509 o.onGeometry = append(o.onGeometry, handler)
3510}
3511
3512// handlersForGeometry returns the handlers registered for geometry, taken
3513// under the lock so a handler may register another handler while events are
3514// being dispatched.
3515func (o *Output) handlersForGeometry() []func(x int32, y int32, physicalWidth int32, physicalHeight int32, subpixel int32, make string, model string, transform int32) {
3516 o.handlersMu.Lock()
3517 defer o.handlersMu.Unlock()
3518 return o.onGeometry
3519}
3520
3521// OnMode registers a handler for the mode event.
3522//
3523// Handlers are appended, so a second call adds another handler rather than
3524// replacing the first. Registration is safe while another goroutine dispatches.
3525func (o *Output) OnMode(handler func(flags uint32, width int32, height int32, refresh int32)) {
3526 if handler == nil {
3527 return
3528 }
3529 o.handlersMu.Lock()
3530 defer o.handlersMu.Unlock()
3531 o.onMode = append(o.onMode, handler)
3532}
3533
3534// handlersForMode returns the handlers registered for mode, taken
3535// under the lock so a handler may register another handler while events are
3536// being dispatched.
3537func (o *Output) handlersForMode() []func(flags uint32, width int32, height int32, refresh int32) {
3538 o.handlersMu.Lock()
3539 defer o.handlersMu.Unlock()
3540 return o.onMode
3541}
3542
3543// OnDone registers a handler for the done event.
3544//
3545// Handlers are appended, so a second call adds another handler rather than
3546// replacing the first. Registration is safe while another goroutine dispatches.
3547func (o *Output) OnDone(handler func()) {
3548 if handler == nil {
3549 return
3550 }
3551 o.handlersMu.Lock()
3552 defer o.handlersMu.Unlock()
3553 o.onDone = append(o.onDone, handler)
3554}
3555
3556// handlersForDone returns the handlers registered for done, taken
3557// under the lock so a handler may register another handler while events are
3558// being dispatched.
3559func (o *Output) handlersForDone() []func() {
3560 o.handlersMu.Lock()
3561 defer o.handlersMu.Unlock()
3562 return o.onDone
3563}
3564
3565// OnScale registers a handler for the scale event.
3566//
3567// Handlers are appended, so a second call adds another handler rather than
3568// replacing the first. Registration is safe while another goroutine dispatches.
3569func (o *Output) OnScale(handler func(factor int32)) {
3570 if handler == nil {
3571 return
3572 }
3573 o.handlersMu.Lock()
3574 defer o.handlersMu.Unlock()
3575 o.onScale = append(o.onScale, handler)
3576}
3577
3578// handlersForScale returns the handlers registered for scale, taken
3579// under the lock so a handler may register another handler while events are
3580// being dispatched.
3581func (o *Output) handlersForScale() []func(factor int32) {
3582 o.handlersMu.Lock()
3583 defer o.handlersMu.Unlock()
3584 return o.onScale
3585}
3586
3587// OnName registers a handler for the name event.
3588//
3589// Handlers are appended, so a second call adds another handler rather than
3590// replacing the first. Registration is safe while another goroutine dispatches.
3591func (o *Output) OnName(handler func(name string)) {
3592 if handler == nil {
3593 return
3594 }
3595 o.handlersMu.Lock()
3596 defer o.handlersMu.Unlock()
3597 o.onName = append(o.onName, handler)
3598}
3599
3600// handlersForName returns the handlers registered for name, taken
3601// under the lock so a handler may register another handler while events are
3602// being dispatched.
3603func (o *Output) handlersForName() []func(name string) {
3604 o.handlersMu.Lock()
3605 defer o.handlersMu.Unlock()
3606 return o.onName
3607}
3608
3609// OnDescription registers a handler for the description event.
3610//
3611// Handlers are appended, so a second call adds another handler rather than
3612// replacing the first. Registration is safe while another goroutine dispatches.
3613func (o *Output) OnDescription(handler func(description string)) {
3614 if handler == nil {
3615 return
3616 }
3617 o.handlersMu.Lock()
3618 defer o.handlersMu.Unlock()
3619 o.onDescription = append(o.onDescription, handler)
3620}
3621
3622// handlersForDescription returns the handlers registered for description, taken
3623// under the lock so a handler may register another handler while events are
3624// being dispatched.
3625func (o *Output) handlersForDescription() []func(description string) {
3626 o.handlersMu.Lock()
3627 defer o.handlersMu.Unlock()
3628 return o.onDescription
3629}
3630
3631// EventSignature returns the declared event argument types in wire order.
3632func (o *Output) EventSignature(opcode uint16) (string, bool) {
3633 switch opcode {
3634 case 0:
3635 return "int,int,int,int,int,string,string,int,", true
3636 case 1:
3637 return "uint,int,int,int,", true
3638 case 2:
3639 return "", true
3640 case 3:
3641 return "int,", true
3642 case 4:
3643 return "string,", true
3644 case 5:
3645 return "string,", true
3646 default:
3647 return "", false
3648 }
3649}
3650
3651// Dispatch decodes one event on wl_output and calls the registered handlers.
3652func (o *Output) Dispatch(event *wl.Event) {
3653 switch event.Opcode {
3654 case 0: // geometry
3655 x := event.Int32()
3656 y := event.Int32()
3657 physicalWidth := event.Int32()
3658 physicalHeight := event.Int32()
3659 subpixel := event.Int32()
3660 make := event.String()
3661 model := event.String()
3662 transform := event.Int32()
3663
3664 for i, handler := range o.handlersForGeometry() {
3665 _ = i
3666 handler(x, y, physicalWidth, physicalHeight, subpixel, make, model, transform)
3667 }
3668 case 1: // mode
3669 flags := event.Uint32()
3670 width := event.Int32()
3671 height := event.Int32()
3672 refresh := event.Int32()
3673
3674 for i, handler := range o.handlersForMode() {
3675 _ = i
3676 handler(flags, width, height, refresh)
3677 }
3678 case 2: // done
3679
3680 for i, handler := range o.handlersForDone() {
3681 _ = i
3682 handler()
3683 }
3684 case 3: // scale
3685 factor := event.Int32()
3686
3687 for i, handler := range o.handlersForScale() {
3688 _ = i
3689 handler(factor)
3690 }
3691 case 4: // name
3692 name := event.String()
3693
3694 for i, handler := range o.handlersForName() {
3695 _ = i
3696 handler(name)
3697 }
3698 case 5: // description
3699 description := event.String()
3700
3701 for i, handler := range o.handlersForDescription() {
3702 _ = i
3703 handler(description)
3704 }
3705 default:
3706 }
3707}
3708
3709// RegionInterface is the protocol interface name.
3710const RegionInterface = "wl_region"
3711
3712// Region is the generated binding for wl_region version 7.
3713type Region struct {
3714 wl.BaseProxy
3715}
3716
3717// NewRegion returns an unbound Region.
3718func NewRegion(ctx *wl.Context) *Region {
3719 obj := &Region{}
3720 obj.SetContext(ctx)
3721 ctx.Register(obj)
3722 return obj
3723}
3724
3725// Destroy the region. This will invalidate the object ID.
3726func (o *Region) Destroy() error {
3727 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_region.destroy", Destructor: true}); err != nil {
3728 return err
3729 }
3730 return nil
3731}
3732
3733// Add the specified rectangle to the region.
3734func (o *Region) Add(x int32, y int32, width int32, height int32) error {
3735 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_region.add"}, x, y, width, height); err != nil {
3736 return err
3737 }
3738 return nil
3739}
3740
3741// Subtract the specified rectangle from the region.
3742func (o *Region) Subtract(x int32, y int32, width int32, height int32) error {
3743 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_region.subtract"}, x, y, width, height); err != nil {
3744 return err
3745 }
3746 return nil
3747}
3748
3749// EventSignature returns the declared event argument types in wire order.
3750func (o *Region) EventSignature(opcode uint16) (string, bool) {
3751 switch opcode {
3752 default:
3753 return "", false
3754 }
3755}
3756
3757// Dispatch decodes one event on wl_region and calls the registered handlers.
3758func (o *Region) Dispatch(event *wl.Event) {
3759 switch event.Opcode {
3760 default:
3761 }
3762}
3763
3764// SubcompositorInterface is the protocol interface name.
3765const SubcompositorInterface = "wl_subcompositor"
3766
3767// Subcompositor is the generated binding for wl_subcompositor version 1.
3768type Subcompositor struct {
3769 wl.BaseProxy
3770}
3771
3772// NewSubcompositor returns an unbound Subcompositor.
3773func NewSubcompositor(ctx *wl.Context) *Subcompositor {
3774 obj := &Subcompositor{}
3775 obj.SetContext(ctx)
3776 ctx.Register(obj)
3777 return obj
3778}
3779
3780// Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wl_subsurface objects included.
3781func (o *Subcompositor) Destroy() error {
3782 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_subcompositor.destroy", Destructor: true}); err != nil {
3783 return err
3784 }
3785 return nil
3786}
3787
3788// Create a sub-surface interface for the given surface, and associate it with the given parent surface. This turns a plain wl_surface into a sub-surface. The to-be sub-surface must not already have another role, and it must not have an existing wl_subsurface object. Otherwise the bad_surface protocol error is raised. Adding sub-surfaces to a parent is a double-buffered operation on the parent (see wl_surface.commit). The effect of adding a sub-surface becomes visible on the next time the state of the parent surface is applied. The parent surface must not be one of the child surface's descendants, and the parent must be different from the child surface, otherwise the bad_parent protocol error is raised. This request modifies the behaviour of wl_surface.commit request on the sub-surface, see the documentation on wl_subsurface interface.
3789func (o *Subcompositor) GetSubsurface(surface *Surface, parent *Surface) (*Subsurface, error) {
3790 var arg1 wl.Object
3791 if surface != nil {
3792 arg1 = surface
3793 }
3794 var arg2 wl.Object
3795 if parent != nil {
3796 arg2 = parent
3797 }
3798 child := &Subsurface{}
3799 child.SetContext(o.Context())
3800 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_subcompositor.get_subsurface", Child: child}, child, arg1, arg2); err != nil {
3801 return nil, err
3802 }
3803 return child, nil
3804}
3805
3806// EventSignature returns the declared event argument types in wire order.
3807func (o *Subcompositor) EventSignature(opcode uint16) (string, bool) {
3808 switch opcode {
3809 default:
3810 return "", false
3811 }
3812}
3813
3814// Dispatch decodes one event on wl_subcompositor and calls the registered handlers.
3815func (o *Subcompositor) Dispatch(event *wl.Event) {
3816 switch event.Opcode {
3817 default:
3818 }
3819}
3820
3821// SubsurfaceInterface is the protocol interface name.
3822const SubsurfaceInterface = "wl_subsurface"
3823
3824// Subsurface is the generated binding for wl_subsurface version 1.
3825type Subsurface struct {
3826 wl.BaseProxy
3827}
3828
3829// NewSubsurface returns an unbound Subsurface.
3830func NewSubsurface(ctx *wl.Context) *Subsurface {
3831 obj := &Subsurface{}
3832 obj.SetContext(ctx)
3833 ctx.Register(obj)
3834 return obj
3835}
3836
3837// The sub-surface interface is removed from the wl_surface object that was turned into a sub-surface with a wl_subcompositor.get_subsurface request. The wl_surface's association to the parent is deleted. The wl_surface is unmapped immediately.
3838func (o *Subsurface) Destroy() error {
3839 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_subsurface.destroy", Destructor: true}); err != nil {
3840 return err
3841 }
3842 return nil
3843}
3844
3845// This sets the position of the sub-surface, relative to the parent surface. The sub-surface will be moved so that its origin (top left corner pixel) will be at the location x, y of the parent surface coordinate system. The coordinates are not restricted to the parent surface area. Negative values are allowed. The initial position is 0, 0. Position is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information.
3846func (o *Subsurface) SetPosition(x int32, y int32) error {
3847 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_subsurface.set_position"}, x, y); err != nil {
3848 return err
3849 }
3850 return nil
3851}
3852
3853// This sub-surface is taken from the stack, and put back just above the reference surface, changing the z-order of the sub-surfaces. The reference surface must be one of the sibling surfaces, or the parent surface. Using any other surface, including this sub-surface, will cause a protocol error. A new sub-surface is initially added as the top-most in the stack of its siblings and parent. Z-order is double-buffered state on the parent surface, see wl_subsurface and wl_surface.commit for more information.
3854func (o *Subsurface) PlaceAbove(sibling *Surface) error {
3855 var arg0 wl.Object
3856 if sibling != nil {
3857 arg0 = sibling
3858 }
3859 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_subsurface.place_above"}, arg0); err != nil {
3860 return err
3861 }
3862 return nil
3863}
3864
3865// The sub-surface is placed just below the reference surface. See wl_subsurface.place_above.
3866func (o *Subsurface) PlaceBelow(sibling *Surface) error {
3867 var arg0 wl.Object
3868 if sibling != nil {
3869 arg0 = sibling
3870 }
3871 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 3, Name: "wl_subsurface.place_below"}, arg0); err != nil {
3872 return err
3873 }
3874 return nil
3875}
3876
3877// Change the commit behaviour of the sub-surface to synchronized mode. See wl_subsurface and wl_surface.commit for more information.
3878func (o *Subsurface) SetSync() error {
3879 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 4, Name: "wl_subsurface.set_sync"}); err != nil {
3880 return err
3881 }
3882 return nil
3883}
3884
3885// Change the commit behaviour of the sub-surface to desynchronized mode. See wl_subsurface and wl_surface.commit for more information.
3886func (o *Subsurface) SetDesync() error {
3887 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 5, Name: "wl_subsurface.set_desync"}); err != nil {
3888 return err
3889 }
3890 return nil
3891}
3892
3893// EventSignature returns the declared event argument types in wire order.
3894func (o *Subsurface) EventSignature(opcode uint16) (string, bool) {
3895 switch opcode {
3896 default:
3897 return "", false
3898 }
3899}
3900
3901// Dispatch decodes one event on wl_subsurface and calls the registered handlers.
3902func (o *Subsurface) Dispatch(event *wl.Event) {
3903 switch event.Opcode {
3904 default:
3905 }
3906}
3907
3908// FixesInterface is the protocol interface name.
3909const FixesInterface = "wl_fixes"
3910
3911// Fixes is the generated binding for wl_fixes version 2.
3912type Fixes struct {
3913 wl.BaseProxy
3914}
3915
3916// NewFixes returns an unbound Fixes.
3917func NewFixes(ctx *wl.Context) *Fixes {
3918 obj := &Fixes{}
3919 obj.SetContext(ctx)
3920 ctx.Register(obj)
3921 return obj
3922}
3923
3924// destroys this object
3925func (o *Fixes) Destroy() error {
3926 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wl_fixes.destroy", Destructor: true}); err != nil {
3927 return err
3928 }
3929 return nil
3930}
3931
3932// This request destroys a wl_registry object. The client should no longer use the wl_registry after making this request. The compositor will emit a wl_display.delete_id event with the object ID of the registry and will no longer emit any events on the registry. The client should re-use the object ID once it receives the wl_display.delete_id event.
3933func (o *Fixes) DestroyRegistry(registry *wl.Registry) error {
3934 var arg0 wl.Object
3935 if registry != nil {
3936 arg0 = registry
3937 }
3938 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wl_fixes.destroy_registry"}, arg0); err != nil {
3939 return err
3940 }
3941 return nil
3942}
3943
3944// Acknowledge the removal of the specified global. If no global with the specified name exists or the global is not removed, the wl_fixes.invalid_ack_remove protocol error will be posted. Due to the Wayland protocol being asynchronous, the wl_global objects cannot be destroyed immediately. For example, if a wl_global is removed and a client attempts to bind that global around same time, it can result in a protocol error due to an unknown global name in the bind request. In order to avoid crashing clients, the compositor should remove the wl_global once it is guaranteed that no more bind requests will come. The wl_fixes.ack_global_remove() request is used to signal to the compositor that the client will not bind the given global anymore. After all clients acknowledge the removal of the global, the compositor can safely destroy it. The client must call the wl_fixes.ack_global_remove() request in response to a wl_registry.global_remove() event even if it did not bind the corresponding global.
3945func (o *Fixes) AckGlobalRemove(registry *wl.Registry, name uint32) error {
3946 var arg0 wl.Object
3947 if registry != nil {
3948 arg0 = registry
3949 }
3950 if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wl_fixes.ack_global_remove", Since: 2}, arg0, name); err != nil {
3951 return err
3952 }
3953 return nil
3954}
3955
3956// EventSignature returns the declared event argument types in wire order.
3957func (o *Fixes) EventSignature(opcode uint16) (string, bool) {
3958 switch opcode {
3959 default:
3960 return "", false
3961 }
3962}
3963
3964// Dispatch decodes one event on wl_fixes and calls the registered handlers.
3965func (o *Fixes) Dispatch(event *wl.Event) {
3966 switch event.Opcode {
3967 default:
3968 }
3969}