1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: cursor_shape_v1
3// Source: cursor-shape-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright 2018 The Chromium Authors
7// Copyright 2023 Simon Ser
8//
9// Permission is hereby granted, free of charge, to any person obtaining a
10// copy of this software and associated documentation files (the "Software"),
11// to deal in the Software without restriction, including without limitation
12// the rights to use, copy, modify, merge, publish, distribute, sublicense,
13// and/or sell copies of the Software, and to permit persons to whom the
14// Software is furnished to do so, subject to the following conditions:
15// The above copyright notice and this permission notice (including the next
16// paragraph) shall be included in all copies or substantial portions of the
17// Software.
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24// DEALINGS IN THE SOFTWARE.
25
26package cursorshape
27
28import (
29 cross_zwp_tablet_tool_v2 "github.com/bnema/go-wayland-bindings/client/tablet"
30 cross_wl_pointer "github.com/bnema/go-wayland-bindings/client/wayland"
31 "github.com/bnema/wlturbo/wl"
32)
33
34// SHAPE_DEFAULT is the shape default value.
35const SHAPE_DEFAULT = 1
36
37// SHAPE_CONTEXT_MENU is the shape context_menu value.
38const SHAPE_CONTEXT_MENU = 2
39
40// SHAPE_HELP is the shape help value.
41const SHAPE_HELP = 3
42
43// SHAPE_POINTER is the shape pointer value.
44const SHAPE_POINTER = 4
45
46// SHAPE_PROGRESS is the shape progress value.
47const SHAPE_PROGRESS = 5
48
49// SHAPE_WAIT is the shape wait value.
50const SHAPE_WAIT = 6
51
52// SHAPE_CELL is the shape cell value.
53const SHAPE_CELL = 7
54
55// SHAPE_CROSSHAIR is the shape crosshair value.
56const SHAPE_CROSSHAIR = 8
57
58// SHAPE_TEXT is the shape text value.
59const SHAPE_TEXT = 9
60
61// SHAPE_VERTICAL_TEXT is the shape vertical_text value.
62const SHAPE_VERTICAL_TEXT = 10
63
64// SHAPE_ALIAS is the shape alias value.
65const SHAPE_ALIAS = 11
66
67// SHAPE_COPY is the shape copy value.
68const SHAPE_COPY = 12
69
70// SHAPE_MOVE is the shape move value.
71const SHAPE_MOVE = 13
72
73// SHAPE_NO_DROP is the shape no_drop value.
74const SHAPE_NO_DROP = 14
75
76// SHAPE_NOT_ALLOWED is the shape not_allowed value.
77const SHAPE_NOT_ALLOWED = 15
78
79// SHAPE_GRAB is the shape grab value.
80const SHAPE_GRAB = 16
81
82// SHAPE_GRABBING is the shape grabbing value.
83const SHAPE_GRABBING = 17
84
85// SHAPE_E_RESIZE is the shape e_resize value.
86const SHAPE_E_RESIZE = 18
87
88// SHAPE_N_RESIZE is the shape n_resize value.
89const SHAPE_N_RESIZE = 19
90
91// SHAPE_NE_RESIZE is the shape ne_resize value.
92const SHAPE_NE_RESIZE = 20
93
94// SHAPE_NW_RESIZE is the shape nw_resize value.
95const SHAPE_NW_RESIZE = 21
96
97// SHAPE_S_RESIZE is the shape s_resize value.
98const SHAPE_S_RESIZE = 22
99
100// SHAPE_SE_RESIZE is the shape se_resize value.
101const SHAPE_SE_RESIZE = 23
102
103// SHAPE_SW_RESIZE is the shape sw_resize value.
104const SHAPE_SW_RESIZE = 24
105
106// SHAPE_W_RESIZE is the shape w_resize value.
107const SHAPE_W_RESIZE = 25
108
109// SHAPE_EW_RESIZE is the shape ew_resize value.
110const SHAPE_EW_RESIZE = 26
111
112// SHAPE_NS_RESIZE is the shape ns_resize value.
113const SHAPE_NS_RESIZE = 27
114
115// SHAPE_NESW_RESIZE is the shape nesw_resize value.
116const SHAPE_NESW_RESIZE = 28
117
118// SHAPE_NWSE_RESIZE is the shape nwse_resize value.
119const SHAPE_NWSE_RESIZE = 29
120
121// SHAPE_COL_RESIZE is the shape col_resize value.
122const SHAPE_COL_RESIZE = 30
123
124// SHAPE_ROW_RESIZE is the shape row_resize value.
125const SHAPE_ROW_RESIZE = 31
126
127// SHAPE_ALL_SCROLL is the shape all_scroll value.
128const SHAPE_ALL_SCROLL = 32
129
130// SHAPE_ZOOM_IN is the shape zoom_in value.
131const SHAPE_ZOOM_IN = 33
132
133// SHAPE_ZOOM_OUT is the shape zoom_out value.
134const SHAPE_ZOOM_OUT = 34
135
136// SHAPE_DND_ASK is the shape dnd_ask value.
137const SHAPE_DND_ASK = 35
138
139// SHAPE_ALL_RESIZE is the shape all_resize value.
140const SHAPE_ALL_RESIZE = 36
141
142// ERROR_INVALID_SHAPE is the error invalid_shape value.
143const ERROR_INVALID_SHAPE = 1
144
145// WpCursorShapeManagerInterface is the protocol interface name.
146const WpCursorShapeManagerInterface = "wp_cursor_shape_manager_v1"
147
148// WpCursorShapeManager is the generated binding for wp_cursor_shape_manager_v1 version 2.
149type WpCursorShapeManager struct {
150 wl.BaseProxy
151}
152
153// NewWpCursorShapeManager returns an unbound WpCursorShapeManager.
154func NewWpCursorShapeManager(ctx *wl.Context) *WpCursorShapeManager {
155 obj := &WpCursorShapeManager{}
156 obj.SetContext(ctx)
157 ctx.Register(obj)
158 return obj
159}
160
161// Destroy the cursor shape manager.
162func (o *WpCursorShapeManager) Destroy() error {
163 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_cursor_shape_manager_v1.destroy", Destructor: true}); err != nil {
164 return err
165 }
166 return nil
167}
168
169// Obtain a wp_cursor_shape_device_v1 for a wl_pointer object. When the pointer capability is removed from the wl_seat, the wp_cursor_shape_device_v1 object becomes inert.
170func (o *WpCursorShapeManager) GetPointer(pointer *cross_wl_pointer.Pointer) (*WpCursorShapeDevice, error) {
171 var arg1 wl.Object
172 if pointer != nil {
173 arg1 = pointer
174 }
175 child := &WpCursorShapeDevice{}
176 child.SetContext(o.Context())
177 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_cursor_shape_manager_v1.get_pointer", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
178 return nil, err
179 }
180 return child, nil
181}
182
183// Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object. When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1 object becomes inert.
184func (o *WpCursorShapeManager) GetTabletTool(tabletTool *cross_zwp_tablet_tool_v2.TabletTool) (*WpCursorShapeDevice, error) {
185 var arg1 wl.Object
186 if tabletTool != nil {
187 arg1 = tabletTool
188 }
189 child := &WpCursorShapeDevice{}
190 child.SetContext(o.Context())
191 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "wp_cursor_shape_manager_v1.get_tablet_tool_v2", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
192 return nil, err
193 }
194 return child, nil
195}
196
197// EventSignature returns the declared event argument types in wire order.
198func (o *WpCursorShapeManager) EventSignature(opcode uint16) (string, bool) {
199 switch opcode {
200 default:
201 return "", false
202 }
203}
204
205// Dispatch decodes one event on wp_cursor_shape_manager_v1 and calls the registered handlers.
206func (o *WpCursorShapeManager) Dispatch(event *wl.Event) {
207 switch event.Opcode {
208 default:
209 }
210}
211
212// WpCursorShapeDeviceInterface is the protocol interface name.
213const WpCursorShapeDeviceInterface = "wp_cursor_shape_device_v1"
214
215// WpCursorShapeDevice is the generated binding for wp_cursor_shape_device_v1 version 2.
216type WpCursorShapeDevice struct {
217 wl.BaseProxy
218}
219
220// NewWpCursorShapeDevice returns an unbound WpCursorShapeDevice.
221func NewWpCursorShapeDevice(ctx *wl.Context) *WpCursorShapeDevice {
222 obj := &WpCursorShapeDevice{}
223 obj.SetContext(ctx)
224 ctx.Register(obj)
225 return obj
226}
227
228// Destroy the cursor shape device. The device cursor shape remains unchanged.
229func (o *WpCursorShapeDevice) Destroy() error {
230 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_cursor_shape_device_v1.destroy", Destructor: true}); err != nil {
231 return err
232 }
233 return nil
234}
235
236// Sets the device cursor to the specified shape. The compositor will change the cursor image based on the specified shape. The cursor actually changes only if the input device focus is one of the requesting client's surfaces. If any, the previous cursor image (surface or shape) is replaced. The "shape" argument must be a valid enum entry, otherwise the invalid_shape protocol error is raised. This is similar to the wl_pointer.set_cursor and zwp_tablet_tool_v2.set_cursor requests, but this request accepts a shape instead of contents in the form of a surface. Clients can mix set_cursor and set_shape requests. The serial parameter must match the latest wl_pointer.enter or zwp_tablet_tool_v2.proximity_in serial number sent to the client. Otherwise the request will be ignored.
237func (o *WpCursorShapeDevice) SetShape(serial uint32, shape uint32) error {
238 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_cursor_shape_device_v1.set_shape"}, wl.ArgUint(serial), wl.ArgUint(shape)); err != nil {
239 return err
240 }
241 return nil
242}
243
244// EventSignature returns the declared event argument types in wire order.
245func (o *WpCursorShapeDevice) EventSignature(opcode uint16) (string, bool) {
246 switch opcode {
247 default:
248 return "", false
249 }
250}
251
252// Dispatch decodes one event on wp_cursor_shape_device_v1 and calls the registered handlers.
253func (o *WpCursorShapeDevice) Dispatch(event *wl.Event) {
254 switch event.Opcode {
255 default:
256 }
257}