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