1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright 2018 The Chromium Authors
5// Copyright 2023 Simon Ser
6//
7// Permission is hereby granted, free of charge, to any person obtaining a
8// copy of this software and associated documentation files (the "Software"),
9// to deal in the Software without restriction, including without limitation
10// the rights to use, copy, modify, merge, publish, distribute, sublicense,
11// and/or sell copies of the Software, and to permit persons to whom the
12// Software is furnished to do so, subject to the following conditions:
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// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE.
23
24package cursorshape
25
26import (
27 "fmt"
28 tablet "github.com/bnema/go-wayland-bindings/server/tablet"
29 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
30 "github.com/bnema/purego-libwayland/server"
31)
32
33var WpCursorShapeManagerV1Interface *server.Interface
34var WpCursorShapeDeviceV1Interface *server.Interface
35
36func init() {
37 WpCursorShapeManagerV1Interface = &server.Interface{Name: "wp_cursor_shape_manager_v1", Version: 2}
38 WpCursorShapeDeviceV1Interface = &server.Interface{Name: "wp_cursor_shape_device_v1", Version: 2}
39 WpCursorShapeManagerV1Interface.Requests = []server.Message{
40 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
41 {Name: "get_pointer", Signature: "no", Types: []*server.Interface{WpCursorShapeDeviceV1Interface, wayland.PointerInterface}},
42 {Name: "get_tablet_tool_v2", Signature: "no", Types: []*server.Interface{WpCursorShapeDeviceV1Interface, tablet.ZwpTabletToolV2Interface}},
43 }
44 WpCursorShapeManagerV1Interface.Events = []server.Message{}
45 WpCursorShapeDeviceV1Interface.Requests = []server.Message{
46 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
47 {Name: "set_shape", Signature: "uu", Types: []*server.Interface{nil, nil}},
48 }
49 WpCursorShapeDeviceV1Interface.Events = []server.Message{}
50 if err := server.NewInterfaces(WpCursorShapeManagerV1Interface, WpCursorShapeDeviceV1Interface); err != nil {
51 panic(err)
52 }
53}
54
55// WpCursorShapeManagerV1 cursor shape manager.
56type WpCursorShapeManagerV1 struct{ *server.Resource }
57
58func WrapWpCursorShapeManagerV1(r *server.Resource) *WpCursorShapeManagerV1 {
59 if r == nil {
60 return nil
61 }
62 return &WpCursorShapeManagerV1{r}
63}
64
65const WpCursorShapeManagerV1RequestDestroy uint32 = 0
66const WpCursorShapeManagerV1RequestGetPointer uint32 = 1
67const WpCursorShapeManagerV1RequestGetTabletToolV2 uint32 = 2
68
69// WpCursorShapeManagerV1Handler handles wp_cursor_shape_manager_v1 requests.
70type WpCursorShapeManagerV1Handler interface {
71 Destroy(self *WpCursorShapeManagerV1)
72 GetPointer(self *WpCursorShapeManagerV1, cursorShapeDevice uint32, pointer *wayland.Pointer)
73 GetTabletToolV2(self *WpCursorShapeManagerV1, cursorShapeDevice uint32, tabletTool *tablet.ZwpTabletToolV2)
74}
75
76func NewWpCursorShapeManagerV1(c server.Client, version int32, id uint32, h WpCursorShapeManagerV1Handler) (*WpCursorShapeManagerV1, error) {
77 if h == nil {
78 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_cursor_shape_manager_v1")
79 }
80 var self *WpCursorShapeManagerV1
81 r, err := c.CreateResource(WpCursorShapeManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
82 switch opcode {
83 case 0:
84 h.Destroy(self)
85 self.Destroy()
86 case 1:
87 h.GetPointer(self, args[0].NewID(), wayland.WrapPointer(args[1].Resource()))
88 case 2:
89 h.GetTabletToolV2(self, args[0].NewID(), tablet.WrapZwpTabletToolV2(args[1].Resource()))
90 }
91 })
92 if err != nil {
93 return nil, err
94 }
95 self = WrapWpCursorShapeManagerV1(r)
96 r.Data = self
97 return self, nil
98}
99func NewWpCursorShapeManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
100 return d.CreateGlobal(WpCursorShapeManagerV1Interface, version, bind)
101}
102
103// WpCursorShapeDeviceV1 cursor shape for a device.
104type WpCursorShapeDeviceV1 struct{ *server.Resource }
105
106func WrapWpCursorShapeDeviceV1(r *server.Resource) *WpCursorShapeDeviceV1 {
107 if r == nil {
108 return nil
109 }
110 return &WpCursorShapeDeviceV1{r}
111}
112
113const WpCursorShapeDeviceV1RequestDestroy uint32 = 0
114const WpCursorShapeDeviceV1RequestSetShape uint32 = 1
115
116// WpCursorShapeDeviceV1Shape cursor shapes.
117type WpCursorShapeDeviceV1Shape uint32
118
119const (
120 WpCursorShapeDeviceV1ShapeDefault WpCursorShapeDeviceV1Shape = 1
121 WpCursorShapeDeviceV1ShapeContextMenu WpCursorShapeDeviceV1Shape = 2
122 WpCursorShapeDeviceV1ShapeHelp WpCursorShapeDeviceV1Shape = 3
123 WpCursorShapeDeviceV1ShapePointer WpCursorShapeDeviceV1Shape = 4
124 WpCursorShapeDeviceV1ShapeProgress WpCursorShapeDeviceV1Shape = 5
125 WpCursorShapeDeviceV1ShapeWait WpCursorShapeDeviceV1Shape = 6
126 WpCursorShapeDeviceV1ShapeCell WpCursorShapeDeviceV1Shape = 7
127 WpCursorShapeDeviceV1ShapeCrosshair WpCursorShapeDeviceV1Shape = 8
128 WpCursorShapeDeviceV1ShapeText WpCursorShapeDeviceV1Shape = 9
129 WpCursorShapeDeviceV1ShapeVerticalText WpCursorShapeDeviceV1Shape = 10
130 WpCursorShapeDeviceV1ShapeAlias WpCursorShapeDeviceV1Shape = 11
131 WpCursorShapeDeviceV1ShapeCopy WpCursorShapeDeviceV1Shape = 12
132 WpCursorShapeDeviceV1ShapeMove WpCursorShapeDeviceV1Shape = 13
133 WpCursorShapeDeviceV1ShapeNoDrop WpCursorShapeDeviceV1Shape = 14
134 WpCursorShapeDeviceV1ShapeNotAllowed WpCursorShapeDeviceV1Shape = 15
135 WpCursorShapeDeviceV1ShapeGrab WpCursorShapeDeviceV1Shape = 16
136 WpCursorShapeDeviceV1ShapeGrabbing WpCursorShapeDeviceV1Shape = 17
137 WpCursorShapeDeviceV1ShapeEResize WpCursorShapeDeviceV1Shape = 18
138 WpCursorShapeDeviceV1ShapeNResize WpCursorShapeDeviceV1Shape = 19
139 WpCursorShapeDeviceV1ShapeNeResize WpCursorShapeDeviceV1Shape = 20
140 WpCursorShapeDeviceV1ShapeNwResize WpCursorShapeDeviceV1Shape = 21
141 WpCursorShapeDeviceV1ShapeSResize WpCursorShapeDeviceV1Shape = 22
142 WpCursorShapeDeviceV1ShapeSeResize WpCursorShapeDeviceV1Shape = 23
143 WpCursorShapeDeviceV1ShapeSwResize WpCursorShapeDeviceV1Shape = 24
144 WpCursorShapeDeviceV1ShapeWResize WpCursorShapeDeviceV1Shape = 25
145 WpCursorShapeDeviceV1ShapeEwResize WpCursorShapeDeviceV1Shape = 26
146 WpCursorShapeDeviceV1ShapeNsResize WpCursorShapeDeviceV1Shape = 27
147 WpCursorShapeDeviceV1ShapeNeswResize WpCursorShapeDeviceV1Shape = 28
148 WpCursorShapeDeviceV1ShapeNwseResize WpCursorShapeDeviceV1Shape = 29
149 WpCursorShapeDeviceV1ShapeColResize WpCursorShapeDeviceV1Shape = 30
150 WpCursorShapeDeviceV1ShapeRowResize WpCursorShapeDeviceV1Shape = 31
151 WpCursorShapeDeviceV1ShapeAllScroll WpCursorShapeDeviceV1Shape = 32
152 WpCursorShapeDeviceV1ShapeZoomIn WpCursorShapeDeviceV1Shape = 33
153 WpCursorShapeDeviceV1ShapeZoomOut WpCursorShapeDeviceV1Shape = 34
154 WpCursorShapeDeviceV1ShapeDndAsk WpCursorShapeDeviceV1Shape = 35
155 WpCursorShapeDeviceV1ShapeAllResize WpCursorShapeDeviceV1Shape = 36
156)
157
158// WpCursorShapeDeviceV1Error .
159type WpCursorShapeDeviceV1Error uint32
160
161const (
162 WpCursorShapeDeviceV1ErrorInvalidShape WpCursorShapeDeviceV1Error = 1
163)
164
165// WpCursorShapeDeviceV1Handler handles wp_cursor_shape_device_v1 requests.
166type WpCursorShapeDeviceV1Handler interface {
167 Destroy(self *WpCursorShapeDeviceV1)
168 SetShape(self *WpCursorShapeDeviceV1, serial uint32, shape uint32)
169}
170
171func NewWpCursorShapeDeviceV1(c server.Client, version int32, id uint32, h WpCursorShapeDeviceV1Handler) (*WpCursorShapeDeviceV1, error) {
172 if h == nil {
173 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_cursor_shape_device_v1")
174 }
175 var self *WpCursorShapeDeviceV1
176 r, err := c.CreateResource(WpCursorShapeDeviceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
177 switch opcode {
178 case 0:
179 h.Destroy(self)
180 self.Destroy()
181 case 1:
182 h.SetShape(self, args[0].Uint(), args[1].Uint())
183 }
184 })
185 if err != nil {
186 return nil, err
187 }
188 self = WrapWpCursorShapeDeviceV1(r)
189 r.Data = self
190 return self, nil
191}
192func NewWpCursorShapeDeviceV1Global(d *server.Display, version int32, bind server.BindFunc) error {
193 return d.CreateGlobal(WpCursorShapeDeviceV1Interface, version, bind)
194}
195func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
196 if v == nil {
197 return nil
198 }
199 return v.GetResource()
200}
201func (self *WpCursorShapeManagerV1) GetResource() *server.Resource {
202 if self == nil {
203 return nil
204 }
205 return self.Resource
206}
207func (self *WpCursorShapeDeviceV1) GetResource() *server.Resource {
208 if self == nil {
209 return nil
210 }
211 return self.Resource
212}