1// Code generated by wlgen; DO NOT EDIT.
2package extsessionlock
3
4import (
5 "fmt"
6 wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7 "github.com/bnema/purego-libwayland/server"
8)
9
10var ExtSessionLockManagerV1Interface *server.Interface
11var ExtSessionLockV1Interface *server.Interface
12var ExtSessionLockSurfaceV1Interface *server.Interface
13
14func init() {
15 ExtSessionLockManagerV1Interface = &server.Interface{Name: "ext_session_lock_manager_v1", Version: 1}
16 ExtSessionLockV1Interface = &server.Interface{Name: "ext_session_lock_v1", Version: 1}
17 ExtSessionLockSurfaceV1Interface = &server.Interface{Name: "ext_session_lock_surface_v1", Version: 1}
18 ExtSessionLockManagerV1Interface.Requests = []server.Message{
19 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
20 {Name: "lock", Signature: "n", Types: []*server.Interface{ExtSessionLockV1Interface}},
21 }
22 ExtSessionLockManagerV1Interface.Events = []server.Message{}
23 ExtSessionLockV1Interface.Requests = []server.Message{
24 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
25 {Name: "get_lock_surface", Signature: "noo", Types: []*server.Interface{ExtSessionLockSurfaceV1Interface, wayland.SurfaceInterface, wayland.OutputInterface}},
26 {Name: "unlock_and_destroy", Signature: "", Types: []*server.Interface{}},
27 }
28 ExtSessionLockV1Interface.Events = []server.Message{
29 {Name: "locked", Signature: "", Types: []*server.Interface{}},
30 {Name: "finished", Signature: "", Types: []*server.Interface{}},
31 }
32 ExtSessionLockSurfaceV1Interface.Requests = []server.Message{
33 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
34 {Name: "ack_configure", Signature: "u", Types: []*server.Interface{nil}},
35 }
36 ExtSessionLockSurfaceV1Interface.Events = []server.Message{
37 {Name: "configure", Signature: "uuu", Types: []*server.Interface{nil, nil, nil}},
38 }
39 if err := server.NewInterfaces(ExtSessionLockManagerV1Interface, ExtSessionLockV1Interface, ExtSessionLockSurfaceV1Interface); err != nil {
40 panic(err)
41 }
42}
43
44// ExtSessionLockManagerV1 used to lock the session.
45type ExtSessionLockManagerV1 struct{ *server.Resource }
46
47func WrapExtSessionLockManagerV1(r *server.Resource) *ExtSessionLockManagerV1 {
48 if r == nil {
49 return nil
50 }
51 return &ExtSessionLockManagerV1{r}
52}
53
54const ExtSessionLockManagerV1RequestDestroy uint32 = 0
55const ExtSessionLockManagerV1RequestLock uint32 = 1
56
57// ExtSessionLockManagerV1Handler handles ext_session_lock_manager_v1 requests.
58type ExtSessionLockManagerV1Handler interface {
59 Destroy(self *ExtSessionLockManagerV1)
60 Lock(self *ExtSessionLockManagerV1, id uint32)
61}
62
63func NewExtSessionLockManagerV1(c server.Client, version int32, id uint32, h ExtSessionLockManagerV1Handler) (*ExtSessionLockManagerV1, error) {
64 if h == nil {
65 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_session_lock_manager_v1")
66 }
67 var self *ExtSessionLockManagerV1
68 r, err := c.CreateResource(ExtSessionLockManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
69 switch opcode {
70 case 0:
71 h.Destroy(self)
72 self.Destroy()
73 case 1:
74 h.Lock(self, args[0].NewID())
75 }
76 })
77 if err != nil {
78 return nil, err
79 }
80 self = WrapExtSessionLockManagerV1(r)
81 r.Data = self
82 return self, nil
83}
84func NewExtSessionLockManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
85 return d.CreateGlobal(ExtSessionLockManagerV1Interface, version, bind)
86}
87
88// ExtSessionLockV1 manage lock state and create lock surfaces.
89type ExtSessionLockV1 struct{ *server.Resource }
90
91func WrapExtSessionLockV1(r *server.Resource) *ExtSessionLockV1 {
92 if r == nil {
93 return nil
94 }
95 return &ExtSessionLockV1{r}
96}
97
98const ExtSessionLockV1RequestDestroy uint32 = 0
99const ExtSessionLockV1RequestGetLockSurface uint32 = 1
100const ExtSessionLockV1RequestUnlockAndDestroy uint32 = 2
101const ExtSessionLockV1EventLocked uint32 = 0
102const ExtSessionLockV1EventFinished uint32 = 1
103
104// ExtSessionLockV1Error .
105type ExtSessionLockV1Error uint32
106
107const (
108 ExtSessionLockV1ErrorInvalidDestroy ExtSessionLockV1Error = 0
109 ExtSessionLockV1ErrorInvalidUnlock ExtSessionLockV1Error = 1
110 ExtSessionLockV1ErrorRole ExtSessionLockV1Error = 2
111 ExtSessionLockV1ErrorDuplicateOutput ExtSessionLockV1Error = 3
112 ExtSessionLockV1ErrorAlreadyConstructed ExtSessionLockV1Error = 4
113)
114
115// ExtSessionLockV1Handler handles ext_session_lock_v1 requests.
116type ExtSessionLockV1Handler interface {
117 Destroy(self *ExtSessionLockV1)
118 GetLockSurface(self *ExtSessionLockV1, id uint32, surface *wayland.Surface, output *wayland.Output)
119 UnlockAndDestroy(self *ExtSessionLockV1)
120}
121
122func NewExtSessionLockV1(c server.Client, version int32, id uint32, h ExtSessionLockV1Handler) (*ExtSessionLockV1, error) {
123 if h == nil {
124 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_session_lock_v1")
125 }
126 var self *ExtSessionLockV1
127 r, err := c.CreateResource(ExtSessionLockV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
128 switch opcode {
129 case 0:
130 h.Destroy(self)
131 self.Destroy()
132 case 1:
133 h.GetLockSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapOutput(args[2].Resource()))
134 case 2:
135 h.UnlockAndDestroy(self)
136 self.Destroy()
137 }
138 })
139 if err != nil {
140 return nil, err
141 }
142 self = WrapExtSessionLockV1(r)
143 r.Data = self
144 return self, nil
145}
146
147// SendLocked session successfully locked.
148func (self *ExtSessionLockV1) SendLocked() {
149 self.PostEvent(ExtSessionLockV1EventLocked)
150}
151
152// SendFinished the session lock object should be destroyed.
153func (self *ExtSessionLockV1) SendFinished() {
154 self.PostEvent(ExtSessionLockV1EventFinished)
155}
156func NewExtSessionLockV1Global(d *server.Display, version int32, bind server.BindFunc) error {
157 return d.CreateGlobal(ExtSessionLockV1Interface, version, bind)
158}
159
160// ExtSessionLockSurfaceV1 a surface displayed while the session is locked.
161type ExtSessionLockSurfaceV1 struct{ *server.Resource }
162
163func WrapExtSessionLockSurfaceV1(r *server.Resource) *ExtSessionLockSurfaceV1 {
164 if r == nil {
165 return nil
166 }
167 return &ExtSessionLockSurfaceV1{r}
168}
169
170const ExtSessionLockSurfaceV1RequestDestroy uint32 = 0
171const ExtSessionLockSurfaceV1RequestAckConfigure uint32 = 1
172const ExtSessionLockSurfaceV1EventConfigure uint32 = 0
173
174// ExtSessionLockSurfaceV1Error .
175type ExtSessionLockSurfaceV1Error uint32
176
177const (
178 ExtSessionLockSurfaceV1ErrorCommitBeforeFirstAck ExtSessionLockSurfaceV1Error = 0
179 ExtSessionLockSurfaceV1ErrorNullBuffer ExtSessionLockSurfaceV1Error = 1
180 ExtSessionLockSurfaceV1ErrorDimensionsMismatch ExtSessionLockSurfaceV1Error = 2
181 ExtSessionLockSurfaceV1ErrorInvalidSerial ExtSessionLockSurfaceV1Error = 3
182)
183
184// ExtSessionLockSurfaceV1Handler handles ext_session_lock_surface_v1 requests.
185type ExtSessionLockSurfaceV1Handler interface {
186 Destroy(self *ExtSessionLockSurfaceV1)
187 AckConfigure(self *ExtSessionLockSurfaceV1, serial uint32)
188}
189
190func NewExtSessionLockSurfaceV1(c server.Client, version int32, id uint32, h ExtSessionLockSurfaceV1Handler) (*ExtSessionLockSurfaceV1, error) {
191 if h == nil {
192 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_session_lock_surface_v1")
193 }
194 var self *ExtSessionLockSurfaceV1
195 r, err := c.CreateResource(ExtSessionLockSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
196 switch opcode {
197 case 0:
198 h.Destroy(self)
199 self.Destroy()
200 case 1:
201 h.AckConfigure(self, args[0].Uint())
202 }
203 })
204 if err != nil {
205 return nil, err
206 }
207 self = WrapExtSessionLockSurfaceV1(r)
208 r.Data = self
209 return self, nil
210}
211
212// SendConfigure the client should resize its surface.
213func (self *ExtSessionLockSurfaceV1) SendConfigure(serial uint32, width uint32, height uint32) {
214 self.PostEvent(ExtSessionLockSurfaceV1EventConfigure, server.Uint(serial), server.Uint(width), server.Uint(height))
215}
216func NewExtSessionLockSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error {
217 return d.CreateGlobal(ExtSessionLockSurfaceV1Interface, version, bind)
218}
219func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
220 if v == nil {
221 return nil
222 }
223 return v.GetResource()
224}
225func (self *ExtSessionLockManagerV1) GetResource() *server.Resource {
226 if self == nil {
227 return nil
228 }
229 return self.Resource
230}
231func (self *ExtSessionLockV1) GetResource() *server.Resource {
232 if self == nil {
233 return nil
234 }
235 return self.Resource
236}
237func (self *ExtSessionLockSurfaceV1) GetResource() *server.Resource {
238 if self == nil {
239 return nil
240 }
241 return self.Resource
242}