1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2017 Drew DeVault
5//
6// Permission to use, copy, modify, distribute, and sell this
7// software and its documentation for any purpose is hereby granted
8// without fee, provided that the above copyright notice appear in
9// all copies and that both that copyright notice and this permission
10// notice appear in supporting documentation, and that the name of
11// the copyright holders not be used in advertising or publicity
12// pertaining to distribution of the software without specific,
13// written prior permission. The copyright holders make no
14// representations about the suitability of this software for any
15// purpose. It is provided "as is" without express or implied
16// warranty.
17//
18// THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
19// SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
20// FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
21// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
23// AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25// THIS SOFTWARE.
26
27package wlrlayershell
28
29import (
30 "fmt"
31 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
32 xdgshell "github.com/bnema/go-wayland-bindings/server/xdgshell"
33 "github.com/bnema/purego-libwayland/server"
34)
35
36var ZwlrLayerShellV1Interface *server.Interface
37var ZwlrLayerSurfaceV1Interface *server.Interface
38
39func init() {
40 ZwlrLayerShellV1Interface = &server.Interface{Name: "zwlr_layer_shell_v1", Version: 5}
41 ZwlrLayerSurfaceV1Interface = &server.Interface{Name: "zwlr_layer_surface_v1", Version: 5}
42 ZwlrLayerShellV1Interface.Requests = []server.Message{
43 {Name: "get_layer_surface", Signature: "no?ous", Types: []*server.Interface{ZwlrLayerSurfaceV1Interface, wayland.SurfaceInterface, wayland.OutputInterface, nil, nil}},
44 {Name: "destroy", Signature: "3", Types: []*server.Interface{}},
45 }
46 ZwlrLayerShellV1Interface.Events = []server.Message{}
47 ZwlrLayerSurfaceV1Interface.Requests = []server.Message{
48 {Name: "set_size", Signature: "uu", Types: []*server.Interface{nil, nil}},
49 {Name: "set_anchor", Signature: "u", Types: []*server.Interface{nil}},
50 {Name: "set_exclusive_zone", Signature: "i", Types: []*server.Interface{nil}},
51 {Name: "set_margin", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}},
52 {Name: "set_keyboard_interactivity", Signature: "u", Types: []*server.Interface{nil}},
53 {Name: "get_popup", Signature: "o", Types: []*server.Interface{xdgshell.PopupInterface}},
54 {Name: "ack_configure", Signature: "u", Types: []*server.Interface{nil}},
55 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
56 {Name: "set_layer", Signature: "2u", Types: []*server.Interface{nil}},
57 {Name: "set_exclusive_edge", Signature: "5u", Types: []*server.Interface{nil}},
58 }
59 ZwlrLayerSurfaceV1Interface.Events = []server.Message{
60 {Name: "configure", Signature: "uuu", Types: []*server.Interface{nil, nil, nil}},
61 {Name: "closed", Signature: "", Types: []*server.Interface{}},
62 }
63 if err := server.NewInterfaces(ZwlrLayerShellV1Interface, ZwlrLayerSurfaceV1Interface); err != nil {
64 panic(err)
65 }
66}
67
68// ZwlrLayerShellV1 create surfaces that are layers of the desktop.
69type ZwlrLayerShellV1 struct{ *server.Resource }
70
71func WrapZwlrLayerShellV1(r *server.Resource) *ZwlrLayerShellV1 {
72 if r == nil {
73 return nil
74 }
75 return &ZwlrLayerShellV1{r}
76}
77
78const ZwlrLayerShellV1RequestGetLayerSurface uint32 = 0
79const ZwlrLayerShellV1RequestDestroy uint32 = 1
80
81// ZwlrLayerShellV1Error .
82type ZwlrLayerShellV1Error uint32
83
84const (
85 ZwlrLayerShellV1ErrorRole ZwlrLayerShellV1Error = 0
86 ZwlrLayerShellV1ErrorInvalidLayer ZwlrLayerShellV1Error = 1
87 ZwlrLayerShellV1ErrorAlreadyConstructed ZwlrLayerShellV1Error = 2
88)
89
90// ZwlrLayerShellV1Layer available layers for surfaces.
91type ZwlrLayerShellV1Layer uint32
92
93const (
94 ZwlrLayerShellV1LayerBackground ZwlrLayerShellV1Layer = 0
95 ZwlrLayerShellV1LayerBottom ZwlrLayerShellV1Layer = 1
96 ZwlrLayerShellV1LayerTop ZwlrLayerShellV1Layer = 2
97 ZwlrLayerShellV1LayerOverlay ZwlrLayerShellV1Layer = 3
98)
99
100// ZwlrLayerShellV1Handler handles zwlr_layer_shell_v1 requests.
101type ZwlrLayerShellV1Handler interface {
102 GetLayerSurface(self *ZwlrLayerShellV1, id uint32, surface *wayland.Surface, output *wayland.Output, layer uint32, namespace string)
103 Destroy(self *ZwlrLayerShellV1)
104}
105
106func NewZwlrLayerShellV1(c server.Client, version int32, id uint32, h ZwlrLayerShellV1Handler) (*ZwlrLayerShellV1, error) {
107 if h == nil {
108 return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_shell_v1")
109 }
110 var self *ZwlrLayerShellV1
111 r, err := c.CreateResource(ZwlrLayerShellV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
112 switch opcode {
113 case 0:
114 h.GetLayerSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapOutput(args[2].Resource()), args[3].Uint(), args[4].String())
115 case 1:
116 h.Destroy(self)
117 self.Destroy()
118 }
119 })
120 if err != nil {
121 return nil, err
122 }
123 self = WrapZwlrLayerShellV1(r)
124 r.Data = self
125 return self, nil
126}
127func NewZwlrLayerShellV1Global(d *server.Display, version int32, bind server.BindFunc) error {
128 return d.CreateGlobal(ZwlrLayerShellV1Interface, version, bind)
129}
130
131// ZwlrLayerSurfaceV1 layer metadata interface.
132type ZwlrLayerSurfaceV1 struct{ *server.Resource }
133
134func WrapZwlrLayerSurfaceV1(r *server.Resource) *ZwlrLayerSurfaceV1 {
135 if r == nil {
136 return nil
137 }
138 return &ZwlrLayerSurfaceV1{r}
139}
140
141const ZwlrLayerSurfaceV1RequestSetSize uint32 = 0
142const ZwlrLayerSurfaceV1RequestSetAnchor uint32 = 1
143const ZwlrLayerSurfaceV1RequestSetExclusiveZone uint32 = 2
144const ZwlrLayerSurfaceV1RequestSetMargin uint32 = 3
145const ZwlrLayerSurfaceV1RequestSetKeyboardInteractivity uint32 = 4
146const ZwlrLayerSurfaceV1RequestGetPopup uint32 = 5
147const ZwlrLayerSurfaceV1RequestAckConfigure uint32 = 6
148const ZwlrLayerSurfaceV1RequestDestroy uint32 = 7
149const ZwlrLayerSurfaceV1RequestSetLayer uint32 = 8
150const ZwlrLayerSurfaceV1RequestSetExclusiveEdge uint32 = 9
151const ZwlrLayerSurfaceV1EventConfigure uint32 = 0
152const ZwlrLayerSurfaceV1EventClosed uint32 = 1
153
154// ZwlrLayerSurfaceV1KeyboardInteractivity types of keyboard interaction possible for a layer shell surface.
155type ZwlrLayerSurfaceV1KeyboardInteractivity uint32
156
157const (
158 ZwlrLayerSurfaceV1KeyboardInteractivityNone ZwlrLayerSurfaceV1KeyboardInteractivity = 0
159 ZwlrLayerSurfaceV1KeyboardInteractivityExclusive ZwlrLayerSurfaceV1KeyboardInteractivity = 1
160 ZwlrLayerSurfaceV1KeyboardInteractivityOnDemand ZwlrLayerSurfaceV1KeyboardInteractivity = 2
161)
162
163// ZwlrLayerSurfaceV1Error .
164type ZwlrLayerSurfaceV1Error uint32
165
166const (
167 ZwlrLayerSurfaceV1ErrorInvalidSurfaceState ZwlrLayerSurfaceV1Error = 0
168 ZwlrLayerSurfaceV1ErrorInvalidSize ZwlrLayerSurfaceV1Error = 1
169 ZwlrLayerSurfaceV1ErrorInvalidAnchor ZwlrLayerSurfaceV1Error = 2
170 ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity ZwlrLayerSurfaceV1Error = 3
171 ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge ZwlrLayerSurfaceV1Error = 4
172)
173
174// ZwlrLayerSurfaceV1Anchor (bitfield).
175type ZwlrLayerSurfaceV1Anchor uint32
176
177const (
178 ZwlrLayerSurfaceV1AnchorTop ZwlrLayerSurfaceV1Anchor = 1
179 ZwlrLayerSurfaceV1AnchorBottom ZwlrLayerSurfaceV1Anchor = 2
180 ZwlrLayerSurfaceV1AnchorLeft ZwlrLayerSurfaceV1Anchor = 4
181 ZwlrLayerSurfaceV1AnchorRight ZwlrLayerSurfaceV1Anchor = 8
182)
183
184// ZwlrLayerSurfaceV1Handler handles zwlr_layer_surface_v1 requests.
185type ZwlrLayerSurfaceV1Handler interface {
186 SetSize(self *ZwlrLayerSurfaceV1, width uint32, height uint32)
187 SetAnchor(self *ZwlrLayerSurfaceV1, anchor uint32)
188 SetExclusiveZone(self *ZwlrLayerSurfaceV1, zone int32)
189 SetMargin(self *ZwlrLayerSurfaceV1, top int32, right int32, bottom int32, left int32)
190 SetKeyboardInteractivity(self *ZwlrLayerSurfaceV1, keyboardInteractivity uint32)
191 GetPopup(self *ZwlrLayerSurfaceV1, popup *xdgshell.Popup)
192 AckConfigure(self *ZwlrLayerSurfaceV1, serial uint32)
193 Destroy(self *ZwlrLayerSurfaceV1)
194 SetLayer(self *ZwlrLayerSurfaceV1, layer uint32)
195 SetExclusiveEdge(self *ZwlrLayerSurfaceV1, edge uint32)
196}
197
198func NewZwlrLayerSurfaceV1(c server.Client, version int32, id uint32, h ZwlrLayerSurfaceV1Handler) (*ZwlrLayerSurfaceV1, error) {
199 if h == nil {
200 return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_surface_v1")
201 }
202 var self *ZwlrLayerSurfaceV1
203 r, err := c.CreateResource(ZwlrLayerSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
204 switch opcode {
205 case 0:
206 h.SetSize(self, args[0].Uint(), args[1].Uint())
207 case 1:
208 h.SetAnchor(self, args[0].Uint())
209 case 2:
210 h.SetExclusiveZone(self, args[0].Int())
211 case 3:
212 h.SetMargin(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int())
213 case 4:
214 h.SetKeyboardInteractivity(self, args[0].Uint())
215 case 5:
216 h.GetPopup(self, xdgshell.WrapPopup(args[0].Resource()))
217 case 6:
218 h.AckConfigure(self, args[0].Uint())
219 case 7:
220 h.Destroy(self)
221 self.Destroy()
222 case 8:
223 h.SetLayer(self, args[0].Uint())
224 case 9:
225 h.SetExclusiveEdge(self, args[0].Uint())
226 }
227 })
228 if err != nil {
229 return nil, err
230 }
231 self = WrapZwlrLayerSurfaceV1(r)
232 r.Data = self
233 return self, nil
234}
235
236// SendConfigure suggest a surface change.
237func (self *ZwlrLayerSurfaceV1) SendConfigure(serial uint32, width uint32, height uint32) {
238 self.PostEvent(ZwlrLayerSurfaceV1EventConfigure, server.Uint(serial), server.Uint(width), server.Uint(height))
239}
240
241// SendClosed surface should be closed.
242func (self *ZwlrLayerSurfaceV1) SendClosed() {
243 self.PostEvent(ZwlrLayerSurfaceV1EventClosed)
244}
245func NewZwlrLayerSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error {
246 return d.CreateGlobal(ZwlrLayerSurfaceV1Interface, version, bind)
247}
248func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
249 if v == nil {
250 return nil
251 }
252 return v.GetResource()
253}
254func (self *ZwlrLayerShellV1) GetResource() *server.Resource {
255 if self == nil {
256 return nil
257 }
258 return self.Resource
259}
260func (self *ZwlrLayerSurfaceV1) GetResource() *server.Resource {
261 if self == nil {
262 return nil
263 }
264 return self.Resource
265}