1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2020 - 2023 Andri Yngvason
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 exttransientseat
26
27import (
28 "fmt"
29 "github.com/bnema/purego-libwayland/server"
30)
31
32var ExtTransientSeatManagerV1Interface *server.Interface
33var ExtTransientSeatV1Interface *server.Interface
34
35func init() {
36 ExtTransientSeatManagerV1Interface = &server.Interface{Name: "ext_transient_seat_manager_v1", Version: 1}
37 ExtTransientSeatV1Interface = &server.Interface{Name: "ext_transient_seat_v1", Version: 1}
38 ExtTransientSeatManagerV1Interface.Requests = []server.Message{
39 {Name: "create", Signature: "n", Types: []*server.Interface{ExtTransientSeatV1Interface}},
40 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
41 }
42 ExtTransientSeatManagerV1Interface.Events = []server.Message{}
43 ExtTransientSeatV1Interface.Requests = []server.Message{
44 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
45 }
46 ExtTransientSeatV1Interface.Events = []server.Message{
47 {Name: "ready", Signature: "u", Types: []*server.Interface{nil}},
48 {Name: "denied", Signature: "", Types: []*server.Interface{}},
49 }
50 if err := server.NewInterfaces(ExtTransientSeatManagerV1Interface, ExtTransientSeatV1Interface); err != nil {
51 panic(err)
52 }
53}
54
55// ExtTransientSeatManagerV1 transient seat manager.
56type ExtTransientSeatManagerV1 struct{ *server.Resource }
57
58func WrapExtTransientSeatManagerV1(r *server.Resource) *ExtTransientSeatManagerV1 {
59 if r == nil {
60 return nil
61 }
62 return &ExtTransientSeatManagerV1{r}
63}
64
65const ExtTransientSeatManagerV1RequestCreate uint32 = 0
66const ExtTransientSeatManagerV1RequestDestroy uint32 = 1
67
68// ExtTransientSeatManagerV1Handler handles ext_transient_seat_manager_v1 requests.
69type ExtTransientSeatManagerV1Handler interface {
70 Create(self *ExtTransientSeatManagerV1, seat uint32)
71 Destroy(self *ExtTransientSeatManagerV1)
72}
73
74func NewExtTransientSeatManagerV1(c server.Client, version int32, id uint32, h ExtTransientSeatManagerV1Handler) (*ExtTransientSeatManagerV1, error) {
75 if h == nil {
76 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_transient_seat_manager_v1")
77 }
78 var self *ExtTransientSeatManagerV1
79 r, err := c.CreateResource(ExtTransientSeatManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
80 switch opcode {
81 case 0:
82 h.Create(self, args[0].NewID())
83 case 1:
84 h.Destroy(self)
85 self.Destroy()
86 }
87 })
88 if err != nil {
89 return nil, err
90 }
91 self = WrapExtTransientSeatManagerV1(r)
92 r.Data = self
93 return self, nil
94}
95func NewExtTransientSeatManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
96 return d.CreateGlobal(ExtTransientSeatManagerV1Interface, version, bind)
97}
98
99// ExtTransientSeatV1 transient seat handle.
100type ExtTransientSeatV1 struct{ *server.Resource }
101
102func WrapExtTransientSeatV1(r *server.Resource) *ExtTransientSeatV1 {
103 if r == nil {
104 return nil
105 }
106 return &ExtTransientSeatV1{r}
107}
108
109const ExtTransientSeatV1RequestDestroy uint32 = 0
110const ExtTransientSeatV1EventReady uint32 = 0
111const ExtTransientSeatV1EventDenied uint32 = 1
112
113// ExtTransientSeatV1Handler handles ext_transient_seat_v1 requests.
114type ExtTransientSeatV1Handler interface {
115 Destroy(self *ExtTransientSeatV1)
116}
117
118func NewExtTransientSeatV1(c server.Client, version int32, id uint32, h ExtTransientSeatV1Handler) (*ExtTransientSeatV1, error) {
119 if h == nil {
120 return nil, fmt.Errorf("purego-libwayland: nil handler for ext_transient_seat_v1")
121 }
122 var self *ExtTransientSeatV1
123 r, err := c.CreateResource(ExtTransientSeatV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
124 switch opcode {
125 case 0:
126 h.Destroy(self)
127 self.Destroy()
128 }
129 })
130 if err != nil {
131 return nil, err
132 }
133 self = WrapExtTransientSeatV1(r)
134 r.Data = self
135 return self, nil
136}
137
138// SendReady transient seat is ready.
139func (self *ExtTransientSeatV1) SendReady(globalName uint32) {
140 self.PostEvent(ExtTransientSeatV1EventReady, server.Uint(globalName))
141}
142
143// SendDenied transient seat creation denied.
144func (self *ExtTransientSeatV1) SendDenied() {
145 self.PostEvent(ExtTransientSeatV1EventDenied)
146}
147func NewExtTransientSeatV1Global(d *server.Display, version int32, bind server.BindFunc) error {
148 return d.CreateGlobal(ExtTransientSeatV1Interface, version, bind)
149}
150func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
151 if v == nil {
152 return nil
153 }
154 return v.GetResource()
155}
156func (self *ExtTransientSeatManagerV1) GetResource() *server.Resource {
157 if self == nil {
158 return nil
159 }
160 return self.Resource
161}
162func (self *ExtTransientSeatV1) GetResource() *server.Resource {
163 if self == nil {
164 return nil
165 }
166 return self.Resource
167}