1// Code generated by wlgen; DO NOT EDIT.
2package wlrlayershell
3
4import (
5 "fmt"
6 wayland "github.com/bnema/purego-libwayland/protocol/wayland"
7 xdgshell "github.com/bnema/purego-libwayland/protocol/xdgshell"
8 "github.com/bnema/purego-libwayland/server"
9)
10
11var ZwlrLayerShellV1Interface *server.Interface
12var ZwlrLayerSurfaceV1Interface *server.Interface
13
14func init() {
15 ZwlrLayerShellV1Interface = &server.Interface{Name: "zwlr_layer_shell_v1", Version: 5}
16 ZwlrLayerSurfaceV1Interface = &server.Interface{Name: "zwlr_layer_surface_v1", Version: 5}
17 ZwlrLayerShellV1Interface.Requests = []server.Message{
18 {Name: "get_layer_surface", Signature: "no?ous", Types: []*server.Interface{ZwlrLayerSurfaceV1Interface, wayland.SurfaceInterface, wayland.OutputInterface, nil, nil}},
19 {Name: "destroy", Signature: "3", Types: []*server.Interface{}},
20 }
21 ZwlrLayerShellV1Interface.Events = []server.Message{}
22 ZwlrLayerSurfaceV1Interface.Requests = []server.Message{
23 {Name: "set_size", Signature: "uu", Types: []*server.Interface{nil, nil}},
24 {Name: "set_anchor", Signature: "u", Types: []*server.Interface{nil}},
25 {Name: "set_exclusive_zone", Signature: "i", Types: []*server.Interface{nil}},
26 {Name: "set_margin", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}},
27 {Name: "set_keyboard_interactivity", Signature: "u", Types: []*server.Interface{nil}},
28 {Name: "get_popup", Signature: "o", Types: []*server.Interface{xdgshell.PopupInterface}},
29 {Name: "ack_configure", Signature: "u", Types: []*server.Interface{nil}},
30 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
31 {Name: "set_layer", Signature: "2u", Types: []*server.Interface{nil}},
32 {Name: "set_exclusive_edge", Signature: "5u", Types: []*server.Interface{nil}},
33 }
34 ZwlrLayerSurfaceV1Interface.Events = []server.Message{
35 {Name: "configure", Signature: "uuu", Types: []*server.Interface{nil, nil, nil}},
36 {Name: "closed", Signature: "", Types: []*server.Interface{}},
37 }
38 if err := server.NewInterfaces(ZwlrLayerShellV1Interface, ZwlrLayerSurfaceV1Interface); err != nil {
39 panic(err)
40 }
41}
42
43// ZwlrLayerShellV1 create surfaces that are layers of the desktop.
44type ZwlrLayerShellV1 struct{ *server.Resource }
45
46func WrapZwlrLayerShellV1(r *server.Resource) *ZwlrLayerShellV1 {
47 if r == nil {
48 return nil
49 }
50 return &ZwlrLayerShellV1{r}
51}
52
53const ZwlrLayerShellV1RequestGetLayerSurface uint32 = 0
54const ZwlrLayerShellV1RequestDestroy uint32 = 1
55
56// ZwlrLayerShellV1Error .
57type ZwlrLayerShellV1Error uint32
58
59const (
60 ZwlrLayerShellV1ErrorRole ZwlrLayerShellV1Error = 0
61 ZwlrLayerShellV1ErrorInvalidLayer ZwlrLayerShellV1Error = 1
62 ZwlrLayerShellV1ErrorAlreadyConstructed ZwlrLayerShellV1Error = 2
63)
64
65// ZwlrLayerShellV1Layer available layers for surfaces.
66type ZwlrLayerShellV1Layer uint32
67
68const (
69 ZwlrLayerShellV1LayerBackground ZwlrLayerShellV1Layer = 0
70 ZwlrLayerShellV1LayerBottom ZwlrLayerShellV1Layer = 1
71 ZwlrLayerShellV1LayerTop ZwlrLayerShellV1Layer = 2
72 ZwlrLayerShellV1LayerOverlay ZwlrLayerShellV1Layer = 3
73)
74
75// ZwlrLayerShellV1Handler handles zwlr_layer_shell_v1 requests.
76type ZwlrLayerShellV1Handler interface {
77 GetLayerSurface(self *ZwlrLayerShellV1, id uint32, surface *wayland.Surface, output *wayland.Output, layer uint32, namespace string)
78 Destroy(self *ZwlrLayerShellV1)
79}
80
81func NewZwlrLayerShellV1(c server.Client, version int32, id uint32, h ZwlrLayerShellV1Handler) (*ZwlrLayerShellV1, error) {
82 if h == nil {
83 return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_shell_v1")
84 }
85 var self *ZwlrLayerShellV1
86 r, err := c.CreateResource(ZwlrLayerShellV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
87 switch opcode {
88 case 0:
89 h.GetLayerSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapOutput(args[2].Resource()), args[3].Uint(), args[4].String())
90 case 1:
91 h.Destroy(self)
92 self.Destroy()
93 }
94 })
95 if err != nil {
96 return nil, err
97 }
98 self = WrapZwlrLayerShellV1(r)
99 r.Data = self
100 return self, nil
101}
102func NewZwlrLayerShellV1Global(d *server.Display, version int32, bind server.BindFunc) error {
103 return d.CreateGlobal(ZwlrLayerShellV1Interface, version, bind)
104}
105
106// ZwlrLayerSurfaceV1 layer metadata interface.
107type ZwlrLayerSurfaceV1 struct{ *server.Resource }
108
109func WrapZwlrLayerSurfaceV1(r *server.Resource) *ZwlrLayerSurfaceV1 {
110 if r == nil {
111 return nil
112 }
113 return &ZwlrLayerSurfaceV1{r}
114}
115
116const ZwlrLayerSurfaceV1RequestSetSize uint32 = 0
117const ZwlrLayerSurfaceV1RequestSetAnchor uint32 = 1
118const ZwlrLayerSurfaceV1RequestSetExclusiveZone uint32 = 2
119const ZwlrLayerSurfaceV1RequestSetMargin uint32 = 3
120const ZwlrLayerSurfaceV1RequestSetKeyboardInteractivity uint32 = 4
121const ZwlrLayerSurfaceV1RequestGetPopup uint32 = 5
122const ZwlrLayerSurfaceV1RequestAckConfigure uint32 = 6
123const ZwlrLayerSurfaceV1RequestDestroy uint32 = 7
124const ZwlrLayerSurfaceV1RequestSetLayer uint32 = 8
125const ZwlrLayerSurfaceV1RequestSetExclusiveEdge uint32 = 9
126const ZwlrLayerSurfaceV1EventConfigure uint32 = 0
127const ZwlrLayerSurfaceV1EventClosed uint32 = 1
128
129// ZwlrLayerSurfaceV1KeyboardInteractivity types of keyboard interaction possible for a layer shell surface.
130type ZwlrLayerSurfaceV1KeyboardInteractivity uint32
131
132const (
133 ZwlrLayerSurfaceV1KeyboardInteractivityNone ZwlrLayerSurfaceV1KeyboardInteractivity = 0
134 ZwlrLayerSurfaceV1KeyboardInteractivityExclusive ZwlrLayerSurfaceV1KeyboardInteractivity = 1
135 ZwlrLayerSurfaceV1KeyboardInteractivityOnDemand ZwlrLayerSurfaceV1KeyboardInteractivity = 2
136)
137
138// ZwlrLayerSurfaceV1Error .
139type ZwlrLayerSurfaceV1Error uint32
140
141const (
142 ZwlrLayerSurfaceV1ErrorInvalidSurfaceState ZwlrLayerSurfaceV1Error = 0
143 ZwlrLayerSurfaceV1ErrorInvalidSize ZwlrLayerSurfaceV1Error = 1
144 ZwlrLayerSurfaceV1ErrorInvalidAnchor ZwlrLayerSurfaceV1Error = 2
145 ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity ZwlrLayerSurfaceV1Error = 3
146 ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge ZwlrLayerSurfaceV1Error = 4
147)
148
149// ZwlrLayerSurfaceV1Anchor (bitfield).
150type ZwlrLayerSurfaceV1Anchor uint32
151
152const (
153 ZwlrLayerSurfaceV1AnchorTop ZwlrLayerSurfaceV1Anchor = 1
154 ZwlrLayerSurfaceV1AnchorBottom ZwlrLayerSurfaceV1Anchor = 2
155 ZwlrLayerSurfaceV1AnchorLeft ZwlrLayerSurfaceV1Anchor = 4
156 ZwlrLayerSurfaceV1AnchorRight ZwlrLayerSurfaceV1Anchor = 8
157)
158
159// ZwlrLayerSurfaceV1Handler handles zwlr_layer_surface_v1 requests.
160type ZwlrLayerSurfaceV1Handler interface {
161 SetSize(self *ZwlrLayerSurfaceV1, width uint32, height uint32)
162 SetAnchor(self *ZwlrLayerSurfaceV1, anchor uint32)
163 SetExclusiveZone(self *ZwlrLayerSurfaceV1, zone int32)
164 SetMargin(self *ZwlrLayerSurfaceV1, top int32, right int32, bottom int32, left int32)
165 SetKeyboardInteractivity(self *ZwlrLayerSurfaceV1, keyboardInteractivity uint32)
166 GetPopup(self *ZwlrLayerSurfaceV1, popup *xdgshell.Popup)
167 AckConfigure(self *ZwlrLayerSurfaceV1, serial uint32)
168 Destroy(self *ZwlrLayerSurfaceV1)
169 SetLayer(self *ZwlrLayerSurfaceV1, layer uint32)
170 SetExclusiveEdge(self *ZwlrLayerSurfaceV1, edge uint32)
171}
172
173func NewZwlrLayerSurfaceV1(c server.Client, version int32, id uint32, h ZwlrLayerSurfaceV1Handler) (*ZwlrLayerSurfaceV1, error) {
174 if h == nil {
175 return nil, fmt.Errorf("purego-libwayland: nil handler for zwlr_layer_surface_v1")
176 }
177 var self *ZwlrLayerSurfaceV1
178 r, err := c.CreateResource(ZwlrLayerSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
179 switch opcode {
180 case 0:
181 h.SetSize(self, args[0].Uint(), args[1].Uint())
182 case 1:
183 h.SetAnchor(self, args[0].Uint())
184 case 2:
185 h.SetExclusiveZone(self, args[0].Int())
186 case 3:
187 h.SetMargin(self, args[0].Int(), args[1].Int(), args[2].Int(), args[3].Int())
188 case 4:
189 h.SetKeyboardInteractivity(self, args[0].Uint())
190 case 5:
191 h.GetPopup(self, xdgshell.WrapPopup(args[0].Resource()))
192 case 6:
193 h.AckConfigure(self, args[0].Uint())
194 case 7:
195 h.Destroy(self)
196 self.Destroy()
197 case 8:
198 h.SetLayer(self, args[0].Uint())
199 case 9:
200 h.SetExclusiveEdge(self, args[0].Uint())
201 }
202 })
203 if err != nil {
204 return nil, err
205 }
206 self = WrapZwlrLayerSurfaceV1(r)
207 r.Data = self
208 return self, nil
209}
210
211// SendConfigure suggest a surface change.
212func (self *ZwlrLayerSurfaceV1) SendConfigure(serial uint32, width uint32, height uint32) {
213 self.PostEvent(ZwlrLayerSurfaceV1EventConfigure, server.Uint(serial), server.Uint(width), server.Uint(height))
214}
215
216// SendClosed surface should be closed.
217func (self *ZwlrLayerSurfaceV1) SendClosed() {
218 self.PostEvent(ZwlrLayerSurfaceV1EventClosed)
219}
220func NewZwlrLayerSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error {
221 return d.CreateGlobal(ZwlrLayerSurfaceV1Interface, version, bind)
222}
223func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
224 if v == nil {
225 return nil
226 }
227 return v.GetResource()
228}
229func (self *ZwlrLayerShellV1) GetResource() *server.Resource {
230 if self == nil {
231 return nil
232 }
233 return self.Resource
234}
235func (self *ZwlrLayerSurfaceV1) GetResource() *server.Resource {
236 if self == nil {
237 return nil
238 }
239 return self.Resource
240}