extimagecopycapture_generated.go RawHistoryFolder
1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2021-2023 Andri Yngvason
5// Copyright © 2024 Simon Ser
6//
7// Permission is hereby granted, free of charge, to any person obtaining a
8// copy of this software and associated documentation files (the "Software"),
9// to deal in the Software without restriction, including without limitation
10// the rights to use, copy, modify, merge, publish, distribute, sublicense,
11// and/or sell copies of the Software, and to permit persons to whom the
12// Software is furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice (including the next
15// paragraph) shall be included in all copies or substantial portions of the
16// Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24// DEALINGS IN THE SOFTWARE.
25
26package extimagecopycapture
27
28import (
29 "fmt"
30 extimagecapturesource "github.com/bnema/go-wayland-bindings/server/extimagecapturesource"
31 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
32 "github.com/bnema/purego-libwayland/server"
33 "runtime"
34)
35
36var ExtImageCopyCaptureManagerV1Interface *server.Interface
37var ExtImageCopyCaptureSessionV1Interface *server.Interface
38var ExtImageCopyCaptureFrameV1Interface *server.Interface
39var ExtImageCopyCaptureCursorSessionV1Interface *server.Interface
40
41func init() {
42 ExtImageCopyCaptureManagerV1Interface = &server.Interface{Name: "ext_image_copy_capture_manager_v1", Version: 1}
43 ExtImageCopyCaptureSessionV1Interface = &server.Interface{Name: "ext_image_copy_capture_session_v1", Version: 1}
44 ExtImageCopyCaptureFrameV1Interface = &server.Interface{Name: "ext_image_copy_capture_frame_v1", Version: 1}
45 ExtImageCopyCaptureCursorSessionV1Interface = &server.Interface{Name: "ext_image_copy_capture_cursor_session_v1", Version: 1}
46 ExtImageCopyCaptureManagerV1Interface.Requests = []server.Message{
47 {Name: "create_session", Signature: "nou", Types: []*server.Interface{ExtImageCopyCaptureSessionV1Interface, extimagecapturesource.ExtImageCaptureSourceV1Interface, nil}},
48 {Name: "create_pointer_cursor_session", Signature: "noo", Types: []*server.Interface{ExtImageCopyCaptureCursorSessionV1Interface, extimagecapturesource.ExtImageCaptureSourceV1Interface, wayland.PointerInterface}},
49 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
50 }
51 ExtImageCopyCaptureManagerV1Interface.Events = []server.Message{}
52 ExtImageCopyCaptureSessionV1Interface.Requests = []server.Message{
53 {Name: "create_frame", Signature: "n", Types: []*server.Interface{ExtImageCopyCaptureFrameV1Interface}},
54 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
55 }
56 ExtImageCopyCaptureSessionV1Interface.Events = []server.Message{
57 {Name: "buffer_size", Signature: "uu", Types: []*server.Interface{nil, nil}},
58 {Name: "shm_format", Signature: "u", Types: []*server.Interface{nil}},
59 {Name: "dmabuf_device", Signature: "a", Types: []*server.Interface{nil}},
60 {Name: "dmabuf_format", Signature: "ua", Types: []*server.Interface{nil, nil}},
61 {Name: "done", Signature: "", Types: []*server.Interface{}},
62 {Name: "stopped", Signature: "", Types: []*server.Interface{}},
63 }
64 ExtImageCopyCaptureFrameV1Interface.Requests = []server.Message{
65 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
66 {Name: "attach_buffer", Signature: "o", Types: []*server.Interface{wayland.BufferInterface}},
67 {Name: "damage_buffer", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}},
68 {Name: "capture", Signature: "", Types: []*server.Interface{}},
69 }
70 ExtImageCopyCaptureFrameV1Interface.Events = []server.Message{
71 {Name: "transform", Signature: "u", Types: []*server.Interface{nil}},
72 {Name: "damage", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}},
73 {Name: "presentation_time", Signature: "uuu", Types: []*server.Interface{nil, nil, nil}},
74 {Name: "ready", Signature: "", Types: []*server.Interface{}},
75 {Name: "failed", Signature: "u", Types: []*server.Interface{nil}},
76 }
77 ExtImageCopyCaptureCursorSessionV1Interface.Requests = []server.Message{
78 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
79 {Name: "get_capture_session", Signature: "n", Types: []*server.Interface{ExtImageCopyCaptureSessionV1Interface}},
80 }
81 ExtImageCopyCaptureCursorSessionV1Interface.Events = []server.Message{
82 {Name: "enter", Signature: "", Types: []*server.Interface{}},
83 {Name: "leave", Signature: "", Types: []*server.Interface{}},
84 {Name: "position", Signature: "ii", Types: []*server.Interface{nil, nil}},
85 {Name: "hotspot", Signature: "ii", Types: []*server.Interface{nil, nil}},
86 }
87 if err := server.NewInterfaces(ExtImageCopyCaptureManagerV1Interface, ExtImageCopyCaptureSessionV1Interface, ExtImageCopyCaptureFrameV1Interface, ExtImageCopyCaptureCursorSessionV1Interface); err != nil {
88 panic(err)
89 }
90}
91
92// ExtImageCopyCaptureManagerV1 manager to inform clients and begin capturing.
93type ExtImageCopyCaptureManagerV1 struct{ *server.Resource }
94
95func WrapExtImageCopyCaptureManagerV1(r *server.Resource) *ExtImageCopyCaptureManagerV1 {
96 if r == nil {
97 return nil
98 }
99 return &ExtImageCopyCaptureManagerV1{r}
100}
101
102const ExtImageCopyCaptureManagerV1RequestCreateSession uint32 = 0
103const ExtImageCopyCaptureManagerV1RequestCreatePointerCursorSession uint32 = 1
104const ExtImageCopyCaptureManagerV1RequestDestroy uint32 = 2
105
106// ExtImageCopyCaptureManagerV1Error .
107type ExtImageCopyCaptureManagerV1Error uint32
108
109const (
110 ExtImageCopyCaptureManagerV1ErrorInvalidOption ExtImageCopyCaptureManagerV1Error = 1
111)
112
113// ExtImageCopyCaptureManagerV1Options (bitfield).
114type ExtImageCopyCaptureManagerV1Options uint32
115
116const (
117 ExtImageCopyCaptureManagerV1OptionsPaintCursors ExtImageCopyCaptureManagerV1Options = 1
118)
119
120// ExtImageCopyCaptureManagerV1Handler handles ext_image_copy_capture_manager_v1 requests.
121type ExtImageCopyCaptureManagerV1Handler interface {
122 CreateSession(self *ExtImageCopyCaptureManagerV1, session uint32, source *extimagecapturesource.ExtImageCaptureSourceV1, options uint32)
123 CreatePointerCursorSession(self *ExtImageCopyCaptureManagerV1, session uint32, source *extimagecapturesource.ExtImageCaptureSourceV1, pointer *wayland.Pointer)
124 Destroy(self *ExtImageCopyCaptureManagerV1)
125}
126
127func NewExtImageCopyCaptureManagerV1(c server.Client, version int32, id uint32, h ExtImageCopyCaptureManagerV1Handler) (*ExtImageCopyCaptureManagerV1, error) {
128 if h == nil {
129 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_image_copy_capture_manager_v1")
130 }
131 var self *ExtImageCopyCaptureManagerV1
132 r, err := c.CreateResource(ExtImageCopyCaptureManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
133 switch opcode {
134 case 0:
135 h.CreateSession(self, args[0].NewID(), extimagecapturesource.WrapExtImageCaptureSourceV1(args[1].Resource()), args[2].Uint())
136 case 1:
137 h.CreatePointerCursorSession(self, args[0].NewID(), extimagecapturesource.WrapExtImageCaptureSourceV1(args[1].Resource()), wayland.WrapPointer(args[2].Resource()))
138 case 2:
139 h.Destroy(self)
140 self.Destroy()
141 }
142 })
143 if err != nil {
144 return nil, err
145 }
146 self = WrapExtImageCopyCaptureManagerV1(r)
147 r.Data = self
148 return self, nil
149}
150func NewExtImageCopyCaptureManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
151 return d.CreateGlobal(ExtImageCopyCaptureManagerV1Interface, version, bind)
152}
153
154// ExtImageCopyCaptureSessionV1 image copy capture session.
155type ExtImageCopyCaptureSessionV1 struct{ *server.Resource }
156
157func WrapExtImageCopyCaptureSessionV1(r *server.Resource) *ExtImageCopyCaptureSessionV1 {
158 if r == nil {
159 return nil
160 }
161 return &ExtImageCopyCaptureSessionV1{r}
162}
163
164const ExtImageCopyCaptureSessionV1RequestCreateFrame uint32 = 0
165const ExtImageCopyCaptureSessionV1RequestDestroy uint32 = 1
166const ExtImageCopyCaptureSessionV1EventBufferSize uint32 = 0
167const ExtImageCopyCaptureSessionV1EventShmFormat uint32 = 1
168const ExtImageCopyCaptureSessionV1EventDmabufDevice uint32 = 2
169const ExtImageCopyCaptureSessionV1EventDmabufFormat uint32 = 3
170const ExtImageCopyCaptureSessionV1EventDone uint32 = 4
171const ExtImageCopyCaptureSessionV1EventStopped uint32 = 5
172
173// ExtImageCopyCaptureSessionV1Error .
174type ExtImageCopyCaptureSessionV1Error uint32
175
176const (
177 ExtImageCopyCaptureSessionV1ErrorDuplicateFrame ExtImageCopyCaptureSessionV1Error = 1
178)
179
180// ExtImageCopyCaptureSessionV1Handler handles ext_image_copy_capture_session_v1 requests.
181type ExtImageCopyCaptureSessionV1Handler interface {
182 CreateFrame(self *ExtImageCopyCaptureSessionV1, frame uint32)
183 Destroy(self *ExtImageCopyCaptureSessionV1)
184}
185
186func NewExtImageCopyCaptureSessionV1(c server.Client, version int32, id uint32, h ExtImageCopyCaptureSessionV1Handler) (*ExtImageCopyCaptureSessionV1, error) {
187 if h == nil {
188 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_image_copy_capture_session_v1")
189 }
190 var self *ExtImageCopyCaptureSessionV1
191 r, err := c.CreateResource(ExtImageCopyCaptureSessionV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
192 switch opcode {
193 case 0:
194 h.CreateFrame(self, args[0].NewID())
195 case 1:
196 h.Destroy(self)
197 self.Destroy()
198 }
199 })
200 if err != nil {
201 return nil, err
202 }
203 self = WrapExtImageCopyCaptureSessionV1(r)
204 r.Data = self
205 return self, nil
206}
207
208// SendBufferSize image capture source dimensions.
209func (self *ExtImageCopyCaptureSessionV1) SendBufferSize(width uint32, height uint32) {
210 self.PostEvent(ExtImageCopyCaptureSessionV1EventBufferSize, server.Uint(width), server.Uint(height))
211}
212
213// SendShmFormat shm buffer format.
214func (self *ExtImageCopyCaptureSessionV1) SendShmFormat(format uint32) {
215 self.PostEvent(ExtImageCopyCaptureSessionV1EventShmFormat, server.Uint(format))
216}
217
218// SendDmabufDevice dma-buf device.
219func (self *ExtImageCopyCaptureSessionV1) SendDmabufDevice(device []byte) {
220 var p runtime.Pinner
221 defer p.Unpin()
222 self.PostEvent(ExtImageCopyCaptureSessionV1EventDmabufDevice, server.Array(&p, device))
223}
224
225// SendDmabufFormat dma-buf format.
226func (self *ExtImageCopyCaptureSessionV1) SendDmabufFormat(format uint32, modifiers []byte) {
227 var p runtime.Pinner
228 defer p.Unpin()
229 self.PostEvent(ExtImageCopyCaptureSessionV1EventDmabufFormat, server.Uint(format), server.Array(&p, modifiers))
230}
231
232// SendDone all constraints have been sent.
233func (self *ExtImageCopyCaptureSessionV1) SendDone() {
234 self.PostEvent(ExtImageCopyCaptureSessionV1EventDone)
235}
236
237// SendStopped session is no longer available.
238func (self *ExtImageCopyCaptureSessionV1) SendStopped() {
239 self.PostEvent(ExtImageCopyCaptureSessionV1EventStopped)
240}
241func NewExtImageCopyCaptureSessionV1Global(d *server.Display, version int32, bind server.BindFunc) error {
242 return d.CreateGlobal(ExtImageCopyCaptureSessionV1Interface, version, bind)
243}
244
245// ExtImageCopyCaptureFrameV1 image capture frame.
246type ExtImageCopyCaptureFrameV1 struct{ *server.Resource }
247
248func WrapExtImageCopyCaptureFrameV1(r *server.Resource) *ExtImageCopyCaptureFrameV1 {
249 if r == nil {
250 return nil
251 }
252 return &ExtImageCopyCaptureFrameV1{r}
253}
254
255const ExtImageCopyCaptureFrameV1RequestDestroy uint32 = 0
256const ExtImageCopyCaptureFrameV1RequestAttachBuffer uint32 = 1
257const ExtImageCopyCaptureFrameV1RequestDamageBuffer uint32 = 2
258const ExtImageCopyCaptureFrameV1RequestCapture uint32 = 3
259const ExtImageCopyCaptureFrameV1EventTransform uint32 = 0
260const ExtImageCopyCaptureFrameV1EventDamage uint32 = 1
261const ExtImageCopyCaptureFrameV1EventPresentationTime uint32 = 2
262const ExtImageCopyCaptureFrameV1EventReady uint32 = 3
263const ExtImageCopyCaptureFrameV1EventFailed uint32 = 4
264
265// ExtImageCopyCaptureFrameV1Error .
266type ExtImageCopyCaptureFrameV1Error uint32
267
268const (
269 ExtImageCopyCaptureFrameV1ErrorNoBuffer ExtImageCopyCaptureFrameV1Error = 1
270 ExtImageCopyCaptureFrameV1ErrorInvalidBufferDamage ExtImageCopyCaptureFrameV1Error = 2
271 ExtImageCopyCaptureFrameV1ErrorAlreadyCaptured ExtImageCopyCaptureFrameV1Error = 3
272)
273
274// ExtImageCopyCaptureFrameV1FailureReason .
275type ExtImageCopyCaptureFrameV1FailureReason uint32
276
277const (
278 ExtImageCopyCaptureFrameV1FailureReasonUnknown ExtImageCopyCaptureFrameV1FailureReason = 0
279 ExtImageCopyCaptureFrameV1FailureReasonBufferConstraints ExtImageCopyCaptureFrameV1FailureReason = 1
280 ExtImageCopyCaptureFrameV1FailureReasonStopped ExtImageCopyCaptureFrameV1FailureReason = 2
281)
282
283// ExtImageCopyCaptureFrameV1Handler handles ext_image_copy_capture_frame_v1 requests.
284type ExtImageCopyCaptureFrameV1Handler interface {
285 Destroy(self *ExtImageCopyCaptureFrameV1)
286 AttachBuffer(self *ExtImageCopyCaptureFrameV1, buffer *wayland.Buffer)
287 DamageBuffer(self *ExtImageCopyCaptureFrameV1, x int32, y int32, width int32, height int32)
288 Capture(self *ExtImageCopyCaptureFrameV1)
289}
290
291func NewExtImageCopyCaptureFrameV1(c server.Client, version int32, id uint32, h ExtImageCopyCaptureFrameV1Handler) (*ExtImageCopyCaptureFrameV1, error) {
292 if h == nil {
293 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_image_copy_capture_frame_v1")
294 }
295 var self *ExtImageCopyCaptureFrameV1
296 r, err := c.CreateResource(ExtImageCopyCaptureFrameV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
297 switch opcode {
298 case 0:
299 h.Destroy(self)
300 self.Destroy()
301 case 1:
302 h.AttachBuffer(self, wayland.WrapBuffer(args[0].Resource()))
303 case 2:
304 h.DamageBuffer(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int())
305 case 3:
306 h.Capture(self)
307 }
308 })
309 if err != nil {
310 return nil, err
311 }
312 self = WrapExtImageCopyCaptureFrameV1(r)
313 r.Data = self
314 return self, nil
315}
316
317// SendTransform buffer transform.
318func (self *ExtImageCopyCaptureFrameV1) SendTransform(transform uint32) {
319 self.PostEvent(ExtImageCopyCaptureFrameV1EventTransform, server.Uint(transform))
320}
321
322// SendDamage buffer damaged region.
323func (self *ExtImageCopyCaptureFrameV1) SendDamage(x int32, y int32, width int32, height int32) {
324 self.PostEvent(ExtImageCopyCaptureFrameV1EventDamage, server.Int(x), server.Int(y), server.Int(width), server.Int(height))
325}
326
327// SendPresentationTime presentation time of the frame.
328func (self *ExtImageCopyCaptureFrameV1) SendPresentationTime(tvSecHi uint32, tvSecLo uint32, tvNsec uint32) {
329 self.PostEvent(ExtImageCopyCaptureFrameV1EventPresentationTime, server.Uint(tvSecHi), server.Uint(tvSecLo), server.Uint(tvNsec))
330}
331
332// SendReady frame is available for reading.
333func (self *ExtImageCopyCaptureFrameV1) SendReady() {
334 self.PostEvent(ExtImageCopyCaptureFrameV1EventReady)
335}
336
337// SendFailed capture failed.
338func (self *ExtImageCopyCaptureFrameV1) SendFailed(reason uint32) {
339 self.PostEvent(ExtImageCopyCaptureFrameV1EventFailed, server.Uint(reason))
340}
341func NewExtImageCopyCaptureFrameV1Global(d *server.Display, version int32, bind server.BindFunc) error {
342 return d.CreateGlobal(ExtImageCopyCaptureFrameV1Interface, version, bind)
343}
344
345// ExtImageCopyCaptureCursorSessionV1 cursor capture session.
346type ExtImageCopyCaptureCursorSessionV1 struct{ *server.Resource }
347
348func WrapExtImageCopyCaptureCursorSessionV1(r *server.Resource) *ExtImageCopyCaptureCursorSessionV1 {
349 if r == nil {
350 return nil
351 }
352 return &ExtImageCopyCaptureCursorSessionV1{r}
353}
354
355const ExtImageCopyCaptureCursorSessionV1RequestDestroy uint32 = 0
356const ExtImageCopyCaptureCursorSessionV1RequestGetCaptureSession uint32 = 1
357const ExtImageCopyCaptureCursorSessionV1EventEnter uint32 = 0
358const ExtImageCopyCaptureCursorSessionV1EventLeave uint32 = 1
359const ExtImageCopyCaptureCursorSessionV1EventPosition uint32 = 2
360const ExtImageCopyCaptureCursorSessionV1EventHotspot uint32 = 3
361
362// ExtImageCopyCaptureCursorSessionV1Error .
363type ExtImageCopyCaptureCursorSessionV1Error uint32
364
365const (
366 ExtImageCopyCaptureCursorSessionV1ErrorDuplicateSession ExtImageCopyCaptureCursorSessionV1Error = 1
367)
368
369// ExtImageCopyCaptureCursorSessionV1Handler handles ext_image_copy_capture_cursor_session_v1 requests.
370type ExtImageCopyCaptureCursorSessionV1Handler interface {
371 Destroy(self *ExtImageCopyCaptureCursorSessionV1)
372 GetCaptureSession(self *ExtImageCopyCaptureCursorSessionV1, session uint32)
373}
374
375func NewExtImageCopyCaptureCursorSessionV1(c server.Client, version int32, id uint32, h ExtImageCopyCaptureCursorSessionV1Handler) (*ExtImageCopyCaptureCursorSessionV1, error) {
376 if h == nil {
377 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_image_copy_capture_cursor_session_v1")
378 }
379 var self *ExtImageCopyCaptureCursorSessionV1
380 r, err := c.CreateResource(ExtImageCopyCaptureCursorSessionV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
381 switch opcode {
382 case 0:
383 h.Destroy(self)
384 self.Destroy()
385 case 1:
386 h.GetCaptureSession(self, args[0].NewID())
387 }
388 })
389 if err != nil {
390 return nil, err
391 }
392 self = WrapExtImageCopyCaptureCursorSessionV1(r)
393 r.Data = self
394 return self, nil
395}
396
397// SendEnter cursor entered captured area.
398func (self *ExtImageCopyCaptureCursorSessionV1) SendEnter() {
399 self.PostEvent(ExtImageCopyCaptureCursorSessionV1EventEnter)
400}
401
402// SendLeave cursor left captured area.
403func (self *ExtImageCopyCaptureCursorSessionV1) SendLeave() {
404 self.PostEvent(ExtImageCopyCaptureCursorSessionV1EventLeave)
405}
406
407// SendPosition position changed.
408func (self *ExtImageCopyCaptureCursorSessionV1) SendPosition(x int32, y int32) {
409 self.PostEvent(ExtImageCopyCaptureCursorSessionV1EventPosition, server.Int(x), server.Int(y))
410}
411
412// SendHotspot hotspot changed.
413func (self *ExtImageCopyCaptureCursorSessionV1) SendHotspot(x int32, y int32) {
414 self.PostEvent(ExtImageCopyCaptureCursorSessionV1EventHotspot, server.Int(x), server.Int(y))
415}
416func NewExtImageCopyCaptureCursorSessionV1Global(d *server.Display, version int32, bind server.BindFunc) error {
417 return d.CreateGlobal(ExtImageCopyCaptureCursorSessionV1Interface, version, bind)
418}
419func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
420 if v == nil {
421 return nil
422 }
423 return v.GetResource()
424}
425func (self *ExtImageCopyCaptureManagerV1) GetResource() *server.Resource {
426 if self == nil {
427 return nil
428 }
429 return self.Resource
430}
431func (self *ExtImageCopyCaptureSessionV1) GetResource() *server.Resource {
432 if self == nil {
433 return nil
434 }
435 return self.Resource
436}
437func (self *ExtImageCopyCaptureFrameV1) GetResource() *server.Resource {
438 if self == nil {
439 return nil
440 }
441 return self.Resource
442}
443func (self *ExtImageCopyCaptureCursorSessionV1) GetResource() *server.Resource {
444 if self == nil {
445 return nil
446 }
447 return self.Resource
448}