1// Code generated by wlgen; DO NOT EDIT.
2package xdgoutput
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 ZxdgOutputManagerV1Interface *server.Interface
12var ZxdgOutputV1Interface *server.Interface
13
14func init() {
15 ZxdgOutputManagerV1Interface = &server.Interface{Name: "zxdg_output_manager_v1", Version: 3}
16 ZxdgOutputV1Interface = &server.Interface{Name: "zxdg_output_v1", Version: 3}
17 ZxdgOutputManagerV1Interface.Requests = []server.Message{
18 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
19 {Name: "get_xdg_output", Signature: "no", Types: []*server.Interface{ZxdgOutputV1Interface, wayland.OutputInterface}},
20 }
21 ZxdgOutputManagerV1Interface.Events = []server.Message{}
22 ZxdgOutputV1Interface.Requests = []server.Message{
23 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
24 }
25 ZxdgOutputV1Interface.Events = []server.Message{
26 {Name: "logical_position", Signature: "ii", Types: []*server.Interface{nil, nil}},
27 {Name: "logical_size", Signature: "ii", Types: []*server.Interface{nil, nil}},
28 {Name: "done", Signature: "", Types: []*server.Interface{}},
29 {Name: "name", Signature: "2s", Types: []*server.Interface{nil}},
30 {Name: "description", Signature: "2s", Types: []*server.Interface{nil}},
31 }
32 if err := server.NewInterfaces(ZxdgOutputManagerV1Interface, ZxdgOutputV1Interface); err != nil {
33 panic(err)
34 }
35}
36
37// ZxdgOutputManagerV1 manage xdg_output objects.
38type ZxdgOutputManagerV1 struct{ *server.Resource }
39
40func WrapZxdgOutputManagerV1(r *server.Resource) *ZxdgOutputManagerV1 {
41 if r == nil {
42 return nil
43 }
44 return &ZxdgOutputManagerV1{r}
45}
46
47const ZxdgOutputManagerV1RequestDestroy uint32 = 0
48const ZxdgOutputManagerV1RequestGetXdgOutput uint32 = 1
49
50// ZxdgOutputManagerV1Handler handles zxdg_output_manager_v1 requests.
51type ZxdgOutputManagerV1Handler interface {
52 Destroy(self *ZxdgOutputManagerV1)
53 GetXdgOutput(self *ZxdgOutputManagerV1, id uint32, output *wayland.Output)
54}
55
56func NewZxdgOutputManagerV1(c server.Client, version int32, id uint32, h ZxdgOutputManagerV1Handler) (*ZxdgOutputManagerV1, error) {
57 if h == nil {
58 return nil, fmt.Errorf("purego-libwayland: nil handler for zxdg_output_manager_v1")
59 }
60 var self *ZxdgOutputManagerV1
61 r, err := c.CreateResource(ZxdgOutputManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
62 switch opcode {
63 case 0:
64 h.Destroy(self)
65 self.Destroy()
66 case 1:
67 h.GetXdgOutput(self, args[0].NewID(), wayland.WrapOutput(args[1].Resource()))
68 }
69 })
70 if err != nil {
71 return nil, err
72 }
73 self = WrapZxdgOutputManagerV1(r)
74 r.Data = self
75 return self, nil
76}
77func NewZxdgOutputManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
78 return d.CreateGlobal(ZxdgOutputManagerV1Interface, version, bind)
79}
80
81// ZxdgOutputV1 compositor logical output region.
82type ZxdgOutputV1 struct{ *server.Resource }
83
84func WrapZxdgOutputV1(r *server.Resource) *ZxdgOutputV1 {
85 if r == nil {
86 return nil
87 }
88 return &ZxdgOutputV1{r}
89}
90
91const ZxdgOutputV1RequestDestroy uint32 = 0
92const ZxdgOutputV1EventLogicalPosition uint32 = 0
93const ZxdgOutputV1EventLogicalSize uint32 = 1
94const ZxdgOutputV1EventDone uint32 = 2
95const ZxdgOutputV1EventName uint32 = 3
96const ZxdgOutputV1EventDescription uint32 = 4
97
98// ZxdgOutputV1Handler handles zxdg_output_v1 requests.
99type ZxdgOutputV1Handler interface {
100 Destroy(self *ZxdgOutputV1)
101}
102
103func NewZxdgOutputV1(c server.Client, version int32, id uint32, h ZxdgOutputV1Handler) (*ZxdgOutputV1, error) {
104 if h == nil {
105 return nil, fmt.Errorf("purego-libwayland: nil handler for zxdg_output_v1")
106 }
107 var self *ZxdgOutputV1
108 r, err := c.CreateResource(ZxdgOutputV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
109 switch opcode {
110 case 0:
111 h.Destroy(self)
112 self.Destroy()
113 }
114 })
115 if err != nil {
116 return nil, err
117 }
118 self = WrapZxdgOutputV1(r)
119 r.Data = self
120 return self, nil
121}
122
123// SendLogicalPosition position of the output within the global compositor space.
124func (self *ZxdgOutputV1) SendLogicalPosition(x int32, y int32) {
125 self.PostEvent(ZxdgOutputV1EventLogicalPosition, server.Int(x), server.Int(y))
126}
127
128// SendLogicalSize size of the output in the global compositor space.
129func (self *ZxdgOutputV1) SendLogicalSize(width int32, height int32) {
130 self.PostEvent(ZxdgOutputV1EventLogicalSize, server.Int(width), server.Int(height))
131}
132
133// SendDone all information about the output have been sent.
134func (self *ZxdgOutputV1) SendDone() {
135 self.PostEvent(ZxdgOutputV1EventDone)
136}
137
138// SendName name of this output (since version 2).
139func (self *ZxdgOutputV1) SendName(name string) {
140 var p runtime.Pinner
141 defer p.Unpin()
142 self.PostEvent(ZxdgOutputV1EventName, server.String(&p, name, false))
143}
144
145// SendDescription human-readable description of this output (since version 2).
146func (self *ZxdgOutputV1) SendDescription(description string) {
147 var p runtime.Pinner
148 defer p.Unpin()
149 self.PostEvent(ZxdgOutputV1EventDescription, server.String(&p, description, false))
150}
151func NewZxdgOutputV1Global(d *server.Display, version int32, bind server.BindFunc) error {
152 return d.CreateGlobal(ZxdgOutputV1Interface, version, bind)
153}
154func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
155 if v == nil {
156 return nil
157 }
158 return v.GetResource()
159}
160func (self *ZxdgOutputManagerV1) GetResource() *server.Resource {
161 if self == nil {
162 return nil
163 }
164 return self.Resource
165}
166func (self *ZxdgOutputV1) GetResource() *server.Resource {
167 if self == nil {
168 return nil
169 }
170 return self.Resource
171}