1// Code generated by wlgen; DO NOT EDIT.
2package wayland
3
4import (
5 "fmt"
6 "github.com/bnema/purego-libwayland/server"
7 "runtime"
8)
9
10var DisplayInterface *server.Interface
11var RegistryInterface *server.Interface
12var CallbackInterface *server.Interface
13var CompositorInterface *server.Interface
14var ShmPoolInterface *server.Interface
15var ShmInterface *server.Interface
16var BufferInterface *server.Interface
17var DataOfferInterface *server.Interface
18var DataSourceInterface *server.Interface
19var DataDeviceInterface *server.Interface
20var DataDeviceManagerInterface *server.Interface
21var ShellInterface *server.Interface
22var ShellSurfaceInterface *server.Interface
23var SurfaceInterface *server.Interface
24var SeatInterface *server.Interface
25var PointerInterface *server.Interface
26var KeyboardInterface *server.Interface
27var TouchInterface *server.Interface
28var OutputInterface *server.Interface
29var RegionInterface *server.Interface
30var SubcompositorInterface *server.Interface
31var SubsurfaceInterface *server.Interface
32var FixesInterface *server.Interface
33
34func init() {
35 DisplayInterface = &server.Interface{Name: "wl_display", Version: 1}
36 RegistryInterface = &server.Interface{Name: "wl_registry", Version: 1}
37 CallbackInterface = &server.Interface{Name: "wl_callback", Version: 1}
38 CompositorInterface = &server.Interface{Name: "wl_compositor", Version: 7}
39 ShmPoolInterface = &server.Interface{Name: "wl_shm_pool", Version: 3}
40 ShmInterface = &server.Interface{Name: "wl_shm", Version: 3}
41 BufferInterface = &server.Interface{Name: "wl_buffer", Version: 1}
42 DataOfferInterface = &server.Interface{Name: "wl_data_offer", Version: 4}
43 DataSourceInterface = &server.Interface{Name: "wl_data_source", Version: 4}
44 DataDeviceInterface = &server.Interface{Name: "wl_data_device", Version: 4}
45 DataDeviceManagerInterface = &server.Interface{Name: "wl_data_device_manager", Version: 4}
46 ShellInterface = &server.Interface{Name: "wl_shell", Version: 1}
47 ShellSurfaceInterface = &server.Interface{Name: "wl_shell_surface", Version: 1}
48 SurfaceInterface = &server.Interface{Name: "wl_surface", Version: 7}
49 SeatInterface = &server.Interface{Name: "wl_seat", Version: 11}
50 PointerInterface = &server.Interface{Name: "wl_pointer", Version: 11}
51 KeyboardInterface = &server.Interface{Name: "wl_keyboard", Version: 11}
52 TouchInterface = &server.Interface{Name: "wl_touch", Version: 11}
53 OutputInterface = &server.Interface{Name: "wl_output", Version: 4}
54 RegionInterface = &server.Interface{Name: "wl_region", Version: 7}
55 SubcompositorInterface = &server.Interface{Name: "wl_subcompositor", Version: 1}
56 SubsurfaceInterface = &server.Interface{Name: "wl_subsurface", Version: 1}
57 FixesInterface = &server.Interface{Name: "wl_fixes", Version: 2}
58 DisplayInterface.Requests = []server.Message{
59 {Name: "sync", Signature: "n", Types: []*server.Interface{CallbackInterface}},
60 {Name: "get_registry", Signature: "n", Types: []*server.Interface{RegistryInterface}},
61 }
62 DisplayInterface.Events = []server.Message{
63 {Name: "error", Signature: "ous", Types: []*server.Interface{nil, nil, nil}},
64 {Name: "delete_id", Signature: "u", Types: []*server.Interface{nil}},
65 }
66 RegistryInterface.Requests = []server.Message{
67 {Name: "bind", Signature: "usun", Types: []*server.Interface{nil, nil, nil, nil}},
68 }
69 RegistryInterface.Events = []server.Message{
70 {Name: "global", Signature: "usu", Types: []*server.Interface{nil, nil, nil}},
71 {Name: "global_remove", Signature: "u", Types: []*server.Interface{nil}},
72 }
73 CallbackInterface.Requests = []server.Message{}
74 CallbackInterface.Events = []server.Message{
75 {Name: "done", Signature: "u", Types: []*server.Interface{nil}},
76 }
77 CompositorInterface.Requests = []server.Message{
78 {Name: "create_surface", Signature: "n", Types: []*server.Interface{SurfaceInterface}},
79 {Name: "create_region", Signature: "n", Types: []*server.Interface{RegionInterface}},
80 {Name: "release", Signature: "7", Types: []*server.Interface{}},
81 }
82 CompositorInterface.Events = []server.Message{}
83 ShmPoolInterface.Requests = []server.Message{
84 {Name: "create_buffer", Signature: "niiiiu", Types: []*server.Interface{BufferInterface, nil, nil, nil, nil, nil}},
85 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
86 {Name: "resize", Signature: "i", Types: []*server.Interface{nil}},
87 }
88 ShmPoolInterface.Events = []server.Message{}
89 ShmInterface.Requests = []server.Message{
90 {Name: "create_pool", Signature: "nhi", Types: []*server.Interface{ShmPoolInterface, nil, nil}},
91 {Name: "release", Signature: "2", Types: []*server.Interface{}},
92 }
93 ShmInterface.Events = []server.Message{
94 {Name: "format", Signature: "u", Types: []*server.Interface{nil}},
95 }
96 BufferInterface.Requests = []server.Message{
97 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
98 }
99 BufferInterface.Events = []server.Message{
100 {Name: "release", Signature: "", Types: []*server.Interface{}},
101 }
102 DataOfferInterface.Requests = []server.Message{
103 {Name: "accept", Signature: "u?s", Types: []*server.Interface{nil, nil}},
104 {Name: "receive", Signature: "sh", Types: []*server.Interface{nil, nil}},
105 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
106 {Name: "finish", Signature: "3", Types: []*server.Interface{}},
107 {Name: "set_actions", Signature: "3uu", Types: []*server.Interface{nil, nil}},
108 }
109 DataOfferInterface.Events = []server.Message{
110 {Name: "offer", Signature: "s", Types: []*server.Interface{nil}},
111 {Name: "source_actions", Signature: "3u", Types: []*server.Interface{nil}},
112 {Name: "action", Signature: "3u", Types: []*server.Interface{nil}},
113 }
114 DataSourceInterface.Requests = []server.Message{
115 {Name: "offer", Signature: "s", Types: []*server.Interface{nil}},
116 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
117 {Name: "set_actions", Signature: "3u", Types: []*server.Interface{nil}},
118 }
119 DataSourceInterface.Events = []server.Message{
120 {Name: "target", Signature: "?s", Types: []*server.Interface{nil}},
121 {Name: "send", Signature: "sh", Types: []*server.Interface{nil, nil}},
122 {Name: "cancelled", Signature: "", Types: []*server.Interface{}},
123 {Name: "dnd_drop_performed", Signature: "3", Types: []*server.Interface{}},
124 {Name: "dnd_finished", Signature: "3", Types: []*server.Interface{}},
125 {Name: "action", Signature: "3u", Types: []*server.Interface{nil}},
126 }
127 DataDeviceInterface.Requests = []server.Message{
128 {Name: "start_drag", Signature: "?oo?ou", Types: []*server.Interface{DataSourceInterface, SurfaceInterface, SurfaceInterface, nil}},
129 {Name: "set_selection", Signature: "?ou", Types: []*server.Interface{DataSourceInterface, nil}},
130 {Name: "release", Signature: "2", Types: []*server.Interface{}},
131 }
132 DataDeviceInterface.Events = []server.Message{
133 {Name: "data_offer", Signature: "n", Types: []*server.Interface{DataOfferInterface}},
134 {Name: "enter", Signature: "uoff?o", Types: []*server.Interface{nil, SurfaceInterface, nil, nil, DataOfferInterface}},
135 {Name: "leave", Signature: "", Types: []*server.Interface{}},
136 {Name: "motion", Signature: "uff", Types: []*server.Interface{nil, nil, nil}},
137 {Name: "drop", Signature: "", Types: []*server.Interface{}},
138 {Name: "selection", Signature: "?o", Types: []*server.Interface{DataOfferInterface}},
139 }
140 DataDeviceManagerInterface.Requests = []server.Message{
141 {Name: "create_data_source", Signature: "n", Types: []*server.Interface{DataSourceInterface}},
142 {Name: "get_data_device", Signature: "no", Types: []*server.Interface{DataDeviceInterface, SeatInterface}},
143 {Name: "release", Signature: "4", Types: []*server.Interface{}},
144 }
145 DataDeviceManagerInterface.Events = []server.Message{}
146 ShellInterface.Requests = []server.Message{
147 {Name: "get_shell_surface", Signature: "no", Types: []*server.Interface{ShellSurfaceInterface, SurfaceInterface}},
148 }
149 ShellInterface.Events = []server.Message{}
150 ShellSurfaceInterface.Requests = []server.Message{
151 {Name: "pong", Signature: "u", Types: []*server.Interface{nil}},
152 {Name: "move", Signature: "ou", Types: []*server.Interface{SeatInterface, nil}},
153 {Name: "resize", Signature: "ouu", Types: []*server.Interface{SeatInterface, nil, nil}},
154 {Name: "set_toplevel", Signature: "", Types: []*server.Interface{}},
155 {Name: "set_transient", Signature: "oiiu", Types: []*server.Interface{SurfaceInterface, nil, nil, nil}},
156 {Name: "set_fullscreen", Signature: "uu?o", Types: []*server.Interface{nil, nil, OutputInterface}},
157 {Name: "set_popup", Signature: "ouoiiu", Types: []*server.Interface{SeatInterface, nil, SurfaceInterface, nil, nil, nil}},
158 {Name: "set_maximized", Signature: "?o", Types: []*server.Interface{OutputInterface}},
159 {Name: "set_title", Signature: "s", Types: []*server.Interface{nil}},
160 {Name: "set_class", Signature: "s", Types: []*server.Interface{nil}},
161 }
162 ShellSurfaceInterface.Events = []server.Message{
163 {Name: "ping", Signature: "u", Types: []*server.Interface{nil}},
164 {Name: "configure", Signature: "uii", Types: []*server.Interface{nil, nil, nil}},
165 {Name: "popup_done", Signature: "", Types: []*server.Interface{}},
166 }
167 SurfaceInterface.Requests = []server.Message{
168 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
169 {Name: "attach", Signature: "?oii", Types: []*server.Interface{BufferInterface, nil, nil}},
170 {Name: "damage", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}},
171 {Name: "frame", Signature: "n", Types: []*server.Interface{CallbackInterface}},
172 {Name: "set_opaque_region", Signature: "?o", Types: []*server.Interface{RegionInterface}},
173 {Name: "set_input_region", Signature: "?o", Types: []*server.Interface{RegionInterface}},
174 {Name: "commit", Signature: "", Types: []*server.Interface{}},
175 {Name: "set_buffer_transform", Signature: "2i", Types: []*server.Interface{nil}},
176 {Name: "set_buffer_scale", Signature: "3i", Types: []*server.Interface{nil}},
177 {Name: "damage_buffer", Signature: "4iiii", Types: []*server.Interface{nil, nil, nil, nil}},
178 {Name: "offset", Signature: "5ii", Types: []*server.Interface{nil, nil}},
179 {Name: "get_release", Signature: "7n", Types: []*server.Interface{CallbackInterface}},
180 }
181 SurfaceInterface.Events = []server.Message{
182 {Name: "enter", Signature: "o", Types: []*server.Interface{OutputInterface}},
183 {Name: "leave", Signature: "o", Types: []*server.Interface{OutputInterface}},
184 {Name: "preferred_buffer_scale", Signature: "6i", Types: []*server.Interface{nil}},
185 {Name: "preferred_buffer_transform", Signature: "6u", Types: []*server.Interface{nil}},
186 }
187 SeatInterface.Requests = []server.Message{
188 {Name: "get_pointer", Signature: "n", Types: []*server.Interface{PointerInterface}},
189 {Name: "get_keyboard", Signature: "n", Types: []*server.Interface{KeyboardInterface}},
190 {Name: "get_touch", Signature: "n", Types: []*server.Interface{TouchInterface}},
191 {Name: "release", Signature: "5", Types: []*server.Interface{}},
192 }
193 SeatInterface.Events = []server.Message{
194 {Name: "capabilities", Signature: "u", Types: []*server.Interface{nil}},
195 {Name: "name", Signature: "2s", Types: []*server.Interface{nil}},
196 }
197 PointerInterface.Requests = []server.Message{
198 {Name: "set_cursor", Signature: "u?oii", Types: []*server.Interface{nil, SurfaceInterface, nil, nil}},
199 {Name: "release", Signature: "3", Types: []*server.Interface{}},
200 }
201 PointerInterface.Events = []server.Message{
202 {Name: "enter", Signature: "uoff", Types: []*server.Interface{nil, SurfaceInterface, nil, nil}},
203 {Name: "leave", Signature: "uo", Types: []*server.Interface{nil, SurfaceInterface}},
204 {Name: "motion", Signature: "uff", Types: []*server.Interface{nil, nil, nil}},
205 {Name: "button", Signature: "uuuu", Types: []*server.Interface{nil, nil, nil, nil}},
206 {Name: "axis", Signature: "uuf", Types: []*server.Interface{nil, nil, nil}},
207 {Name: "frame", Signature: "5", Types: []*server.Interface{}},
208 {Name: "axis_source", Signature: "5u", Types: []*server.Interface{nil}},
209 {Name: "axis_stop", Signature: "5uu", Types: []*server.Interface{nil, nil}},
210 {Name: "axis_discrete", Signature: "5ui", Types: []*server.Interface{nil, nil}},
211 {Name: "axis_value120", Signature: "8ui", Types: []*server.Interface{nil, nil}},
212 {Name: "axis_relative_direction", Signature: "9uu", Types: []*server.Interface{nil, nil}},
213 {Name: "warp", Signature: "11ff", Types: []*server.Interface{nil, nil}},
214 }
215 KeyboardInterface.Requests = []server.Message{
216 {Name: "release", Signature: "3", Types: []*server.Interface{}},
217 }
218 KeyboardInterface.Events = []server.Message{
219 {Name: "keymap", Signature: "uhu", Types: []*server.Interface{nil, nil, nil}},
220 {Name: "enter", Signature: "uoa", Types: []*server.Interface{nil, SurfaceInterface, nil}},
221 {Name: "leave", Signature: "uo", Types: []*server.Interface{nil, SurfaceInterface}},
222 {Name: "key", Signature: "uuuu", Types: []*server.Interface{nil, nil, nil, nil}},
223 {Name: "modifiers", Signature: "uuuuu", Types: []*server.Interface{nil, nil, nil, nil, nil}},
224 {Name: "repeat_info", Signature: "4ii", Types: []*server.Interface{nil, nil}},
225 }
226 TouchInterface.Requests = []server.Message{
227 {Name: "release", Signature: "3", Types: []*server.Interface{}},
228 }
229 TouchInterface.Events = []server.Message{
230 {Name: "down", Signature: "uuoiff", Types: []*server.Interface{nil, nil, SurfaceInterface, nil, nil, nil}},
231 {Name: "up", Signature: "uui", Types: []*server.Interface{nil, nil, nil}},
232 {Name: "motion", Signature: "uiff", Types: []*server.Interface{nil, nil, nil, nil}},
233 {Name: "frame", Signature: "", Types: []*server.Interface{}},
234 {Name: "cancel", Signature: "", Types: []*server.Interface{}},
235 {Name: "shape", Signature: "6iff", Types: []*server.Interface{nil, nil, nil}},
236 {Name: "orientation", Signature: "6if", Types: []*server.Interface{nil, nil}},
237 }
238 OutputInterface.Requests = []server.Message{
239 {Name: "release", Signature: "3", Types: []*server.Interface{}},
240 }
241 OutputInterface.Events = []server.Message{
242 {Name: "geometry", Signature: "iiiiissi", Types: []*server.Interface{nil, nil, nil, nil, nil, nil, nil, nil}},
243 {Name: "mode", Signature: "uiii", Types: []*server.Interface{nil, nil, nil, nil}},
244 {Name: "done", Signature: "2", Types: []*server.Interface{}},
245 {Name: "scale", Signature: "2i", Types: []*server.Interface{nil}},
246 {Name: "name", Signature: "4s", Types: []*server.Interface{nil}},
247 {Name: "description", Signature: "4s", Types: []*server.Interface{nil}},
248 }
249 RegionInterface.Requests = []server.Message{
250 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
251 {Name: "add", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}},
252 {Name: "subtract", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}},
253 }
254 RegionInterface.Events = []server.Message{}
255 SubcompositorInterface.Requests = []server.Message{
256 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
257 {Name: "get_subsurface", Signature: "noo", Types: []*server.Interface{SubsurfaceInterface, SurfaceInterface, SurfaceInterface}},
258 }
259 SubcompositorInterface.Events = []server.Message{}
260 SubsurfaceInterface.Requests = []server.Message{
261 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
262 {Name: "set_position", Signature: "ii", Types: []*server.Interface{nil, nil}},
263 {Name: "place_above", Signature: "o", Types: []*server.Interface{SurfaceInterface}},
264 {Name: "place_below", Signature: "o", Types: []*server.Interface{SurfaceInterface}},
265 {Name: "set_sync", Signature: "", Types: []*server.Interface{}},
266 {Name: "set_desync", Signature: "", Types: []*server.Interface{}},
267 }
268 SubsurfaceInterface.Events = []server.Message{}
269 FixesInterface.Requests = []server.Message{
270 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
271 {Name: "destroy_registry", Signature: "o", Types: []*server.Interface{RegistryInterface}},
272 {Name: "ack_global_remove", Signature: "2ou", Types: []*server.Interface{RegistryInterface, nil}},
273 }
274 FixesInterface.Events = []server.Message{}
275 if err := server.NewInterfaces(DisplayInterface, RegistryInterface, CallbackInterface, CompositorInterface, ShmPoolInterface, ShmInterface, BufferInterface, DataOfferInterface, DataSourceInterface, DataDeviceInterface, DataDeviceManagerInterface, ShellInterface, ShellSurfaceInterface, SurfaceInterface, SeatInterface, PointerInterface, KeyboardInterface, TouchInterface, OutputInterface, RegionInterface, SubcompositorInterface, SubsurfaceInterface, FixesInterface); err != nil {
276 panic(err)
277 }
278}
279
280// Display core global object.
281type Display struct{ *server.Resource }
282
283func WrapDisplay(r *server.Resource) *Display {
284 if r == nil {
285 return nil
286 }
287 return &Display{r}
288}
289
290const DisplayRequestSync uint32 = 0
291const DisplayRequestGetRegistry uint32 = 1
292const DisplayEventError uint32 = 0
293const DisplayEventDeleteId uint32 = 1
294
295// DisplayError global error values.
296type DisplayError uint32
297
298const (
299 DisplayErrorInvalidObject DisplayError = 0
300 DisplayErrorInvalidMethod DisplayError = 1
301 DisplayErrorNoMemory DisplayError = 2
302 DisplayErrorImplementation DisplayError = 3
303)
304
305// DisplayHandler handles wl_display requests.
306type DisplayHandler interface {
307 Sync(self *Display, callback uint32)
308 GetRegistry(self *Display, registry uint32)
309}
310
311func NewDisplay(c server.Client, version int32, id uint32, h DisplayHandler) (*Display, error) {
312 if h == nil {
313 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_display")
314 }
315 var self *Display
316 r, err := c.CreateResource(DisplayInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
317 switch opcode {
318 case 0:
319 h.Sync(self, args[0].NewID())
320 case 1:
321 h.GetRegistry(self, args[0].NewID())
322 }
323 })
324 if err != nil {
325 return nil, err
326 }
327 self = WrapDisplay(r)
328 r.Data = self
329 return self, nil
330}
331
332// SendError fatal error event.
333func (self *Display) SendError(objectId *server.Resource, code uint32, message string) {
334 var p runtime.Pinner
335 defer p.Unpin()
336 self.PostEvent(DisplayEventError, server.Object(objectId), server.Uint(code), server.String(&p, message, false))
337}
338
339// SendDeleteId acknowledge object ID deletion.
340func (self *Display) SendDeleteId(id uint32) {
341 self.PostEvent(DisplayEventDeleteId, server.Uint(id))
342}
343func NewDisplayGlobal(d *server.Display, version int32, bind server.BindFunc) error {
344 return d.CreateGlobal(DisplayInterface, version, bind)
345}
346
347// Registry global registry object.
348type Registry struct{ *server.Resource }
349
350func WrapRegistry(r *server.Resource) *Registry {
351 if r == nil {
352 return nil
353 }
354 return &Registry{r}
355}
356
357const RegistryRequestBind uint32 = 0
358const RegistryEventGlobal uint32 = 0
359const RegistryEventGlobalRemove uint32 = 1
360
361// RegistryHandler handles wl_registry requests.
362type RegistryHandler interface {
363 Bind(self *Registry, name uint32, interfaceName string, version uint32, id uint32)
364}
365
366func NewRegistry(c server.Client, version int32, id uint32, h RegistryHandler) (*Registry, error) {
367 if h == nil {
368 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_registry")
369 }
370 var self *Registry
371 r, err := c.CreateResource(RegistryInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
372 switch opcode {
373 case 0:
374 h.Bind(self, args[0].Uint(), args[1].String(), args[2].Uint(), args[3].NewID())
375 }
376 })
377 if err != nil {
378 return nil, err
379 }
380 self = WrapRegistry(r)
381 r.Data = self
382 return self, nil
383}
384
385// SendGlobal announce global object.
386func (self *Registry) SendGlobal(name uint32, interfaceArg string, version uint32) {
387 var p runtime.Pinner
388 defer p.Unpin()
389 self.PostEvent(RegistryEventGlobal, server.Uint(name), server.String(&p, interfaceArg, false), server.Uint(version))
390}
391
392// SendGlobalRemove announce removal of global object.
393func (self *Registry) SendGlobalRemove(name uint32) {
394 self.PostEvent(RegistryEventGlobalRemove, server.Uint(name))
395}
396func NewRegistryGlobal(d *server.Display, version int32, bind server.BindFunc) error {
397 return d.CreateGlobal(RegistryInterface, version, bind)
398}
399
400// Callback callback object.
401type Callback struct{ *server.Resource }
402
403func WrapCallback(r *server.Resource) *Callback {
404 if r == nil {
405 return nil
406 }
407 return &Callback{r}
408}
409
410const CallbackEventDone uint32 = 0
411
412// CallbackHandler handles wl_callback requests.
413type CallbackHandler interface {
414}
415
416func NewCallback(c server.Client, version int32, id uint32, h CallbackHandler) (*Callback, error) {
417 var self *Callback
418 r, err := c.CreateResource(CallbackInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
419 switch opcode {
420 }
421 })
422 if err != nil {
423 return nil, err
424 }
425 self = WrapCallback(r)
426 r.Data = self
427 return self, nil
428}
429
430// SendDone done event.
431func (self *Callback) SendDone(callbackData uint32) {
432 self.PostEvent(CallbackEventDone, server.Uint(callbackData))
433}
434func NewCallbackGlobal(d *server.Display, version int32, bind server.BindFunc) error {
435 return d.CreateGlobal(CallbackInterface, version, bind)
436}
437
438// Compositor the compositor singleton.
439type Compositor struct{ *server.Resource }
440
441func WrapCompositor(r *server.Resource) *Compositor {
442 if r == nil {
443 return nil
444 }
445 return &Compositor{r}
446}
447
448const CompositorRequestCreateSurface uint32 = 0
449const CompositorRequestCreateRegion uint32 = 1
450const CompositorRequestRelease uint32 = 2
451
452// CompositorHandler handles wl_compositor requests.
453type CompositorHandler interface {
454 CreateSurface(self *Compositor, id uint32)
455 CreateRegion(self *Compositor, id uint32)
456 Release(self *Compositor)
457}
458
459func NewCompositor(c server.Client, version int32, id uint32, h CompositorHandler) (*Compositor, error) {
460 if h == nil {
461 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_compositor")
462 }
463 var self *Compositor
464 r, err := c.CreateResource(CompositorInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
465 switch opcode {
466 case 0:
467 h.CreateSurface(self, args[0].NewID())
468 case 1:
469 h.CreateRegion(self, args[0].NewID())
470 case 2:
471 h.Release(self)
472 self.Destroy()
473 }
474 })
475 if err != nil {
476 return nil, err
477 }
478 self = WrapCompositor(r)
479 r.Data = self
480 return self, nil
481}
482func NewCompositorGlobal(d *server.Display, version int32, bind server.BindFunc) error {
483 return d.CreateGlobal(CompositorInterface, version, bind)
484}
485
486// ShmPool a shared memory pool.
487type ShmPool struct{ *server.Resource }
488
489func WrapShmPool(r *server.Resource) *ShmPool {
490 if r == nil {
491 return nil
492 }
493 return &ShmPool{r}
494}
495
496const ShmPoolRequestCreateBuffer uint32 = 0
497const ShmPoolRequestDestroy uint32 = 1
498const ShmPoolRequestResize uint32 = 2
499
500// ShmPoolError wl_shm_pool error values.
501type ShmPoolError uint32
502
503const (
504 ShmPoolErrorInvalidFormat ShmPoolError = 0
505 ShmPoolErrorInvalidStride ShmPoolError = 1
506)
507
508// ShmPoolHandler handles wl_shm_pool requests.
509type ShmPoolHandler interface {
510 CreateBuffer(self *ShmPool, id uint32, offset int32, width int32, height int32, stride int32, format uint32)
511 Destroy(self *ShmPool)
512 Resize(self *ShmPool, size int32)
513}
514
515func NewShmPool(c server.Client, version int32, id uint32, h ShmPoolHandler) (*ShmPool, error) {
516 if h == nil {
517 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_shm_pool")
518 }
519 var self *ShmPool
520 r, err := c.CreateResource(ShmPoolInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
521 switch opcode {
522 case 0:
523 h.CreateBuffer(self, args[0].NewID(), args[1].Int(), args[2].Int(), args[3].Int(), args[4].Int(), args[5].Uint())
524 case 1:
525 h.Destroy(self)
526 self.Destroy()
527 case 2:
528 h.Resize(self, args[0].Int())
529 }
530 })
531 if err != nil {
532 return nil, err
533 }
534 self = WrapShmPool(r)
535 r.Data = self
536 return self, nil
537}
538func NewShmPoolGlobal(d *server.Display, version int32, bind server.BindFunc) error {
539 return d.CreateGlobal(ShmPoolInterface, version, bind)
540}
541
542// Shm shared memory support.
543type Shm struct{ *server.Resource }
544
545func WrapShm(r *server.Resource) *Shm {
546 if r == nil {
547 return nil
548 }
549 return &Shm{r}
550}
551
552const ShmRequestCreatePool uint32 = 0
553const ShmRequestRelease uint32 = 1
554const ShmEventFormat uint32 = 0
555
556// ShmError wl_shm error values.
557type ShmError uint32
558
559const (
560 ShmErrorInvalidFormat ShmError = 0
561 ShmErrorInvalidStride ShmError = 1
562 ShmErrorInvalidFd ShmError = 2
563)
564
565// ShmFormat pixel formats.
566type ShmFormat uint32
567
568const (
569 ShmFormatArgb8888 ShmFormat = 0
570 ShmFormatXrgb8888 ShmFormat = 1
571 ShmFormatC8 ShmFormat = 0x20203843
572 ShmFormatRgb332 ShmFormat = 0x38424752
573 ShmFormatBgr233 ShmFormat = 0x38524742
574 ShmFormatXrgb4444 ShmFormat = 0x32315258
575 ShmFormatXbgr4444 ShmFormat = 0x32314258
576 ShmFormatRgbx4444 ShmFormat = 0x32315852
577 ShmFormatBgrx4444 ShmFormat = 0x32315842
578 ShmFormatArgb4444 ShmFormat = 0x32315241
579 ShmFormatAbgr4444 ShmFormat = 0x32314241
580 ShmFormatRgba4444 ShmFormat = 0x32314152
581 ShmFormatBgra4444 ShmFormat = 0x32314142
582 ShmFormatXrgb1555 ShmFormat = 0x35315258
583 ShmFormatXbgr1555 ShmFormat = 0x35314258
584 ShmFormatRgbx5551 ShmFormat = 0x35315852
585 ShmFormatBgrx5551 ShmFormat = 0x35315842
586 ShmFormatArgb1555 ShmFormat = 0x35315241
587 ShmFormatAbgr1555 ShmFormat = 0x35314241
588 ShmFormatRgba5551 ShmFormat = 0x35314152
589 ShmFormatBgra5551 ShmFormat = 0x35314142
590 ShmFormatRgb565 ShmFormat = 0x36314752
591 ShmFormatBgr565 ShmFormat = 0x36314742
592 ShmFormatRgb888 ShmFormat = 0x34324752
593 ShmFormatBgr888 ShmFormat = 0x34324742
594 ShmFormatXbgr8888 ShmFormat = 0x34324258
595 ShmFormatRgbx8888 ShmFormat = 0x34325852
596 ShmFormatBgrx8888 ShmFormat = 0x34325842
597 ShmFormatAbgr8888 ShmFormat = 0x34324241
598 ShmFormatRgba8888 ShmFormat = 0x34324152
599 ShmFormatBgra8888 ShmFormat = 0x34324142
600 ShmFormatXrgb2101010 ShmFormat = 0x30335258
601 ShmFormatXbgr2101010 ShmFormat = 0x30334258
602 ShmFormatRgbx1010102 ShmFormat = 0x30335852
603 ShmFormatBgrx1010102 ShmFormat = 0x30335842
604 ShmFormatArgb2101010 ShmFormat = 0x30335241
605 ShmFormatAbgr2101010 ShmFormat = 0x30334241
606 ShmFormatRgba1010102 ShmFormat = 0x30334152
607 ShmFormatBgra1010102 ShmFormat = 0x30334142
608 ShmFormatYuyv ShmFormat = 0x56595559
609 ShmFormatYvyu ShmFormat = 0x55595659
610 ShmFormatUyvy ShmFormat = 0x59565955
611 ShmFormatVyuy ShmFormat = 0x59555956
612 ShmFormatAyuv ShmFormat = 0x56555941
613 ShmFormatNv12 ShmFormat = 0x3231564e
614 ShmFormatNv21 ShmFormat = 0x3132564e
615 ShmFormatNv16 ShmFormat = 0x3631564e
616 ShmFormatNv61 ShmFormat = 0x3136564e
617 ShmFormatYuv410 ShmFormat = 0x39565559
618 ShmFormatYvu410 ShmFormat = 0x39555659
619 ShmFormatYuv411 ShmFormat = 0x31315559
620 ShmFormatYvu411 ShmFormat = 0x31315659
621 ShmFormatYuv420 ShmFormat = 0x32315559
622 ShmFormatYvu420 ShmFormat = 0x32315659
623 ShmFormatYuv422 ShmFormat = 0x36315559
624 ShmFormatYvu422 ShmFormat = 0x36315659
625 ShmFormatYuv444 ShmFormat = 0x34325559
626 ShmFormatYvu444 ShmFormat = 0x34325659
627 ShmFormatR8 ShmFormat = 0x20203852
628 ShmFormatR16 ShmFormat = 0x20363152
629 ShmFormatRg88 ShmFormat = 0x38384752
630 ShmFormatGr88 ShmFormat = 0x38385247
631 ShmFormatRg1616 ShmFormat = 0x32334752
632 ShmFormatGr1616 ShmFormat = 0x32335247
633 ShmFormatXrgb16161616f ShmFormat = 0x48345258
634 ShmFormatXbgr16161616f ShmFormat = 0x48344258
635 ShmFormatArgb16161616f ShmFormat = 0x48345241
636 ShmFormatAbgr16161616f ShmFormat = 0x48344241
637 ShmFormatXyuv8888 ShmFormat = 0x56555958
638 ShmFormatVuy888 ShmFormat = 0x34325556
639 ShmFormatVuy101010 ShmFormat = 0x30335556
640 ShmFormatY210 ShmFormat = 0x30313259
641 ShmFormatY212 ShmFormat = 0x32313259
642 ShmFormatY216 ShmFormat = 0x36313259
643 ShmFormatY410 ShmFormat = 0x30313459
644 ShmFormatY412 ShmFormat = 0x32313459
645 ShmFormatY416 ShmFormat = 0x36313459
646 ShmFormatXvyu2101010 ShmFormat = 0x30335658
647 ShmFormatXvyu1216161616 ShmFormat = 0x36335658
648 ShmFormatXvyu16161616 ShmFormat = 0x38345658
649 ShmFormatY0l0 ShmFormat = 0x304c3059
650 ShmFormatX0l0 ShmFormat = 0x304c3058
651 ShmFormatY0l2 ShmFormat = 0x324c3059
652 ShmFormatX0l2 ShmFormat = 0x324c3058
653 ShmFormatYuv4208bit ShmFormat = 0x38305559
654 ShmFormatYuv42010bit ShmFormat = 0x30315559
655 ShmFormatXrgb8888A8 ShmFormat = 0x38415258
656 ShmFormatXbgr8888A8 ShmFormat = 0x38414258
657 ShmFormatRgbx8888A8 ShmFormat = 0x38415852
658 ShmFormatBgrx8888A8 ShmFormat = 0x38415842
659 ShmFormatRgb888A8 ShmFormat = 0x38413852
660 ShmFormatBgr888A8 ShmFormat = 0x38413842
661 ShmFormatRgb565A8 ShmFormat = 0x38413552
662 ShmFormatBgr565A8 ShmFormat = 0x38413542
663 ShmFormatNv24 ShmFormat = 0x3432564e
664 ShmFormatNv42 ShmFormat = 0x3234564e
665 ShmFormatP210 ShmFormat = 0x30313250
666 ShmFormatP010 ShmFormat = 0x30313050
667 ShmFormatP012 ShmFormat = 0x32313050
668 ShmFormatP016 ShmFormat = 0x36313050
669 ShmFormatAxbxgxrx106106106106 ShmFormat = 0x30314241
670 ShmFormatNv15 ShmFormat = 0x3531564e
671 ShmFormatQ410 ShmFormat = 0x30313451
672 ShmFormatQ401 ShmFormat = 0x31303451
673 ShmFormatXrgb16161616 ShmFormat = 0x38345258
674 ShmFormatXbgr16161616 ShmFormat = 0x38344258
675 ShmFormatArgb16161616 ShmFormat = 0x38345241
676 ShmFormatAbgr16161616 ShmFormat = 0x38344241
677 ShmFormatC1 ShmFormat = 0x20203143
678 ShmFormatC2 ShmFormat = 0x20203243
679 ShmFormatC4 ShmFormat = 0x20203443
680 ShmFormatD1 ShmFormat = 0x20203144
681 ShmFormatD2 ShmFormat = 0x20203244
682 ShmFormatD4 ShmFormat = 0x20203444
683 ShmFormatD8 ShmFormat = 0x20203844
684 ShmFormatR1 ShmFormat = 0x20203152
685 ShmFormatR2 ShmFormat = 0x20203252
686 ShmFormatR4 ShmFormat = 0x20203452
687 ShmFormatR10 ShmFormat = 0x20303152
688 ShmFormatR12 ShmFormat = 0x20323152
689 ShmFormatAvuy8888 ShmFormat = 0x59555641
690 ShmFormatXvuy8888 ShmFormat = 0x59555658
691 ShmFormatP030 ShmFormat = 0x30333050
692 ShmFormatRgb161616 ShmFormat = 0x38344752
693 ShmFormatBgr161616 ShmFormat = 0x38344742
694 ShmFormatR16f ShmFormat = 0x48202052
695 ShmFormatGr1616f ShmFormat = 0x48205247
696 ShmFormatBgr161616f ShmFormat = 0x48524742
697 ShmFormatR32f ShmFormat = 0x46202052
698 ShmFormatGr3232f ShmFormat = 0x46205247
699 ShmFormatBgr323232f ShmFormat = 0x46524742
700 ShmFormatAbgr32323232f ShmFormat = 0x46384241
701 ShmFormatNv20 ShmFormat = 0x3032564e
702 ShmFormatNv30 ShmFormat = 0x3033564e
703 ShmFormatS010 ShmFormat = 0x30313053
704 ShmFormatS210 ShmFormat = 0x30313253
705 ShmFormatS410 ShmFormat = 0x30313453
706 ShmFormatS012 ShmFormat = 0x32313053
707 ShmFormatS212 ShmFormat = 0x32313253
708 ShmFormatS412 ShmFormat = 0x32313453
709 ShmFormatS016 ShmFormat = 0x36313053
710 ShmFormatS216 ShmFormat = 0x36313253
711 ShmFormatS416 ShmFormat = 0x36313453
712 ShmFormatXvuy2101010 ShmFormat = 0x30335958
713 ShmFormatP230 ShmFormat = 0x30333250
714 ShmFormatT430 ShmFormat = 0x30333454
715 ShmFormatY8 ShmFormat = 0x59455247
716 ShmFormatXyyy2101010 ShmFormat = 0x34415059
717)
718
719// ShmHandler handles wl_shm requests.
720type ShmHandler interface {
721 CreatePool(self *Shm, id uint32, fd int, size int32)
722 Release(self *Shm)
723}
724
725func NewShm(c server.Client, version int32, id uint32, h ShmHandler) (*Shm, error) {
726 if h == nil {
727 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_shm")
728 }
729 var self *Shm
730 r, err := c.CreateResource(ShmInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
731 switch opcode {
732 case 0:
733 h.CreatePool(self, args[0].NewID(), args[1].Fd(), args[2].Int())
734 case 1:
735 h.Release(self)
736 self.Destroy()
737 }
738 })
739 if err != nil {
740 return nil, err
741 }
742 self = WrapShm(r)
743 r.Data = self
744 return self, nil
745}
746
747// SendFormat pixel format description.
748func (self *Shm) SendFormat(format uint32) {
749 self.PostEvent(ShmEventFormat, server.Uint(format))
750}
751func NewShmGlobal(d *server.Display, version int32, bind server.BindFunc) error {
752 return d.CreateGlobal(ShmInterface, version, bind)
753}
754
755// Buffer content for a wl_surface.
756type Buffer struct{ *server.Resource }
757
758func WrapBuffer(r *server.Resource) *Buffer {
759 if r == nil {
760 return nil
761 }
762 return &Buffer{r}
763}
764
765const BufferRequestDestroy uint32 = 0
766const BufferEventRelease uint32 = 0
767
768// BufferHandler handles wl_buffer requests.
769type BufferHandler interface {
770 Destroy(self *Buffer)
771}
772
773func NewBuffer(c server.Client, version int32, id uint32, h BufferHandler) (*Buffer, error) {
774 if h == nil {
775 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_buffer")
776 }
777 var self *Buffer
778 r, err := c.CreateResource(BufferInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
779 switch opcode {
780 case 0:
781 h.Destroy(self)
782 self.Destroy()
783 }
784 })
785 if err != nil {
786 return nil, err
787 }
788 self = WrapBuffer(r)
789 r.Data = self
790 return self, nil
791}
792
793// SendRelease compositor releases buffer.
794func (self *Buffer) SendRelease() {
795 self.PostEvent(BufferEventRelease)
796}
797func NewBufferGlobal(d *server.Display, version int32, bind server.BindFunc) error {
798 return d.CreateGlobal(BufferInterface, version, bind)
799}
800
801// DataOffer offer to transfer data.
802type DataOffer struct{ *server.Resource }
803
804func WrapDataOffer(r *server.Resource) *DataOffer {
805 if r == nil {
806 return nil
807 }
808 return &DataOffer{r}
809}
810
811const DataOfferRequestAccept uint32 = 0
812const DataOfferRequestReceive uint32 = 1
813const DataOfferRequestDestroy uint32 = 2
814const DataOfferRequestFinish uint32 = 3
815const DataOfferRequestSetActions uint32 = 4
816const DataOfferEventOffer uint32 = 0
817const DataOfferEventSourceActions uint32 = 1
818const DataOfferEventAction uint32 = 2
819
820// DataOfferError .
821type DataOfferError uint32
822
823const (
824 DataOfferErrorInvalidFinish DataOfferError = 0
825 DataOfferErrorInvalidActionMask DataOfferError = 1
826 DataOfferErrorInvalidAction DataOfferError = 2
827 DataOfferErrorInvalidOffer DataOfferError = 3
828)
829
830// DataOfferHandler handles wl_data_offer requests.
831type DataOfferHandler interface {
832 Accept(self *DataOffer, serial uint32, mimeType string)
833 Receive(self *DataOffer, mimeType string, fd int)
834 Destroy(self *DataOffer)
835 Finish(self *DataOffer)
836 SetActions(self *DataOffer, dndActions uint32, preferredAction uint32)
837}
838
839func NewDataOffer(c server.Client, version int32, id uint32, h DataOfferHandler) (*DataOffer, error) {
840 if h == nil {
841 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_data_offer")
842 }
843 var self *DataOffer
844 r, err := c.CreateResource(DataOfferInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
845 switch opcode {
846 case 0:
847 h.Accept(self, args[0].Uint(), args[1].String())
848 case 1:
849 h.Receive(self, args[0].String(), args[1].Fd())
850 case 2:
851 h.Destroy(self)
852 self.Destroy()
853 case 3:
854 h.Finish(self)
855 case 4:
856 h.SetActions(self, args[0].Uint(), args[1].Uint())
857 }
858 })
859 if err != nil {
860 return nil, err
861 }
862 self = WrapDataOffer(r)
863 r.Data = self
864 return self, nil
865}
866
867// SendOffer advertise offered mime type.
868func (self *DataOffer) SendOffer(mimeType string) {
869 var p runtime.Pinner
870 defer p.Unpin()
871 self.PostEvent(DataOfferEventOffer, server.String(&p, mimeType, false))
872}
873
874// SendSourceActions notify the source-side available actions (since version 3).
875func (self *DataOffer) SendSourceActions(sourceActions uint32) {
876 self.PostEvent(DataOfferEventSourceActions, server.Uint(sourceActions))
877}
878
879// SendAction notify the selected action (since version 3).
880func (self *DataOffer) SendAction(dndAction uint32) {
881 self.PostEvent(DataOfferEventAction, server.Uint(dndAction))
882}
883func NewDataOfferGlobal(d *server.Display, version int32, bind server.BindFunc) error {
884 return d.CreateGlobal(DataOfferInterface, version, bind)
885}
886
887// DataSource offer to transfer data.
888type DataSource struct{ *server.Resource }
889
890func WrapDataSource(r *server.Resource) *DataSource {
891 if r == nil {
892 return nil
893 }
894 return &DataSource{r}
895}
896
897const DataSourceRequestOffer uint32 = 0
898const DataSourceRequestDestroy uint32 = 1
899const DataSourceRequestSetActions uint32 = 2
900const DataSourceEventTarget uint32 = 0
901const DataSourceEventSend uint32 = 1
902const DataSourceEventCancelled uint32 = 2
903const DataSourceEventDndDropPerformed uint32 = 3
904const DataSourceEventDndFinished uint32 = 4
905const DataSourceEventAction uint32 = 5
906
907// DataSourceError .
908type DataSourceError uint32
909
910const (
911 DataSourceErrorInvalidActionMask DataSourceError = 0
912 DataSourceErrorInvalidSource DataSourceError = 1
913)
914
915// DataSourceHandler handles wl_data_source requests.
916type DataSourceHandler interface {
917 Offer(self *DataSource, mimeType string)
918 Destroy(self *DataSource)
919 SetActions(self *DataSource, dndActions uint32)
920}
921
922func NewDataSource(c server.Client, version int32, id uint32, h DataSourceHandler) (*DataSource, error) {
923 if h == nil {
924 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_data_source")
925 }
926 var self *DataSource
927 r, err := c.CreateResource(DataSourceInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
928 switch opcode {
929 case 0:
930 h.Offer(self, args[0].String())
931 case 1:
932 h.Destroy(self)
933 self.Destroy()
934 case 2:
935 h.SetActions(self, args[0].Uint())
936 }
937 })
938 if err != nil {
939 return nil, err
940 }
941 self = WrapDataSource(r)
942 r.Data = self
943 return self, nil
944}
945
946// SendTarget a target accepts an offered mime type.
947func (self *DataSource) SendTarget(mimeType string) {
948 var p runtime.Pinner
949 defer p.Unpin()
950 self.PostEvent(DataSourceEventTarget, server.String(&p, mimeType, true))
951}
952
953// SendSend send the data.
954func (self *DataSource) SendSend(mimeType string, fd int) {
955 var p runtime.Pinner
956 defer p.Unpin()
957 self.PostEvent(DataSourceEventSend, server.String(&p, mimeType, false), server.Fd(fd))
958}
959
960// SendCancelled selection was cancelled.
961func (self *DataSource) SendCancelled() {
962 self.PostEvent(DataSourceEventCancelled)
963}
964
965// SendDndDropPerformed the drag-and-drop operation physically finished (since version 3).
966func (self *DataSource) SendDndDropPerformed() {
967 self.PostEvent(DataSourceEventDndDropPerformed)
968}
969
970// SendDndFinished the drag-and-drop operation concluded (since version 3).
971func (self *DataSource) SendDndFinished() {
972 self.PostEvent(DataSourceEventDndFinished)
973}
974
975// SendAction notify the selected action (since version 3).
976func (self *DataSource) SendAction(dndAction uint32) {
977 self.PostEvent(DataSourceEventAction, server.Uint(dndAction))
978}
979func NewDataSourceGlobal(d *server.Display, version int32, bind server.BindFunc) error {
980 return d.CreateGlobal(DataSourceInterface, version, bind)
981}
982
983// DataDevice data transfer device.
984type DataDevice struct{ *server.Resource }
985
986func WrapDataDevice(r *server.Resource) *DataDevice {
987 if r == nil {
988 return nil
989 }
990 return &DataDevice{r}
991}
992
993const DataDeviceRequestStartDrag uint32 = 0
994const DataDeviceRequestSetSelection uint32 = 1
995const DataDeviceRequestRelease uint32 = 2
996const DataDeviceEventDataOffer uint32 = 0
997const DataDeviceEventEnter uint32 = 1
998const DataDeviceEventLeave uint32 = 2
999const DataDeviceEventMotion uint32 = 3
1000const DataDeviceEventDrop uint32 = 4
1001const DataDeviceEventSelection uint32 = 5
1002
1003// DataDeviceError .
1004type DataDeviceError uint32
1005
1006const (
1007 DataDeviceErrorRole DataDeviceError = 0
1008 DataDeviceErrorUsedSource DataDeviceError = 1
1009)
1010
1011// DataDeviceHandler handles wl_data_device requests.
1012type DataDeviceHandler interface {
1013 StartDrag(self *DataDevice, source *DataSource, origin *Surface, icon *Surface, serial uint32)
1014 SetSelection(self *DataDevice, source *DataSource, serial uint32)
1015 Release(self *DataDevice)
1016}
1017
1018func NewDataDevice(c server.Client, version int32, id uint32, h DataDeviceHandler) (*DataDevice, error) {
1019 if h == nil {
1020 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_data_device")
1021 }
1022 var self *DataDevice
1023 r, err := c.CreateResource(DataDeviceInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1024 switch opcode {
1025 case 0:
1026 h.StartDrag(self, WrapDataSource(args[0].Resource()), WrapSurface(args[1].Resource()), WrapSurface(args[2].Resource()), args[3].Uint())
1027 case 1:
1028 h.SetSelection(self, WrapDataSource(args[0].Resource()), args[1].Uint())
1029 case 2:
1030 h.Release(self)
1031 self.Destroy()
1032 }
1033 })
1034 if err != nil {
1035 return nil, err
1036 }
1037 self = WrapDataDevice(r)
1038 r.Data = self
1039 return self, nil
1040}
1041
1042// SendDataOffer introduce a new wl_data_offer.
1043func (self *DataDevice) SendDataOffer(id *DataOffer) {
1044 self.PostEvent(DataDeviceEventDataOffer, server.NewID(resourceOf(id)))
1045}
1046
1047// SendEnter initiate drag-and-drop session.
1048func (self *DataDevice) SendEnter(serial uint32, surface *Surface, x server.Fixed, y server.Fixed, id *DataOffer) {
1049 self.PostEvent(DataDeviceEventEnter, server.Uint(serial), server.Object(resourceOf(surface)), server.FixedArg(x), server.FixedArg(y), server.Object(resourceOf(id)))
1050}
1051
1052// SendLeave end drag-and-drop session.
1053func (self *DataDevice) SendLeave() {
1054 self.PostEvent(DataDeviceEventLeave)
1055}
1056
1057// SendMotion drag-and-drop session motion.
1058func (self *DataDevice) SendMotion(time uint32, x server.Fixed, y server.Fixed) {
1059 self.PostEvent(DataDeviceEventMotion, server.Uint(time), server.FixedArg(x), server.FixedArg(y))
1060}
1061
1062// SendDrop end drag-and-drop session successfully.
1063func (self *DataDevice) SendDrop() {
1064 self.PostEvent(DataDeviceEventDrop)
1065}
1066
1067// SendSelection advertise new selection.
1068func (self *DataDevice) SendSelection(id *DataOffer) {
1069 self.PostEvent(DataDeviceEventSelection, server.Object(resourceOf(id)))
1070}
1071func NewDataDeviceGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1072 return d.CreateGlobal(DataDeviceInterface, version, bind)
1073}
1074
1075// DataDeviceManager data transfer interface.
1076type DataDeviceManager struct{ *server.Resource }
1077
1078func WrapDataDeviceManager(r *server.Resource) *DataDeviceManager {
1079 if r == nil {
1080 return nil
1081 }
1082 return &DataDeviceManager{r}
1083}
1084
1085const DataDeviceManagerRequestCreateDataSource uint32 = 0
1086const DataDeviceManagerRequestGetDataDevice uint32 = 1
1087const DataDeviceManagerRequestRelease uint32 = 2
1088
1089// DataDeviceManagerDndAction drag and drop actions (bitfield).
1090type DataDeviceManagerDndAction uint32
1091
1092const (
1093 DataDeviceManagerDndActionNone DataDeviceManagerDndAction = 0
1094 DataDeviceManagerDndActionCopy DataDeviceManagerDndAction = 1
1095 DataDeviceManagerDndActionMove DataDeviceManagerDndAction = 2
1096 DataDeviceManagerDndActionAsk DataDeviceManagerDndAction = 4
1097)
1098
1099// DataDeviceManagerHandler handles wl_data_device_manager requests.
1100type DataDeviceManagerHandler interface {
1101 CreateDataSource(self *DataDeviceManager, id uint32)
1102 GetDataDevice(self *DataDeviceManager, id uint32, seat *Seat)
1103 Release(self *DataDeviceManager)
1104}
1105
1106func NewDataDeviceManager(c server.Client, version int32, id uint32, h DataDeviceManagerHandler) (*DataDeviceManager, error) {
1107 if h == nil {
1108 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_data_device_manager")
1109 }
1110 var self *DataDeviceManager
1111 r, err := c.CreateResource(DataDeviceManagerInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1112 switch opcode {
1113 case 0:
1114 h.CreateDataSource(self, args[0].NewID())
1115 case 1:
1116 h.GetDataDevice(self, args[0].NewID(), WrapSeat(args[1].Resource()))
1117 case 2:
1118 h.Release(self)
1119 self.Destroy()
1120 }
1121 })
1122 if err != nil {
1123 return nil, err
1124 }
1125 self = WrapDataDeviceManager(r)
1126 r.Data = self
1127 return self, nil
1128}
1129func NewDataDeviceManagerGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1130 return d.CreateGlobal(DataDeviceManagerInterface, version, bind)
1131}
1132
1133// Shell create desktop-style surfaces.
1134type Shell struct{ *server.Resource }
1135
1136func WrapShell(r *server.Resource) *Shell {
1137 if r == nil {
1138 return nil
1139 }
1140 return &Shell{r}
1141}
1142
1143const ShellRequestGetShellSurface uint32 = 0
1144
1145// ShellError .
1146type ShellError uint32
1147
1148const (
1149 ShellErrorRole ShellError = 0
1150)
1151
1152// ShellHandler handles wl_shell requests.
1153type ShellHandler interface {
1154 GetShellSurface(self *Shell, id uint32, surface *Surface)
1155}
1156
1157func NewShell(c server.Client, version int32, id uint32, h ShellHandler) (*Shell, error) {
1158 if h == nil {
1159 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_shell")
1160 }
1161 var self *Shell
1162 r, err := c.CreateResource(ShellInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1163 switch opcode {
1164 case 0:
1165 h.GetShellSurface(self, args[0].NewID(), WrapSurface(args[1].Resource()))
1166 }
1167 })
1168 if err != nil {
1169 return nil, err
1170 }
1171 self = WrapShell(r)
1172 r.Data = self
1173 return self, nil
1174}
1175func NewShellGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1176 return d.CreateGlobal(ShellInterface, version, bind)
1177}
1178
1179// ShellSurface desktop-style metadata interface.
1180type ShellSurface struct{ *server.Resource }
1181
1182func WrapShellSurface(r *server.Resource) *ShellSurface {
1183 if r == nil {
1184 return nil
1185 }
1186 return &ShellSurface{r}
1187}
1188
1189const ShellSurfaceRequestPong uint32 = 0
1190const ShellSurfaceRequestMove uint32 = 1
1191const ShellSurfaceRequestResize uint32 = 2
1192const ShellSurfaceRequestSetToplevel uint32 = 3
1193const ShellSurfaceRequestSetTransient uint32 = 4
1194const ShellSurfaceRequestSetFullscreen uint32 = 5
1195const ShellSurfaceRequestSetPopup uint32 = 6
1196const ShellSurfaceRequestSetMaximized uint32 = 7
1197const ShellSurfaceRequestSetTitle uint32 = 8
1198const ShellSurfaceRequestSetClass uint32 = 9
1199const ShellSurfaceEventPing uint32 = 0
1200const ShellSurfaceEventConfigure uint32 = 1
1201const ShellSurfaceEventPopupDone uint32 = 2
1202
1203// ShellSurfaceResize edge values for resizing (bitfield).
1204type ShellSurfaceResize uint32
1205
1206const (
1207 ShellSurfaceResizeNone ShellSurfaceResize = 0
1208 ShellSurfaceResizeTop ShellSurfaceResize = 1
1209 ShellSurfaceResizeBottom ShellSurfaceResize = 2
1210 ShellSurfaceResizeLeft ShellSurfaceResize = 4
1211 ShellSurfaceResizeTopLeft ShellSurfaceResize = 5
1212 ShellSurfaceResizeBottomLeft ShellSurfaceResize = 6
1213 ShellSurfaceResizeRight ShellSurfaceResize = 8
1214 ShellSurfaceResizeTopRight ShellSurfaceResize = 9
1215 ShellSurfaceResizeBottomRight ShellSurfaceResize = 10
1216)
1217
1218// ShellSurfaceTransient details of transient behaviour (bitfield).
1219type ShellSurfaceTransient uint32
1220
1221const (
1222 ShellSurfaceTransientInactive ShellSurfaceTransient = 0x1
1223)
1224
1225// ShellSurfaceFullscreenMethod different method to set the surface fullscreen.
1226type ShellSurfaceFullscreenMethod uint32
1227
1228const (
1229 ShellSurfaceFullscreenMethodDefault ShellSurfaceFullscreenMethod = 0
1230 ShellSurfaceFullscreenMethodScale ShellSurfaceFullscreenMethod = 1
1231 ShellSurfaceFullscreenMethodDriver ShellSurfaceFullscreenMethod = 2
1232 ShellSurfaceFullscreenMethodFill ShellSurfaceFullscreenMethod = 3
1233)
1234
1235// ShellSurfaceHandler handles wl_shell_surface requests.
1236type ShellSurfaceHandler interface {
1237 Pong(self *ShellSurface, serial uint32)
1238 Move(self *ShellSurface, seat *Seat, serial uint32)
1239 Resize(self *ShellSurface, seat *Seat, serial uint32, edges uint32)
1240 SetToplevel(self *ShellSurface)
1241 SetTransient(self *ShellSurface, parent *Surface, x int32, y int32, flags uint32)
1242 SetFullscreen(self *ShellSurface, method uint32, framerate uint32, output *Output)
1243 SetPopup(self *ShellSurface, seat *Seat, serial uint32, parent *Surface, x int32, y int32, flags uint32)
1244 SetMaximized(self *ShellSurface, output *Output)
1245 SetTitle(self *ShellSurface, title string)
1246 SetClass(self *ShellSurface, class string)
1247}
1248
1249func NewShellSurface(c server.Client, version int32, id uint32, h ShellSurfaceHandler) (*ShellSurface, error) {
1250 if h == nil {
1251 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_shell_surface")
1252 }
1253 var self *ShellSurface
1254 r, err := c.CreateResource(ShellSurfaceInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1255 switch opcode {
1256 case 0:
1257 h.Pong(self, args[0].Uint())
1258 case 1:
1259 h.Move(self, WrapSeat(args[0].Resource()), args[1].Uint())
1260 case 2:
1261 h.Resize(self, WrapSeat(args[0].Resource()), args[1].Uint(), args[2].Uint())
1262 case 3:
1263 h.SetToplevel(self)
1264 case 4:
1265 h.SetTransient(self, WrapSurface(args[0].Resource()), args[1].Int(), args[2].Int(), args[3].Uint())
1266 case 5:
1267 h.SetFullscreen(self, args[0].Uint(), args[1].Uint(), WrapOutput(args[2].Resource()))
1268 case 6:
1269 h.SetPopup(self, WrapSeat(args[0].Resource()), args[1].Uint(), WrapSurface(args[2].Resource()), args[3].Int(), args[4].Int(), args[5].Uint())
1270 case 7:
1271 h.SetMaximized(self, WrapOutput(args[0].Resource()))
1272 case 8:
1273 h.SetTitle(self, args[0].String())
1274 case 9:
1275 h.SetClass(self, args[0].String())
1276 }
1277 })
1278 if err != nil {
1279 return nil, err
1280 }
1281 self = WrapShellSurface(r)
1282 r.Data = self
1283 return self, nil
1284}
1285
1286// SendPing ping client.
1287func (self *ShellSurface) SendPing(serial uint32) {
1288 self.PostEvent(ShellSurfaceEventPing, server.Uint(serial))
1289}
1290
1291// SendConfigure suggest resize.
1292func (self *ShellSurface) SendConfigure(edges uint32, width int32, height int32) {
1293 self.PostEvent(ShellSurfaceEventConfigure, server.Uint(edges), server.Int(width), server.Int(height))
1294}
1295
1296// SendPopupDone popup interaction is done.
1297func (self *ShellSurface) SendPopupDone() {
1298 self.PostEvent(ShellSurfaceEventPopupDone)
1299}
1300func NewShellSurfaceGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1301 return d.CreateGlobal(ShellSurfaceInterface, version, bind)
1302}
1303
1304// Surface an onscreen surface.
1305type Surface struct{ *server.Resource }
1306
1307func WrapSurface(r *server.Resource) *Surface {
1308 if r == nil {
1309 return nil
1310 }
1311 return &Surface{r}
1312}
1313
1314const SurfaceRequestDestroy uint32 = 0
1315const SurfaceRequestAttach uint32 = 1
1316const SurfaceRequestDamage uint32 = 2
1317const SurfaceRequestFrame uint32 = 3
1318const SurfaceRequestSetOpaqueRegion uint32 = 4
1319const SurfaceRequestSetInputRegion uint32 = 5
1320const SurfaceRequestCommit uint32 = 6
1321const SurfaceRequestSetBufferTransform uint32 = 7
1322const SurfaceRequestSetBufferScale uint32 = 8
1323const SurfaceRequestDamageBuffer uint32 = 9
1324const SurfaceRequestOffset uint32 = 10
1325const SurfaceRequestGetRelease uint32 = 11
1326const SurfaceEventEnter uint32 = 0
1327const SurfaceEventLeave uint32 = 1
1328const SurfaceEventPreferredBufferScale uint32 = 2
1329const SurfaceEventPreferredBufferTransform uint32 = 3
1330
1331// SurfaceError wl_surface error values.
1332type SurfaceError uint32
1333
1334const (
1335 SurfaceErrorInvalidScale SurfaceError = 0
1336 SurfaceErrorInvalidTransform SurfaceError = 1
1337 SurfaceErrorInvalidSize SurfaceError = 2
1338 SurfaceErrorInvalidOffset SurfaceError = 3
1339 SurfaceErrorDefunctRoleObject SurfaceError = 4
1340 SurfaceErrorNoBuffer SurfaceError = 5
1341)
1342
1343// SurfaceHandler handles wl_surface requests.
1344type SurfaceHandler interface {
1345 Destroy(self *Surface)
1346 Attach(self *Surface, buffer *Buffer, x int32, y int32)
1347 Damage(self *Surface, x int32, y int32, width int32, height int32)
1348 Frame(self *Surface, callback uint32)
1349 SetOpaqueRegion(self *Surface, region *Region)
1350 SetInputRegion(self *Surface, region *Region)
1351 Commit(self *Surface)
1352 SetBufferTransform(self *Surface, transform int32)
1353 SetBufferScale(self *Surface, scale int32)
1354 DamageBuffer(self *Surface, x int32, y int32, width int32, height int32)
1355 Offset(self *Surface, x int32, y int32)
1356 GetRelease(self *Surface, callback uint32)
1357}
1358
1359func NewSurface(c server.Client, version int32, id uint32, h SurfaceHandler) (*Surface, error) {
1360 if h == nil {
1361 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_surface")
1362 }
1363 var self *Surface
1364 r, err := c.CreateResource(SurfaceInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1365 switch opcode {
1366 case 0:
1367 h.Destroy(self)
1368 self.Destroy()
1369 case 1:
1370 h.Attach(self, WrapBuffer(args[0].Resource()), args[1].Int(), args[2].Int())
1371 case 2:
1372 h.Damage(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int())
1373 case 3:
1374 h.Frame(self, args[0].NewID())
1375 case 4:
1376 h.SetOpaqueRegion(self, WrapRegion(args[0].Resource()))
1377 case 5:
1378 h.SetInputRegion(self, WrapRegion(args[0].Resource()))
1379 case 6:
1380 h.Commit(self)
1381 case 7:
1382 h.SetBufferTransform(self, args[0].Int())
1383 case 8:
1384 h.SetBufferScale(self, args[0].Int())
1385 case 9:
1386 h.DamageBuffer(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int())
1387 case 10:
1388 h.Offset(self, args[0].Int(), args[1].Int())
1389 case 11:
1390 h.GetRelease(self, args[0].NewID())
1391 }
1392 })
1393 if err != nil {
1394 return nil, err
1395 }
1396 self = WrapSurface(r)
1397 r.Data = self
1398 return self, nil
1399}
1400
1401// SendEnter surface enters an output.
1402func (self *Surface) SendEnter(output *Output) {
1403 self.PostEvent(SurfaceEventEnter, server.Object(resourceOf(output)))
1404}
1405
1406// SendLeave surface leaves an output.
1407func (self *Surface) SendLeave(output *Output) {
1408 self.PostEvent(SurfaceEventLeave, server.Object(resourceOf(output)))
1409}
1410
1411// SendPreferredBufferScale preferred buffer scale for the surface (since version 6).
1412func (self *Surface) SendPreferredBufferScale(factor int32) {
1413 self.PostEvent(SurfaceEventPreferredBufferScale, server.Int(factor))
1414}
1415
1416// SendPreferredBufferTransform preferred buffer transform for the surface (since version 6).
1417func (self *Surface) SendPreferredBufferTransform(transform uint32) {
1418 self.PostEvent(SurfaceEventPreferredBufferTransform, server.Uint(transform))
1419}
1420func NewSurfaceGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1421 return d.CreateGlobal(SurfaceInterface, version, bind)
1422}
1423
1424// Seat group of input devices.
1425type Seat struct{ *server.Resource }
1426
1427func WrapSeat(r *server.Resource) *Seat {
1428 if r == nil {
1429 return nil
1430 }
1431 return &Seat{r}
1432}
1433
1434const SeatRequestGetPointer uint32 = 0
1435const SeatRequestGetKeyboard uint32 = 1
1436const SeatRequestGetTouch uint32 = 2
1437const SeatRequestRelease uint32 = 3
1438const SeatEventCapabilities uint32 = 0
1439const SeatEventName uint32 = 1
1440
1441// SeatCapability seat capability bitmask (bitfield).
1442type SeatCapability uint32
1443
1444const (
1445 SeatCapabilityPointer SeatCapability = 1
1446 SeatCapabilityKeyboard SeatCapability = 2
1447 SeatCapabilityTouch SeatCapability = 4
1448)
1449
1450// SeatError wl_seat error values.
1451type SeatError uint32
1452
1453const (
1454 SeatErrorMissingCapability SeatError = 0
1455)
1456
1457// SeatHandler handles wl_seat requests.
1458type SeatHandler interface {
1459 GetPointer(self *Seat, id uint32)
1460 GetKeyboard(self *Seat, id uint32)
1461 GetTouch(self *Seat, id uint32)
1462 Release(self *Seat)
1463}
1464
1465func NewSeat(c server.Client, version int32, id uint32, h SeatHandler) (*Seat, error) {
1466 if h == nil {
1467 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_seat")
1468 }
1469 var self *Seat
1470 r, err := c.CreateResource(SeatInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1471 switch opcode {
1472 case 0:
1473 h.GetPointer(self, args[0].NewID())
1474 case 1:
1475 h.GetKeyboard(self, args[0].NewID())
1476 case 2:
1477 h.GetTouch(self, args[0].NewID())
1478 case 3:
1479 h.Release(self)
1480 self.Destroy()
1481 }
1482 })
1483 if err != nil {
1484 return nil, err
1485 }
1486 self = WrapSeat(r)
1487 r.Data = self
1488 return self, nil
1489}
1490
1491// SendCapabilities seat capabilities changed.
1492func (self *Seat) SendCapabilities(capabilities uint32) {
1493 self.PostEvent(SeatEventCapabilities, server.Uint(capabilities))
1494}
1495
1496// SendName unique identifier for this seat (since version 2).
1497func (self *Seat) SendName(name string) {
1498 var p runtime.Pinner
1499 defer p.Unpin()
1500 self.PostEvent(SeatEventName, server.String(&p, name, false))
1501}
1502func NewSeatGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1503 return d.CreateGlobal(SeatInterface, version, bind)
1504}
1505
1506// Pointer pointer input device.
1507type Pointer struct{ *server.Resource }
1508
1509func WrapPointer(r *server.Resource) *Pointer {
1510 if r == nil {
1511 return nil
1512 }
1513 return &Pointer{r}
1514}
1515
1516const PointerRequestSetCursor uint32 = 0
1517const PointerRequestRelease uint32 = 1
1518const PointerEventEnter uint32 = 0
1519const PointerEventLeave uint32 = 1
1520const PointerEventMotion uint32 = 2
1521const PointerEventButton uint32 = 3
1522const PointerEventAxis uint32 = 4
1523const PointerEventFrame uint32 = 5
1524const PointerEventAxisSource uint32 = 6
1525const PointerEventAxisStop uint32 = 7
1526const PointerEventAxisDiscrete uint32 = 8
1527const PointerEventAxisValue120 uint32 = 9
1528const PointerEventAxisRelativeDirection uint32 = 10
1529const PointerEventWarp uint32 = 11
1530
1531// PointerError .
1532type PointerError uint32
1533
1534const (
1535 PointerErrorRole PointerError = 0
1536)
1537
1538// PointerButtonState physical button state.
1539type PointerButtonState uint32
1540
1541const (
1542 PointerButtonStateReleased PointerButtonState = 0
1543 PointerButtonStatePressed PointerButtonState = 1
1544)
1545
1546// PointerAxis axis types.
1547type PointerAxis uint32
1548
1549const (
1550 PointerAxisVerticalScroll PointerAxis = 0
1551 PointerAxisHorizontalScroll PointerAxis = 1
1552)
1553
1554// PointerAxisSource axis source types.
1555type PointerAxisSource uint32
1556
1557const (
1558 PointerAxisSourceWheel PointerAxisSource = 0
1559 PointerAxisSourceFinger PointerAxisSource = 1
1560 PointerAxisSourceContinuous PointerAxisSource = 2
1561 PointerAxisSourceWheelTilt PointerAxisSource = 3
1562)
1563
1564// PointerAxisRelativeDirection axis relative direction.
1565type PointerAxisRelativeDirection uint32
1566
1567const (
1568 PointerAxisRelativeDirectionIdentical PointerAxisRelativeDirection = 0
1569 PointerAxisRelativeDirectionInverted PointerAxisRelativeDirection = 1
1570)
1571
1572// PointerHandler handles wl_pointer requests.
1573type PointerHandler interface {
1574 SetCursor(self *Pointer, serial uint32, surface *Surface, hotspotX int32, hotspotY int32)
1575 Release(self *Pointer)
1576}
1577
1578func NewPointer(c server.Client, version int32, id uint32, h PointerHandler) (*Pointer, error) {
1579 if h == nil {
1580 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_pointer")
1581 }
1582 var self *Pointer
1583 r, err := c.CreateResource(PointerInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1584 switch opcode {
1585 case 0:
1586 h.SetCursor(self, args[0].Uint(), WrapSurface(args[1].Resource()), args[2].Int(), args[3].Int())
1587 case 1:
1588 h.Release(self)
1589 self.Destroy()
1590 }
1591 })
1592 if err != nil {
1593 return nil, err
1594 }
1595 self = WrapPointer(r)
1596 r.Data = self
1597 return self, nil
1598}
1599
1600// SendEnter enter event.
1601func (self *Pointer) SendEnter(serial uint32, surface *Surface, surfaceX server.Fixed, surfaceY server.Fixed) {
1602 self.PostEvent(PointerEventEnter, server.Uint(serial), server.Object(resourceOf(surface)), server.FixedArg(surfaceX), server.FixedArg(surfaceY))
1603}
1604
1605// SendLeave leave event.
1606func (self *Pointer) SendLeave(serial uint32, surface *Surface) {
1607 self.PostEvent(PointerEventLeave, server.Uint(serial), server.Object(resourceOf(surface)))
1608}
1609
1610// SendMotion pointer motion event.
1611func (self *Pointer) SendMotion(time uint32, surfaceX server.Fixed, surfaceY server.Fixed) {
1612 self.PostEvent(PointerEventMotion, server.Uint(time), server.FixedArg(surfaceX), server.FixedArg(surfaceY))
1613}
1614
1615// SendButton pointer button event.
1616func (self *Pointer) SendButton(serial uint32, time uint32, button uint32, state uint32) {
1617 self.PostEvent(PointerEventButton, server.Uint(serial), server.Uint(time), server.Uint(button), server.Uint(state))
1618}
1619
1620// SendAxis axis event.
1621func (self *Pointer) SendAxis(time uint32, axis uint32, value server.Fixed) {
1622 self.PostEvent(PointerEventAxis, server.Uint(time), server.Uint(axis), server.FixedArg(value))
1623}
1624
1625// SendFrame end of a pointer event sequence (since version 5).
1626func (self *Pointer) SendFrame() {
1627 self.PostEvent(PointerEventFrame)
1628}
1629
1630// SendAxisSource axis source event (since version 5).
1631func (self *Pointer) SendAxisSource(axisSource uint32) {
1632 self.PostEvent(PointerEventAxisSource, server.Uint(axisSource))
1633}
1634
1635// SendAxisStop axis stop event (since version 5).
1636func (self *Pointer) SendAxisStop(time uint32, axis uint32) {
1637 self.PostEvent(PointerEventAxisStop, server.Uint(time), server.Uint(axis))
1638}
1639
1640// SendAxisDiscrete axis click event (since version 5).
1641func (self *Pointer) SendAxisDiscrete(axis uint32, discrete int32) {
1642 self.PostEvent(PointerEventAxisDiscrete, server.Uint(axis), server.Int(discrete))
1643}
1644
1645// SendAxisValue120 axis high-resolution scroll event (since version 8).
1646func (self *Pointer) SendAxisValue120(axis uint32, value120 int32) {
1647 self.PostEvent(PointerEventAxisValue120, server.Uint(axis), server.Int(value120))
1648}
1649
1650// SendAxisRelativeDirection axis relative physical direction event (since version 9).
1651func (self *Pointer) SendAxisRelativeDirection(axis uint32, direction uint32) {
1652 self.PostEvent(PointerEventAxisRelativeDirection, server.Uint(axis), server.Uint(direction))
1653}
1654
1655// SendWarp pointer warp event (since version 11).
1656func (self *Pointer) SendWarp(surfaceX server.Fixed, surfaceY server.Fixed) {
1657 self.PostEvent(PointerEventWarp, server.FixedArg(surfaceX), server.FixedArg(surfaceY))
1658}
1659func NewPointerGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1660 return d.CreateGlobal(PointerInterface, version, bind)
1661}
1662
1663// Keyboard keyboard input device.
1664type Keyboard struct{ *server.Resource }
1665
1666func WrapKeyboard(r *server.Resource) *Keyboard {
1667 if r == nil {
1668 return nil
1669 }
1670 return &Keyboard{r}
1671}
1672
1673const KeyboardRequestRelease uint32 = 0
1674const KeyboardEventKeymap uint32 = 0
1675const KeyboardEventEnter uint32 = 1
1676const KeyboardEventLeave uint32 = 2
1677const KeyboardEventKey uint32 = 3
1678const KeyboardEventModifiers uint32 = 4
1679const KeyboardEventRepeatInfo uint32 = 5
1680
1681// KeyboardKeymapFormat keyboard mapping format.
1682type KeyboardKeymapFormat uint32
1683
1684const (
1685 KeyboardKeymapFormatNoKeymap KeyboardKeymapFormat = 0
1686 KeyboardKeymapFormatXkbV1 KeyboardKeymapFormat = 1
1687)
1688
1689// KeyboardKeyState physical key state.
1690type KeyboardKeyState uint32
1691
1692const (
1693 KeyboardKeyStateReleased KeyboardKeyState = 0
1694 KeyboardKeyStatePressed KeyboardKeyState = 1
1695 KeyboardKeyStateRepeated KeyboardKeyState = 2
1696)
1697
1698// KeyboardHandler handles wl_keyboard requests.
1699type KeyboardHandler interface {
1700 Release(self *Keyboard)
1701}
1702
1703func NewKeyboard(c server.Client, version int32, id uint32, h KeyboardHandler) (*Keyboard, error) {
1704 if h == nil {
1705 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_keyboard")
1706 }
1707 var self *Keyboard
1708 r, err := c.CreateResource(KeyboardInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1709 switch opcode {
1710 case 0:
1711 h.Release(self)
1712 self.Destroy()
1713 }
1714 })
1715 if err != nil {
1716 return nil, err
1717 }
1718 self = WrapKeyboard(r)
1719 r.Data = self
1720 return self, nil
1721}
1722
1723// SendKeymap keyboard mapping.
1724func (self *Keyboard) SendKeymap(format uint32, fd int, size uint32) {
1725 self.PostEvent(KeyboardEventKeymap, server.Uint(format), server.Fd(fd), server.Uint(size))
1726}
1727
1728// SendEnter enter event.
1729func (self *Keyboard) SendEnter(serial uint32, surface *Surface, keys []byte) {
1730 var p runtime.Pinner
1731 defer p.Unpin()
1732 self.PostEvent(KeyboardEventEnter, server.Uint(serial), server.Object(resourceOf(surface)), server.Array(&p, keys))
1733}
1734
1735// SendLeave leave event.
1736func (self *Keyboard) SendLeave(serial uint32, surface *Surface) {
1737 self.PostEvent(KeyboardEventLeave, server.Uint(serial), server.Object(resourceOf(surface)))
1738}
1739
1740// SendKey key event.
1741func (self *Keyboard) SendKey(serial uint32, time uint32, key uint32, state uint32) {
1742 self.PostEvent(KeyboardEventKey, server.Uint(serial), server.Uint(time), server.Uint(key), server.Uint(state))
1743}
1744
1745// SendModifiers modifier and group state.
1746func (self *Keyboard) SendModifiers(serial uint32, modsDepressed uint32, modsLatched uint32, modsLocked uint32, group uint32) {
1747 self.PostEvent(KeyboardEventModifiers, server.Uint(serial), server.Uint(modsDepressed), server.Uint(modsLatched), server.Uint(modsLocked), server.Uint(group))
1748}
1749
1750// SendRepeatInfo repeat rate and delay (since version 4).
1751func (self *Keyboard) SendRepeatInfo(rate int32, delay int32) {
1752 self.PostEvent(KeyboardEventRepeatInfo, server.Int(rate), server.Int(delay))
1753}
1754func NewKeyboardGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1755 return d.CreateGlobal(KeyboardInterface, version, bind)
1756}
1757
1758// Touch touchscreen input device.
1759type Touch struct{ *server.Resource }
1760
1761func WrapTouch(r *server.Resource) *Touch {
1762 if r == nil {
1763 return nil
1764 }
1765 return &Touch{r}
1766}
1767
1768const TouchRequestRelease uint32 = 0
1769const TouchEventDown uint32 = 0
1770const TouchEventUp uint32 = 1
1771const TouchEventMotion uint32 = 2
1772const TouchEventFrame uint32 = 3
1773const TouchEventCancel uint32 = 4
1774const TouchEventShape uint32 = 5
1775const TouchEventOrientation uint32 = 6
1776
1777// TouchHandler handles wl_touch requests.
1778type TouchHandler interface {
1779 Release(self *Touch)
1780}
1781
1782func NewTouch(c server.Client, version int32, id uint32, h TouchHandler) (*Touch, error) {
1783 if h == nil {
1784 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_touch")
1785 }
1786 var self *Touch
1787 r, err := c.CreateResource(TouchInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1788 switch opcode {
1789 case 0:
1790 h.Release(self)
1791 self.Destroy()
1792 }
1793 })
1794 if err != nil {
1795 return nil, err
1796 }
1797 self = WrapTouch(r)
1798 r.Data = self
1799 return self, nil
1800}
1801
1802// SendDown touch down event and beginning of a touch sequence.
1803func (self *Touch) SendDown(serial uint32, time uint32, surface *Surface, id int32, x server.Fixed, y server.Fixed) {
1804 self.PostEvent(TouchEventDown, server.Uint(serial), server.Uint(time), server.Object(resourceOf(surface)), server.Int(id), server.FixedArg(x), server.FixedArg(y))
1805}
1806
1807// SendUp end of a touch event sequence.
1808func (self *Touch) SendUp(serial uint32, time uint32, id int32) {
1809 self.PostEvent(TouchEventUp, server.Uint(serial), server.Uint(time), server.Int(id))
1810}
1811
1812// SendMotion update of touch point coordinates.
1813func (self *Touch) SendMotion(time uint32, id int32, x server.Fixed, y server.Fixed) {
1814 self.PostEvent(TouchEventMotion, server.Uint(time), server.Int(id), server.FixedArg(x), server.FixedArg(y))
1815}
1816
1817// SendFrame end of touch frame event.
1818func (self *Touch) SendFrame() {
1819 self.PostEvent(TouchEventFrame)
1820}
1821
1822// SendCancel touch session cancelled.
1823func (self *Touch) SendCancel() {
1824 self.PostEvent(TouchEventCancel)
1825}
1826
1827// SendShape update shape of touch point (since version 6).
1828func (self *Touch) SendShape(id int32, major server.Fixed, minor server.Fixed) {
1829 self.PostEvent(TouchEventShape, server.Int(id), server.FixedArg(major), server.FixedArg(minor))
1830}
1831
1832// SendOrientation update orientation of touch point (since version 6).
1833func (self *Touch) SendOrientation(id int32, orientation server.Fixed) {
1834 self.PostEvent(TouchEventOrientation, server.Int(id), server.FixedArg(orientation))
1835}
1836func NewTouchGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1837 return d.CreateGlobal(TouchInterface, version, bind)
1838}
1839
1840// Output compositor output region.
1841type Output struct{ *server.Resource }
1842
1843func WrapOutput(r *server.Resource) *Output {
1844 if r == nil {
1845 return nil
1846 }
1847 return &Output{r}
1848}
1849
1850const OutputRequestRelease uint32 = 0
1851const OutputEventGeometry uint32 = 0
1852const OutputEventMode uint32 = 1
1853const OutputEventDone uint32 = 2
1854const OutputEventScale uint32 = 3
1855const OutputEventName uint32 = 4
1856const OutputEventDescription uint32 = 5
1857
1858// OutputSubpixel subpixel geometry information.
1859type OutputSubpixel uint32
1860
1861const (
1862 OutputSubpixelUnknown OutputSubpixel = 0
1863 OutputSubpixelNone OutputSubpixel = 1
1864 OutputSubpixelHorizontalRgb OutputSubpixel = 2
1865 OutputSubpixelHorizontalBgr OutputSubpixel = 3
1866 OutputSubpixelVerticalRgb OutputSubpixel = 4
1867 OutputSubpixelVerticalBgr OutputSubpixel = 5
1868)
1869
1870// OutputTransform transformation applied to buffer contents.
1871type OutputTransform uint32
1872
1873const (
1874 OutputTransformNormal OutputTransform = 0
1875 OutputTransform90 OutputTransform = 1
1876 OutputTransform180 OutputTransform = 2
1877 OutputTransform270 OutputTransform = 3
1878 OutputTransformFlipped OutputTransform = 4
1879 OutputTransformFlipped90 OutputTransform = 5
1880 OutputTransformFlipped180 OutputTransform = 6
1881 OutputTransformFlipped270 OutputTransform = 7
1882)
1883
1884// OutputMode mode information (bitfield).
1885type OutputMode uint32
1886
1887const (
1888 OutputModeCurrent OutputMode = 0x1
1889 OutputModePreferred OutputMode = 0x2
1890)
1891
1892// OutputHandler handles wl_output requests.
1893type OutputHandler interface {
1894 Release(self *Output)
1895}
1896
1897func NewOutput(c server.Client, version int32, id uint32, h OutputHandler) (*Output, error) {
1898 if h == nil {
1899 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_output")
1900 }
1901 var self *Output
1902 r, err := c.CreateResource(OutputInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1903 switch opcode {
1904 case 0:
1905 h.Release(self)
1906 self.Destroy()
1907 }
1908 })
1909 if err != nil {
1910 return nil, err
1911 }
1912 self = WrapOutput(r)
1913 r.Data = self
1914 return self, nil
1915}
1916
1917// SendGeometry properties of the output.
1918func (self *Output) SendGeometry(x int32, y int32, physicalWidth int32, physicalHeight int32, subpixel int32, make string, model string, transform int32) {
1919 var p runtime.Pinner
1920 defer p.Unpin()
1921 self.PostEvent(OutputEventGeometry, server.Int(x), server.Int(y), server.Int(physicalWidth), server.Int(physicalHeight), server.Int(subpixel), server.String(&p, make, false), server.String(&p, model, false), server.Int(transform))
1922}
1923
1924// SendMode advertise available modes for the output.
1925func (self *Output) SendMode(flags uint32, width int32, height int32, refresh int32) {
1926 self.PostEvent(OutputEventMode, server.Uint(flags), server.Int(width), server.Int(height), server.Int(refresh))
1927}
1928
1929// SendDone sent all information about output (since version 2).
1930func (self *Output) SendDone() {
1931 self.PostEvent(OutputEventDone)
1932}
1933
1934// SendScale output scaling properties (since version 2).
1935func (self *Output) SendScale(factor int32) {
1936 self.PostEvent(OutputEventScale, server.Int(factor))
1937}
1938
1939// SendName name of this output (since version 4).
1940func (self *Output) SendName(name string) {
1941 var p runtime.Pinner
1942 defer p.Unpin()
1943 self.PostEvent(OutputEventName, server.String(&p, name, false))
1944}
1945
1946// SendDescription human-readable description of this output (since version 4).
1947func (self *Output) SendDescription(description string) {
1948 var p runtime.Pinner
1949 defer p.Unpin()
1950 self.PostEvent(OutputEventDescription, server.String(&p, description, false))
1951}
1952func NewOutputGlobal(d *server.Display, version int32, bind server.BindFunc) error {
1953 return d.CreateGlobal(OutputInterface, version, bind)
1954}
1955
1956// Region region interface.
1957type Region struct{ *server.Resource }
1958
1959func WrapRegion(r *server.Resource) *Region {
1960 if r == nil {
1961 return nil
1962 }
1963 return &Region{r}
1964}
1965
1966const RegionRequestDestroy uint32 = 0
1967const RegionRequestAdd uint32 = 1
1968const RegionRequestSubtract uint32 = 2
1969
1970// RegionHandler handles wl_region requests.
1971type RegionHandler interface {
1972 Destroy(self *Region)
1973 Add(self *Region, x int32, y int32, width int32, height int32)
1974 Subtract(self *Region, x int32, y int32, width int32, height int32)
1975}
1976
1977func NewRegion(c server.Client, version int32, id uint32, h RegionHandler) (*Region, error) {
1978 if h == nil {
1979 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_region")
1980 }
1981 var self *Region
1982 r, err := c.CreateResource(RegionInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
1983 switch opcode {
1984 case 0:
1985 h.Destroy(self)
1986 self.Destroy()
1987 case 1:
1988 h.Add(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int())
1989 case 2:
1990 h.Subtract(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int())
1991 }
1992 })
1993 if err != nil {
1994 return nil, err
1995 }
1996 self = WrapRegion(r)
1997 r.Data = self
1998 return self, nil
1999}
2000func NewRegionGlobal(d *server.Display, version int32, bind server.BindFunc) error {
2001 return d.CreateGlobal(RegionInterface, version, bind)
2002}
2003
2004// Subcompositor sub-surface compositing.
2005type Subcompositor struct{ *server.Resource }
2006
2007func WrapSubcompositor(r *server.Resource) *Subcompositor {
2008 if r == nil {
2009 return nil
2010 }
2011 return &Subcompositor{r}
2012}
2013
2014const SubcompositorRequestDestroy uint32 = 0
2015const SubcompositorRequestGetSubsurface uint32 = 1
2016
2017// SubcompositorError .
2018type SubcompositorError uint32
2019
2020const (
2021 SubcompositorErrorBadSurface SubcompositorError = 0
2022 SubcompositorErrorBadParent SubcompositorError = 1
2023)
2024
2025// SubcompositorHandler handles wl_subcompositor requests.
2026type SubcompositorHandler interface {
2027 Destroy(self *Subcompositor)
2028 GetSubsurface(self *Subcompositor, id uint32, surface *Surface, parent *Surface)
2029}
2030
2031func NewSubcompositor(c server.Client, version int32, id uint32, h SubcompositorHandler) (*Subcompositor, error) {
2032 if h == nil {
2033 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_subcompositor")
2034 }
2035 var self *Subcompositor
2036 r, err := c.CreateResource(SubcompositorInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
2037 switch opcode {
2038 case 0:
2039 h.Destroy(self)
2040 self.Destroy()
2041 case 1:
2042 h.GetSubsurface(self, args[0].NewID(), WrapSurface(args[1].Resource()), WrapSurface(args[2].Resource()))
2043 }
2044 })
2045 if err != nil {
2046 return nil, err
2047 }
2048 self = WrapSubcompositor(r)
2049 r.Data = self
2050 return self, nil
2051}
2052func NewSubcompositorGlobal(d *server.Display, version int32, bind server.BindFunc) error {
2053 return d.CreateGlobal(SubcompositorInterface, version, bind)
2054}
2055
2056// Subsurface sub-surface interface to a wl_surface.
2057type Subsurface struct{ *server.Resource }
2058
2059func WrapSubsurface(r *server.Resource) *Subsurface {
2060 if r == nil {
2061 return nil
2062 }
2063 return &Subsurface{r}
2064}
2065
2066const SubsurfaceRequestDestroy uint32 = 0
2067const SubsurfaceRequestSetPosition uint32 = 1
2068const SubsurfaceRequestPlaceAbove uint32 = 2
2069const SubsurfaceRequestPlaceBelow uint32 = 3
2070const SubsurfaceRequestSetSync uint32 = 4
2071const SubsurfaceRequestSetDesync uint32 = 5
2072
2073// SubsurfaceError .
2074type SubsurfaceError uint32
2075
2076const (
2077 SubsurfaceErrorBadSurface SubsurfaceError = 0
2078)
2079
2080// SubsurfaceHandler handles wl_subsurface requests.
2081type SubsurfaceHandler interface {
2082 Destroy(self *Subsurface)
2083 SetPosition(self *Subsurface, x int32, y int32)
2084 PlaceAbove(self *Subsurface, sibling *Surface)
2085 PlaceBelow(self *Subsurface, sibling *Surface)
2086 SetSync(self *Subsurface)
2087 SetDesync(self *Subsurface)
2088}
2089
2090func NewSubsurface(c server.Client, version int32, id uint32, h SubsurfaceHandler) (*Subsurface, error) {
2091 if h == nil {
2092 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_subsurface")
2093 }
2094 var self *Subsurface
2095 r, err := c.CreateResource(SubsurfaceInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
2096 switch opcode {
2097 case 0:
2098 h.Destroy(self)
2099 self.Destroy()
2100 case 1:
2101 h.SetPosition(self, args[0].Int(), args[1].Int())
2102 case 2:
2103 h.PlaceAbove(self, WrapSurface(args[0].Resource()))
2104 case 3:
2105 h.PlaceBelow(self, WrapSurface(args[0].Resource()))
2106 case 4:
2107 h.SetSync(self)
2108 case 5:
2109 h.SetDesync(self)
2110 }
2111 })
2112 if err != nil {
2113 return nil, err
2114 }
2115 self = WrapSubsurface(r)
2116 r.Data = self
2117 return self, nil
2118}
2119func NewSubsurfaceGlobal(d *server.Display, version int32, bind server.BindFunc) error {
2120 return d.CreateGlobal(SubsurfaceInterface, version, bind)
2121}
2122
2123// Fixes wayland protocol fixes.
2124type Fixes struct{ *server.Resource }
2125
2126func WrapFixes(r *server.Resource) *Fixes {
2127 if r == nil {
2128 return nil
2129 }
2130 return &Fixes{r}
2131}
2132
2133const FixesRequestDestroy uint32 = 0
2134const FixesRequestDestroyRegistry uint32 = 1
2135const FixesRequestAckGlobalRemove uint32 = 2
2136
2137// FixesError wl_fixes error values.
2138type FixesError uint32
2139
2140const (
2141 FixesErrorInvalidAckRemove FixesError = 0
2142)
2143
2144// FixesHandler handles wl_fixes requests.
2145type FixesHandler interface {
2146 Destroy(self *Fixes)
2147 DestroyRegistry(self *Fixes, registry *Registry)
2148 AckGlobalRemove(self *Fixes, registry *Registry, name uint32)
2149}
2150
2151func NewFixes(c server.Client, version int32, id uint32, h FixesHandler) (*Fixes, error) {
2152 if h == nil {
2153 return nil, fmt.Errorf("purego-libwayland: nil handler for wl_fixes")
2154 }
2155 var self *Fixes
2156 r, err := c.CreateResource(FixesInterface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
2157 switch opcode {
2158 case 0:
2159 h.Destroy(self)
2160 self.Destroy()
2161 case 1:
2162 h.DestroyRegistry(self, WrapRegistry(args[0].Resource()))
2163 case 2:
2164 h.AckGlobalRemove(self, WrapRegistry(args[0].Resource()), args[1].Uint())
2165 }
2166 })
2167 if err != nil {
2168 return nil, err
2169 }
2170 self = WrapFixes(r)
2171 r.Data = self
2172 return self, nil
2173}
2174func NewFixesGlobal(d *server.Display, version int32, bind server.BindFunc) error {
2175 return d.CreateGlobal(FixesInterface, version, bind)
2176}
2177func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
2178 if v == nil {
2179 return nil
2180 }
2181 return v.GetResource()
2182}
2183func (self *Display) GetResource() *server.Resource {
2184 if self == nil {
2185 return nil
2186 }
2187 return self.Resource
2188}
2189func (self *Registry) GetResource() *server.Resource {
2190 if self == nil {
2191 return nil
2192 }
2193 return self.Resource
2194}
2195func (self *Callback) GetResource() *server.Resource {
2196 if self == nil {
2197 return nil
2198 }
2199 return self.Resource
2200}
2201func (self *Compositor) GetResource() *server.Resource {
2202 if self == nil {
2203 return nil
2204 }
2205 return self.Resource
2206}
2207func (self *ShmPool) GetResource() *server.Resource {
2208 if self == nil {
2209 return nil
2210 }
2211 return self.Resource
2212}
2213func (self *Shm) GetResource() *server.Resource {
2214 if self == nil {
2215 return nil
2216 }
2217 return self.Resource
2218}
2219func (self *Buffer) GetResource() *server.Resource {
2220 if self == nil {
2221 return nil
2222 }
2223 return self.Resource
2224}
2225func (self *DataOffer) GetResource() *server.Resource {
2226 if self == nil {
2227 return nil
2228 }
2229 return self.Resource
2230}
2231func (self *DataSource) GetResource() *server.Resource {
2232 if self == nil {
2233 return nil
2234 }
2235 return self.Resource
2236}
2237func (self *DataDevice) GetResource() *server.Resource {
2238 if self == nil {
2239 return nil
2240 }
2241 return self.Resource
2242}
2243func (self *DataDeviceManager) GetResource() *server.Resource {
2244 if self == nil {
2245 return nil
2246 }
2247 return self.Resource
2248}
2249func (self *Shell) GetResource() *server.Resource {
2250 if self == nil {
2251 return nil
2252 }
2253 return self.Resource
2254}
2255func (self *ShellSurface) GetResource() *server.Resource {
2256 if self == nil {
2257 return nil
2258 }
2259 return self.Resource
2260}
2261func (self *Surface) GetResource() *server.Resource {
2262 if self == nil {
2263 return nil
2264 }
2265 return self.Resource
2266}
2267func (self *Seat) GetResource() *server.Resource {
2268 if self == nil {
2269 return nil
2270 }
2271 return self.Resource
2272}
2273func (self *Pointer) GetResource() *server.Resource {
2274 if self == nil {
2275 return nil
2276 }
2277 return self.Resource
2278}
2279func (self *Keyboard) GetResource() *server.Resource {
2280 if self == nil {
2281 return nil
2282 }
2283 return self.Resource
2284}
2285func (self *Touch) GetResource() *server.Resource {
2286 if self == nil {
2287 return nil
2288 }
2289 return self.Resource
2290}
2291func (self *Output) GetResource() *server.Resource {
2292 if self == nil {
2293 return nil
2294 }
2295 return self.Resource
2296}
2297func (self *Region) GetResource() *server.Resource {
2298 if self == nil {
2299 return nil
2300 }
2301 return self.Resource
2302}
2303func (self *Subcompositor) GetResource() *server.Resource {
2304 if self == nil {
2305 return nil
2306 }
2307 return self.Resource
2308}
2309func (self *Subsurface) GetResource() *server.Resource {
2310 if self == nil {
2311 return nil
2312 }
2313 return self.Resource
2314}
2315func (self *Fixes) GetResource() *server.Resource {
2316 if self == nil {
2317 return nil
2318 }
2319 return self.Resource
2320}