1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2017 Red Hat Inc.
5//
6// Permission is hereby granted, free of charge, to any person obtaining a
7// copy of this software and associated documentation files (the "Software"),
8// to deal in the Software without restriction, including without limitation
9// the rights to use, copy, modify, merge, publish, distribute, sublicense,
10// and/or sell copies of the Software, and to permit persons to whom the
11// Software is furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice (including the next
14// paragraph) shall be included in all copies or substantial portions of the
15// Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE.
24
25package xdgoutput
26
27import (
28 "fmt"
29 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
30 "github.com/bnema/purego-libwayland/server"
31 "runtime"
32)
33
34var ZxdgOutputManagerV1Interface *server.Interface
35var ZxdgOutputV1Interface *server.Interface
36
37func init() {
38 ZxdgOutputManagerV1Interface = &server.Interface{Name: "zxdg_output_manager_v1", Version: 3}
39 ZxdgOutputV1Interface = &server.Interface{Name: "zxdg_output_v1", Version: 3}
40 ZxdgOutputManagerV1Interface.Requests = []server.Message{
41 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
42 {Name: "get_xdg_output", Signature: "no", Types: []*server.Interface{ZxdgOutputV1Interface, wayland.OutputInterface}},
43 }
44 ZxdgOutputManagerV1Interface.Events = []server.Message{}
45 ZxdgOutputV1Interface.Requests = []server.Message{
46 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
47 }
48 ZxdgOutputV1Interface.Events = []server.Message{
49 {Name: "logical_position", Signature: "ii", Types: []*server.Interface{nil, nil}},
50 {Name: "logical_size", Signature: "ii", Types: []*server.Interface{nil, nil}},
51 {Name: "done", Signature: "", Types: []*server.Interface{}},
52 {Name: "name", Signature: "2s", Types: []*server.Interface{nil}},
53 {Name: "description", Signature: "2s", Types: []*server.Interface{nil}},
54 }
55 if err := server.NewInterfaces(ZxdgOutputManagerV1Interface, ZxdgOutputV1Interface); err != nil {
56 panic(err)
57 }
58}
59
60// ZxdgOutputManagerV1 manage xdg_output objects.
61type ZxdgOutputManagerV1 struct{ *server.Resource }
62
63func WrapZxdgOutputManagerV1(r *server.Resource) *ZxdgOutputManagerV1 {
64 if r == nil {
65 return nil
66 }
67 return &ZxdgOutputManagerV1{r}
68}
69
70const ZxdgOutputManagerV1RequestDestroy uint32 = 0
71const ZxdgOutputManagerV1RequestGetXdgOutput uint32 = 1
72
73// ZxdgOutputManagerV1Handler handles zxdg_output_manager_v1 requests.
74type ZxdgOutputManagerV1Handler interface {
75 Destroy(self *ZxdgOutputManagerV1)
76 GetXdgOutput(self *ZxdgOutputManagerV1, id uint32, output *wayland.Output)
77}
78
79func NewZxdgOutputManagerV1(c server.Client, version int32, id uint32, h ZxdgOutputManagerV1Handler) (*ZxdgOutputManagerV1, error) {
80 if h == nil {
81 return nil, fmt.Errorf("purego-libwayland: nil handler for zxdg_output_manager_v1")
82 }
83 var self *ZxdgOutputManagerV1
84 r, err := c.CreateResource(ZxdgOutputManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
85 switch opcode {
86 case 0:
87 h.Destroy(self)
88 self.Destroy()
89 case 1:
90 h.GetXdgOutput(self, args[0].NewID(), wayland.WrapOutput(args[1].Resource()))
91 }
92 })
93 if err != nil {
94 return nil, err
95 }
96 self = WrapZxdgOutputManagerV1(r)
97 r.Data = self
98 return self, nil
99}
100func NewZxdgOutputManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
101 return d.CreateGlobal(ZxdgOutputManagerV1Interface, version, bind)
102}
103
104// ZxdgOutputV1 compositor logical output region.
105type ZxdgOutputV1 struct{ *server.Resource }
106
107func WrapZxdgOutputV1(r *server.Resource) *ZxdgOutputV1 {
108 if r == nil {
109 return nil
110 }
111 return &ZxdgOutputV1{r}
112}
113
114const ZxdgOutputV1RequestDestroy uint32 = 0
115const ZxdgOutputV1EventLogicalPosition uint32 = 0
116const ZxdgOutputV1EventLogicalSize uint32 = 1
117const ZxdgOutputV1EventDone uint32 = 2
118const ZxdgOutputV1EventName uint32 = 3
119const ZxdgOutputV1EventDescription uint32 = 4
120
121// ZxdgOutputV1Handler handles zxdg_output_v1 requests.
122type ZxdgOutputV1Handler interface {
123 Destroy(self *ZxdgOutputV1)
124}
125
126func NewZxdgOutputV1(c server.Client, version int32, id uint32, h ZxdgOutputV1Handler) (*ZxdgOutputV1, error) {
127 if h == nil {
128 return nil, fmt.Errorf("purego-libwayland: nil handler for zxdg_output_v1")
129 }
130 var self *ZxdgOutputV1
131 r, err := c.CreateResource(ZxdgOutputV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
132 switch opcode {
133 case 0:
134 h.Destroy(self)
135 self.Destroy()
136 }
137 })
138 if err != nil {
139 return nil, err
140 }
141 self = WrapZxdgOutputV1(r)
142 r.Data = self
143 return self, nil
144}
145
146// SendLogicalPosition position of the output within the global compositor space.
147func (self *ZxdgOutputV1) SendLogicalPosition(x int32, y int32) {
148 self.PostEvent(ZxdgOutputV1EventLogicalPosition, server.Int(x), server.Int(y))
149}
150
151// SendLogicalSize size of the output in the global compositor space.
152func (self *ZxdgOutputV1) SendLogicalSize(width int32, height int32) {
153 self.PostEvent(ZxdgOutputV1EventLogicalSize, server.Int(width), server.Int(height))
154}
155
156// SendDone all information about the output have been sent.
157func (self *ZxdgOutputV1) SendDone() {
158 self.PostEvent(ZxdgOutputV1EventDone)
159}
160
161// SendName name of this output (since version 2).
162func (self *ZxdgOutputV1) SendName(name string) {
163 var p runtime.Pinner
164 defer p.Unpin()
165 self.PostEvent(ZxdgOutputV1EventName, server.String(&p, name, false))
166}
167
168// SendDescription human-readable description of this output (since version 2).
169func (self *ZxdgOutputV1) SendDescription(description string) {
170 var p runtime.Pinner
171 defer p.Unpin()
172 self.PostEvent(ZxdgOutputV1EventDescription, server.String(&p, description, false))
173}
174func NewZxdgOutputV1Global(d *server.Display, version int32, bind server.BindFunc) error {
175 return d.CreateGlobal(ZxdgOutputV1Interface, version, bind)
176}
177func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
178 if v == nil {
179 return nil
180 }
181 return v.GetResource()
182}
183func (self *ZxdgOutputManagerV1) GetResource() *server.Resource {
184 if self == nil {
185 return nil
186 }
187 return self.Resource
188}
189func (self *ZxdgOutputV1) GetResource() *server.Resource {
190 if self == nil {
191 return nil
192 }
193 return self.Resource
194}