1// Code generated by wlgen; DO NOT EDIT.
2package extworkspace
3
4import (
5 "fmt"
6 wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7 "github.com/bnema/purego-libwayland/server"
8 "runtime"
9)
10
11var ExtWorkspaceManagerV1Interface *server.Interface
12var ExtWorkspaceGroupHandleV1Interface *server.Interface
13var ExtWorkspaceHandleV1Interface *server.Interface
14
15func init() {
16 ExtWorkspaceManagerV1Interface = &server.Interface{Name: "ext_workspace_manager_v1", Version: 1}
17 ExtWorkspaceGroupHandleV1Interface = &server.Interface{Name: "ext_workspace_group_handle_v1", Version: 1}
18 ExtWorkspaceHandleV1Interface = &server.Interface{Name: "ext_workspace_handle_v1", Version: 1}
19 ExtWorkspaceManagerV1Interface.Requests = []server.Message{
20 {Name: "commit", Signature: "", Types: []*server.Interface{}},
21 {Name: "stop", Signature: "", Types: []*server.Interface{}},
22 }
23 ExtWorkspaceManagerV1Interface.Events = []server.Message{
24 {Name: "workspace_group", Signature: "n", Types: []*server.Interface{ExtWorkspaceGroupHandleV1Interface}},
25 {Name: "workspace", Signature: "n", Types: []*server.Interface{ExtWorkspaceHandleV1Interface}},
26 {Name: "done", Signature: "", Types: []*server.Interface{}},
27 {Name: "finished", Signature: "", Types: []*server.Interface{}},
28 }
29 ExtWorkspaceGroupHandleV1Interface.Requests = []server.Message{
30 {Name: "create_workspace", Signature: "s", Types: []*server.Interface{nil}},
31 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
32 }
33 ExtWorkspaceGroupHandleV1Interface.Events = []server.Message{
34 {Name: "capabilities", Signature: "u", Types: []*server.Interface{nil}},
35 {Name: "output_enter", Signature: "o", Types: []*server.Interface{wayland.OutputInterface}},
36 {Name: "output_leave", Signature: "o", Types: []*server.Interface{wayland.OutputInterface}},
37 {Name: "workspace_enter", Signature: "o", Types: []*server.Interface{ExtWorkspaceHandleV1Interface}},
38 {Name: "workspace_leave", Signature: "o", Types: []*server.Interface{ExtWorkspaceHandleV1Interface}},
39 {Name: "removed", Signature: "", Types: []*server.Interface{}},
40 }
41 ExtWorkspaceHandleV1Interface.Requests = []server.Message{
42 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
43 {Name: "activate", Signature: "", Types: []*server.Interface{}},
44 {Name: "deactivate", Signature: "", Types: []*server.Interface{}},
45 {Name: "assign", Signature: "o", Types: []*server.Interface{ExtWorkspaceGroupHandleV1Interface}},
46 {Name: "remove", Signature: "", Types: []*server.Interface{}},
47 }
48 ExtWorkspaceHandleV1Interface.Events = []server.Message{
49 {Name: "id", Signature: "s", Types: []*server.Interface{nil}},
50 {Name: "name", Signature: "s", Types: []*server.Interface{nil}},
51 {Name: "coordinates", Signature: "a", Types: []*server.Interface{nil}},
52 {Name: "state", Signature: "u", Types: []*server.Interface{nil}},
53 {Name: "capabilities", Signature: "u", Types: []*server.Interface{nil}},
54 {Name: "removed", Signature: "", Types: []*server.Interface{}},
55 }
56 if err := server.NewInterfaces(ExtWorkspaceManagerV1Interface, ExtWorkspaceGroupHandleV1Interface, ExtWorkspaceHandleV1Interface); err != nil {
57 panic(err)
58 }
59}
60
61// ExtWorkspaceManagerV1 list and control workspaces.
62type ExtWorkspaceManagerV1 struct{ *server.Resource }
63
64func WrapExtWorkspaceManagerV1(r *server.Resource) *ExtWorkspaceManagerV1 {
65 if r == nil {
66 return nil
67 }
68 return &ExtWorkspaceManagerV1{r}
69}
70
71const ExtWorkspaceManagerV1RequestCommit uint32 = 0
72const ExtWorkspaceManagerV1RequestStop uint32 = 1
73const ExtWorkspaceManagerV1EventWorkspaceGroup uint32 = 0
74const ExtWorkspaceManagerV1EventWorkspace uint32 = 1
75const ExtWorkspaceManagerV1EventDone uint32 = 2
76const ExtWorkspaceManagerV1EventFinished uint32 = 3
77
78// ExtWorkspaceManagerV1Handler handles ext_workspace_manager_v1 requests.
79type ExtWorkspaceManagerV1Handler interface {
80 Commit(self *ExtWorkspaceManagerV1)
81 Stop(self *ExtWorkspaceManagerV1)
82}
83
84func NewExtWorkspaceManagerV1(c server.Client, version int32, id uint32, h ExtWorkspaceManagerV1Handler) (*ExtWorkspaceManagerV1, error) {
85 if h == nil {
86 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_workspace_manager_v1")
87 }
88 var self *ExtWorkspaceManagerV1
89 r, err := c.CreateResource(ExtWorkspaceManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
90 switch opcode {
91 case 0:
92 h.Commit(self)
93 case 1:
94 h.Stop(self)
95 }
96 })
97 if err != nil {
98 return nil, err
99 }
100 self = WrapExtWorkspaceManagerV1(r)
101 r.Data = self
102 return self, nil
103}
104
105// SendWorkspaceGroup a workspace group has been created.
106func (self *ExtWorkspaceManagerV1) SendWorkspaceGroup(workspaceGroup *ExtWorkspaceGroupHandleV1) {
107 self.PostEvent(ExtWorkspaceManagerV1EventWorkspaceGroup, server.NewID(resourceOf(workspaceGroup)))
108}
109
110// SendWorkspace workspace has been created.
111func (self *ExtWorkspaceManagerV1) SendWorkspace(workspace *ExtWorkspaceHandleV1) {
112 self.PostEvent(ExtWorkspaceManagerV1EventWorkspace, server.NewID(resourceOf(workspace)))
113}
114
115// SendDone all information about the workspaces and workspace groups has been sent.
116func (self *ExtWorkspaceManagerV1) SendDone() {
117 self.PostEvent(ExtWorkspaceManagerV1EventDone)
118}
119
120// SendFinished the compositor has finished with the workspace_manager.
121func (self *ExtWorkspaceManagerV1) SendFinished() {
122 self.PostEvent(ExtWorkspaceManagerV1EventFinished)
123}
124func NewExtWorkspaceManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
125 return d.CreateGlobal(ExtWorkspaceManagerV1Interface, version, bind)
126}
127
128// ExtWorkspaceGroupHandleV1 a workspace group assigned to a set of outputs.
129type ExtWorkspaceGroupHandleV1 struct{ *server.Resource }
130
131func WrapExtWorkspaceGroupHandleV1(r *server.Resource) *ExtWorkspaceGroupHandleV1 {
132 if r == nil {
133 return nil
134 }
135 return &ExtWorkspaceGroupHandleV1{r}
136}
137
138const ExtWorkspaceGroupHandleV1RequestCreateWorkspace uint32 = 0
139const ExtWorkspaceGroupHandleV1RequestDestroy uint32 = 1
140const ExtWorkspaceGroupHandleV1EventCapabilities uint32 = 0
141const ExtWorkspaceGroupHandleV1EventOutputEnter uint32 = 1
142const ExtWorkspaceGroupHandleV1EventOutputLeave uint32 = 2
143const ExtWorkspaceGroupHandleV1EventWorkspaceEnter uint32 = 3
144const ExtWorkspaceGroupHandleV1EventWorkspaceLeave uint32 = 4
145const ExtWorkspaceGroupHandleV1EventRemoved uint32 = 5
146
147// ExtWorkspaceGroupHandleV1GroupCapabilities (bitfield).
148type ExtWorkspaceGroupHandleV1GroupCapabilities uint32
149
150const (
151 ExtWorkspaceGroupHandleV1GroupCapabilitiesCreateWorkspace ExtWorkspaceGroupHandleV1GroupCapabilities = 1
152)
153
154// ExtWorkspaceGroupHandleV1Handler handles ext_workspace_group_handle_v1 requests.
155type ExtWorkspaceGroupHandleV1Handler interface {
156 CreateWorkspace(self *ExtWorkspaceGroupHandleV1, workspace string)
157 Destroy(self *ExtWorkspaceGroupHandleV1)
158}
159
160func NewExtWorkspaceGroupHandleV1(c server.Client, version int32, id uint32, h ExtWorkspaceGroupHandleV1Handler) (*ExtWorkspaceGroupHandleV1, error) {
161 if h == nil {
162 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_workspace_group_handle_v1")
163 }
164 var self *ExtWorkspaceGroupHandleV1
165 r, err := c.CreateResource(ExtWorkspaceGroupHandleV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
166 switch opcode {
167 case 0:
168 h.CreateWorkspace(self, args[0].String())
169 case 1:
170 h.Destroy(self)
171 self.Destroy()
172 }
173 })
174 if err != nil {
175 return nil, err
176 }
177 self = WrapExtWorkspaceGroupHandleV1(r)
178 r.Data = self
179 return self, nil
180}
181
182// SendCapabilities compositor capabilities.
183func (self *ExtWorkspaceGroupHandleV1) SendCapabilities(capabilities uint32) {
184 self.PostEvent(ExtWorkspaceGroupHandleV1EventCapabilities, server.Uint(capabilities))
185}
186
187// SendOutputEnter output assigned to workspace group.
188func (self *ExtWorkspaceGroupHandleV1) SendOutputEnter(output *wayland.Output) {
189 self.PostEvent(ExtWorkspaceGroupHandleV1EventOutputEnter, server.Object(resourceOf(output)))
190}
191
192// SendOutputLeave output removed from workspace group.
193func (self *ExtWorkspaceGroupHandleV1) SendOutputLeave(output *wayland.Output) {
194 self.PostEvent(ExtWorkspaceGroupHandleV1EventOutputLeave, server.Object(resourceOf(output)))
195}
196
197// SendWorkspaceEnter workspace added to workspace group.
198func (self *ExtWorkspaceGroupHandleV1) SendWorkspaceEnter(workspace *ExtWorkspaceHandleV1) {
199 self.PostEvent(ExtWorkspaceGroupHandleV1EventWorkspaceEnter, server.Object(resourceOf(workspace)))
200}
201
202// SendWorkspaceLeave workspace removed from workspace group.
203func (self *ExtWorkspaceGroupHandleV1) SendWorkspaceLeave(workspace *ExtWorkspaceHandleV1) {
204 self.PostEvent(ExtWorkspaceGroupHandleV1EventWorkspaceLeave, server.Object(resourceOf(workspace)))
205}
206
207// SendRemoved this workspace group has been removed.
208func (self *ExtWorkspaceGroupHandleV1) SendRemoved() {
209 self.PostEvent(ExtWorkspaceGroupHandleV1EventRemoved)
210}
211func NewExtWorkspaceGroupHandleV1Global(d *server.Display, version int32, bind server.BindFunc) error {
212 return d.CreateGlobal(ExtWorkspaceGroupHandleV1Interface, version, bind)
213}
214
215// ExtWorkspaceHandleV1 a workspace handing a group of surfaces.
216type ExtWorkspaceHandleV1 struct{ *server.Resource }
217
218func WrapExtWorkspaceHandleV1(r *server.Resource) *ExtWorkspaceHandleV1 {
219 if r == nil {
220 return nil
221 }
222 return &ExtWorkspaceHandleV1{r}
223}
224
225const ExtWorkspaceHandleV1RequestDestroy uint32 = 0
226const ExtWorkspaceHandleV1RequestActivate uint32 = 1
227const ExtWorkspaceHandleV1RequestDeactivate uint32 = 2
228const ExtWorkspaceHandleV1RequestAssign uint32 = 3
229const ExtWorkspaceHandleV1RequestRemove uint32 = 4
230const ExtWorkspaceHandleV1EventId uint32 = 0
231const ExtWorkspaceHandleV1EventName uint32 = 1
232const ExtWorkspaceHandleV1EventCoordinates uint32 = 2
233const ExtWorkspaceHandleV1EventState uint32 = 3
234const ExtWorkspaceHandleV1EventCapabilities uint32 = 4
235const ExtWorkspaceHandleV1EventRemoved uint32 = 5
236
237// ExtWorkspaceHandleV1State types of states on the workspace (bitfield).
238type ExtWorkspaceHandleV1State uint32
239
240const (
241 ExtWorkspaceHandleV1StateActive ExtWorkspaceHandleV1State = 1
242 ExtWorkspaceHandleV1StateUrgent ExtWorkspaceHandleV1State = 2
243 ExtWorkspaceHandleV1StateHidden ExtWorkspaceHandleV1State = 4
244)
245
246// ExtWorkspaceHandleV1WorkspaceCapabilities (bitfield).
247type ExtWorkspaceHandleV1WorkspaceCapabilities uint32
248
249const (
250 ExtWorkspaceHandleV1WorkspaceCapabilitiesActivate ExtWorkspaceHandleV1WorkspaceCapabilities = 1
251 ExtWorkspaceHandleV1WorkspaceCapabilitiesDeactivate ExtWorkspaceHandleV1WorkspaceCapabilities = 2
252 ExtWorkspaceHandleV1WorkspaceCapabilitiesRemove ExtWorkspaceHandleV1WorkspaceCapabilities = 4
253 ExtWorkspaceHandleV1WorkspaceCapabilitiesAssign ExtWorkspaceHandleV1WorkspaceCapabilities = 8
254)
255
256// ExtWorkspaceHandleV1Handler handles ext_workspace_handle_v1 requests.
257type ExtWorkspaceHandleV1Handler interface {
258 Destroy(self *ExtWorkspaceHandleV1)
259 Activate(self *ExtWorkspaceHandleV1)
260 Deactivate(self *ExtWorkspaceHandleV1)
261 Assign(self *ExtWorkspaceHandleV1, workspaceGroup *ExtWorkspaceGroupHandleV1)
262 Remove(self *ExtWorkspaceHandleV1)
263}
264
265func NewExtWorkspaceHandleV1(c server.Client, version int32, id uint32, h ExtWorkspaceHandleV1Handler) (*ExtWorkspaceHandleV1, error) {
266 if h == nil {
267 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_workspace_handle_v1")
268 }
269 var self *ExtWorkspaceHandleV1
270 r, err := c.CreateResource(ExtWorkspaceHandleV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
271 switch opcode {
272 case 0:
273 h.Destroy(self)
274 self.Destroy()
275 case 1:
276 h.Activate(self)
277 case 2:
278 h.Deactivate(self)
279 case 3:
280 h.Assign(self, WrapExtWorkspaceGroupHandleV1(args[0].Resource()))
281 case 4:
282 h.Remove(self)
283 }
284 })
285 if err != nil {
286 return nil, err
287 }
288 self = WrapExtWorkspaceHandleV1(r)
289 r.Data = self
290 return self, nil
291}
292
293// SendId workspace id.
294func (self *ExtWorkspaceHandleV1) SendId(id string) {
295 var p runtime.Pinner
296 defer p.Unpin()
297 self.PostEvent(ExtWorkspaceHandleV1EventId, server.String(&p, id, false))
298}
299
300// SendName workspace name changed.
301func (self *ExtWorkspaceHandleV1) SendName(name string) {
302 var p runtime.Pinner
303 defer p.Unpin()
304 self.PostEvent(ExtWorkspaceHandleV1EventName, server.String(&p, name, false))
305}
306
307// SendCoordinates workspace coordinates changed.
308func (self *ExtWorkspaceHandleV1) SendCoordinates(coordinates []byte) {
309 var p runtime.Pinner
310 defer p.Unpin()
311 self.PostEvent(ExtWorkspaceHandleV1EventCoordinates, server.Array(&p, coordinates))
312}
313
314// SendState the state of the workspace changed.
315func (self *ExtWorkspaceHandleV1) SendState(state uint32) {
316 self.PostEvent(ExtWorkspaceHandleV1EventState, server.Uint(state))
317}
318
319// SendCapabilities compositor capabilities.
320func (self *ExtWorkspaceHandleV1) SendCapabilities(capabilities uint32) {
321 self.PostEvent(ExtWorkspaceHandleV1EventCapabilities, server.Uint(capabilities))
322}
323
324// SendRemoved this workspace has been removed.
325func (self *ExtWorkspaceHandleV1) SendRemoved() {
326 self.PostEvent(ExtWorkspaceHandleV1EventRemoved)
327}
328func NewExtWorkspaceHandleV1Global(d *server.Display, version int32, bind server.BindFunc) error {
329 return d.CreateGlobal(ExtWorkspaceHandleV1Interface, version, bind)
330}
331func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
332 if v == nil {
333 return nil
334 }
335 return v.GetResource()
336}
337func (self *ExtWorkspaceManagerV1) GetResource() *server.Resource {
338 if self == nil {
339 return nil
340 }
341 return self.Resource
342}
343func (self *ExtWorkspaceGroupHandleV1) GetResource() *server.Resource {
344 if self == nil {
345 return nil
346 }
347 return self.Resource
348}
349func (self *ExtWorkspaceHandleV1) GetResource() *server.Resource {
350 if self == nil {
351 return nil
352 }
353 return self.Resource
354}