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