detached 1a6c6c9

tablet_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: tablet_v2
3// Source: tablet-v2.xml
4
5// Upstream protocol copyright and license:
6// Copyright 2014 © Stephen "Lyude" Chandler Paul
7// Copyright 2015-2024 © Red Hat, Inc.
8//
9// Permission is hereby granted, free of charge, to any person
10// obtaining a copy of this software and associated documentation files
11// (the "Software"), to deal in the Software without restriction,
12// including without limitation the rights to use, copy, modify, merge,
13// publish, distribute, sublicense, and/or sell copies of the Software,
14// and to permit persons to whom the Software is furnished to do so,
15// subject to the following conditions:
16//
17// The above copyright notice and this permission notice (including the
18// next paragraph) shall be included in all copies or substantial
19// portions of the Software.
20//
21// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24// NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
25// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28// SOFTWARE.
29
30package tablet
31
32import (
33	"sync"
34
35	cross_wl_seat "github.com/bnema/go-wayland-bindings/client/wayland"
36	cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
37	"github.com/bnema/wlturbo/wl"
38)
39
40// TYPE_PEN is the type pen value.
41const TYPE_PEN = 0x140
42
43// TYPE_ERASER is the type eraser value.
44const TYPE_ERASER = 0x141
45
46// TYPE_BRUSH is the type brush value.
47const TYPE_BRUSH = 0x142
48
49// TYPE_PENCIL is the type pencil value.
50const TYPE_PENCIL = 0x143
51
52// TYPE_AIRBRUSH is the type airbrush value.
53const TYPE_AIRBRUSH = 0x144
54
55// TYPE_FINGER is the type finger value.
56const TYPE_FINGER = 0x145
57
58// TYPE_MOUSE is the type mouse value.
59const TYPE_MOUSE = 0x146
60
61// TYPE_LENS is the type lens value.
62const TYPE_LENS = 0x147
63
64// CAPABILITY_TILT is the capability tilt value.
65const CAPABILITY_TILT = 1
66
67// CAPABILITY_PRESSURE is the capability pressure value.
68const CAPABILITY_PRESSURE = 2
69
70// CAPABILITY_DISTANCE is the capability distance value.
71const CAPABILITY_DISTANCE = 3
72
73// CAPABILITY_ROTATION is the capability rotation value.
74const CAPABILITY_ROTATION = 4
75
76// CAPABILITY_SLIDER is the capability slider value.
77const CAPABILITY_SLIDER = 5
78
79// CAPABILITY_WHEEL is the capability wheel value.
80const CAPABILITY_WHEEL = 6
81
82// ZWP_TABLET_TOOL_V2_BUTTON_STATE_RELEASED is the button_state released value.
83const ZWP_TABLET_TOOL_V2_BUTTON_STATE_RELEASED = 0
84
85// ZWP_TABLET_TOOL_V2_BUTTON_STATE_PRESSED is the button_state pressed value.
86const ZWP_TABLET_TOOL_V2_BUTTON_STATE_PRESSED = 1
87
88// ERROR_ROLE is the error role value.
89const ERROR_ROLE = 0
90
91// BUSTYPE_USB is the bustype usb value.
92const BUSTYPE_USB = 3
93
94// BUSTYPE_BLUETOOTH is the bustype bluetooth value.
95const BUSTYPE_BLUETOOTH = 5
96
97// BUSTYPE_VIRTUAL is the bustype virtual value.
98const BUSTYPE_VIRTUAL = 6
99
100// BUSTYPE_SERIAL is the bustype serial value.
101const BUSTYPE_SERIAL = 17
102
103// BUSTYPE_I2C is the bustype i2c value.
104const BUSTYPE_I2C = 24
105
106// ZWP_TABLET_PAD_RING_V2_SOURCE_FINGER is the source finger value.
107const ZWP_TABLET_PAD_RING_V2_SOURCE_FINGER = 1
108
109// ZWP_TABLET_PAD_STRIP_V2_SOURCE_FINGER is the source finger value.
110const ZWP_TABLET_PAD_STRIP_V2_SOURCE_FINGER = 1
111
112// ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED is the button_state released value.
113const ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED = 0
114
115// ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED is the button_state pressed value.
116const ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED = 1
117
118// TabletManagerInterface is the protocol interface name.
119const TabletManagerInterface = "zwp_tablet_manager_v2"
120
121// TabletManager is the generated binding for zwp_tablet_manager_v2 version 2.
122type TabletManager struct {
123	wl.BaseProxy
124}
125
126// NewTabletManager returns an unbound TabletManager.
127func NewTabletManager(ctx *wl.Context) *TabletManager {
128	obj := &TabletManager{}
129	obj.SetContext(ctx)
130	ctx.Register(obj)
131	return obj
132}
133
134// Get the zwp_tablet_seat_v2 object for the given seat. This object provides access to all graphics tablets in this seat.
135func (o *TabletManager) GetTabletSeat(seat *cross_wl_seat.Seat) (*TabletSeat, error) {
136	var arg1 wl.Object
137	if seat != nil {
138		arg1 = seat
139	}
140	child := &TabletSeat{}
141	child.SetContext(o.Context())
142	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_manager_v2.get_tablet_seat", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
143		return nil, err
144	}
145	return child, nil
146}
147
148// Destroy the zwp_tablet_manager_v2 object. Objects created from this object are unaffected and should be destroyed separately.
149func (o *TabletManager) Destroy() error {
150	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_manager_v2.destroy", Destructor: true}); err != nil {
151		return err
152	}
153	return nil
154}
155
156// EventSignature returns the declared event argument types in wire order.
157func (o *TabletManager) EventSignature(opcode uint16) (string, bool) {
158	switch opcode {
159	default:
160		return "", false
161	}
162}
163
164// Dispatch decodes one event on zwp_tablet_manager_v2 and calls the registered handlers.
165func (o *TabletManager) Dispatch(event *wl.Event) {
166	switch event.Opcode {
167	default:
168	}
169}
170
171// TabletSeatInterface is the protocol interface name.
172const TabletSeatInterface = "zwp_tablet_seat_v2"
173
174// TabletSeat is the generated binding for zwp_tablet_seat_v2 version 2.
175type TabletSeat struct {
176	wl.BaseProxy
177	// handlersMu guards the handler slices: a client may register or replace
178	// handlers while another goroutine dispatches events.
179	handlersMu    sync.Mutex
180	onTabletAdded []func(idObject *Tablet)
181	onToolAdded   []func(idObject *TabletTool)
182	onPadAdded    []func(idObject *TabletPad)
183}
184
185// NewTabletSeat returns an unbound TabletSeat.
186func NewTabletSeat(ctx *wl.Context) *TabletSeat {
187	obj := &TabletSeat{}
188	obj.SetContext(ctx)
189	ctx.Register(obj)
190	return obj
191}
192
193// Destroy the zwp_tablet_seat_v2 object. Objects created from this object are unaffected and should be destroyed separately.
194func (o *TabletSeat) Destroy() error {
195	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_seat_v2.destroy", Destructor: true}); err != nil {
196		return err
197	}
198	return nil
199}
200
201// OnTabletAdded registers a handler for the tablet_added event.
202//
203// Handlers are appended, so a second call adds another handler rather than
204// replacing the first. Registration is safe while another goroutine dispatches.
205func (o *TabletSeat) OnTabletAdded(handler func(idObject *Tablet)) {
206	if handler == nil {
207		return
208	}
209	o.handlersMu.Lock()
210	defer o.handlersMu.Unlock()
211	o.onTabletAdded = append(o.onTabletAdded, handler)
212}
213
214// handlersForTabletAdded returns the handlers registered for tablet_added, taken
215// under the lock so a handler may register another handler while events are
216// being dispatched.
217func (o *TabletSeat) handlersForTabletAdded() []func(idObject *Tablet) {
218	o.handlersMu.Lock()
219	defer o.handlersMu.Unlock()
220	return o.onTabletAdded
221}
222
223// OnToolAdded registers a handler for the tool_added event.
224//
225// Handlers are appended, so a second call adds another handler rather than
226// replacing the first. Registration is safe while another goroutine dispatches.
227func (o *TabletSeat) OnToolAdded(handler func(idObject *TabletTool)) {
228	if handler == nil {
229		return
230	}
231	o.handlersMu.Lock()
232	defer o.handlersMu.Unlock()
233	o.onToolAdded = append(o.onToolAdded, handler)
234}
235
236// handlersForToolAdded returns the handlers registered for tool_added, taken
237// under the lock so a handler may register another handler while events are
238// being dispatched.
239func (o *TabletSeat) handlersForToolAdded() []func(idObject *TabletTool) {
240	o.handlersMu.Lock()
241	defer o.handlersMu.Unlock()
242	return o.onToolAdded
243}
244
245// OnPadAdded registers a handler for the pad_added event.
246//
247// Handlers are appended, so a second call adds another handler rather than
248// replacing the first. Registration is safe while another goroutine dispatches.
249func (o *TabletSeat) OnPadAdded(handler func(idObject *TabletPad)) {
250	if handler == nil {
251		return
252	}
253	o.handlersMu.Lock()
254	defer o.handlersMu.Unlock()
255	o.onPadAdded = append(o.onPadAdded, handler)
256}
257
258// handlersForPadAdded returns the handlers registered for pad_added, taken
259// under the lock so a handler may register another handler while events are
260// being dispatched.
261func (o *TabletSeat) handlersForPadAdded() []func(idObject *TabletPad) {
262	o.handlersMu.Lock()
263	defer o.handlersMu.Unlock()
264	return o.onPadAdded
265}
266
267// EventSignature returns the declared event argument types in wire order.
268func (o *TabletSeat) EventSignature(opcode uint16) (string, bool) {
269	switch opcode {
270	case 0:
271		return "new_id,", true
272	case 1:
273		return "new_id,", true
274	case 2:
275		return "new_id,", true
276	default:
277		return "", false
278	}
279}
280
281// Dispatch decodes one event on zwp_tablet_seat_v2 and calls the registered handlers.
282func (o *TabletSeat) Dispatch(event *wl.Event) {
283	switch event.Opcode {
284	case 0: // tablet_added
285		idID := event.Uint32()
286		idObject := &Tablet{}
287		idObject.SetContext(o.Context())
288		idObject.SetID(idID)
289		idObject.SetVersion(o.Version())
290		o.Context().Register(idObject)
291
292		for i, handler := range o.handlersForTabletAdded() {
293			_ = i
294			handler(idObject)
295		}
296	case 1: // tool_added
297		idID := event.Uint32()
298		idObject := &TabletTool{}
299		idObject.SetContext(o.Context())
300		idObject.SetID(idID)
301		idObject.SetVersion(o.Version())
302		o.Context().Register(idObject)
303
304		for i, handler := range o.handlersForToolAdded() {
305			_ = i
306			handler(idObject)
307		}
308	case 2: // pad_added
309		idID := event.Uint32()
310		idObject := &TabletPad{}
311		idObject.SetContext(o.Context())
312		idObject.SetID(idID)
313		idObject.SetVersion(o.Version())
314		o.Context().Register(idObject)
315
316		for i, handler := range o.handlersForPadAdded() {
317			_ = i
318			handler(idObject)
319		}
320	default:
321	}
322}
323
324// TabletToolInterface is the protocol interface name.
325const TabletToolInterface = "zwp_tablet_tool_v2"
326
327// TabletTool is the generated binding for zwp_tablet_tool_v2 version 2.
328type TabletTool struct {
329	wl.BaseProxy
330	// handlersMu guards the handler slices: a client may register or replace
331	// handlers while another goroutine dispatches events.
332	handlersMu        sync.Mutex
333	onType            []func(toolType uint32)
334	onHardwareSerial  []func(hardwareSerialHi uint32, hardwareSerialLo uint32)
335	onHardwareIdWacom []func(hardwareIdHi uint32, hardwareIdLo uint32)
336	onCapability      []func(capability uint32)
337	onDone            []func()
338	onRemoved         []func()
339	onProximityIn     []func(serial uint32, tabletID uint32, surfaceID uint32)
340	onProximityOut    []func()
341	onDown            []func(serial uint32)
342	onUp              []func()
343	onMotion          []func(x wl.Fixed, y wl.Fixed)
344	onPressure        []func(pressure uint32)
345	onDistance        []func(distance uint32)
346	onTilt            []func(tiltX wl.Fixed, tiltY wl.Fixed)
347	onRotation        []func(degrees wl.Fixed)
348	onSlider          []func(position int32)
349	onWheel           []func(degrees wl.Fixed, clicks int32)
350	onButton          []func(serial uint32, button uint32, state uint32)
351	onFrame           []func(time uint32)
352}
353
354// NewTabletTool returns an unbound TabletTool.
355func NewTabletTool(ctx *wl.Context) *TabletTool {
356	obj := &TabletTool{}
357	obj.SetContext(ctx)
358	ctx.Register(obj)
359	return obj
360}
361
362// Sets the surface of the cursor used for this tool on the given tablet. This request only takes effect if the tool is in proximity of one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request it is replaced. If surface is NULL, the cursor image is hidden. The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. On surface.attach requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. Attach must be confirmed by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. The current and pending input regions of the wl_surface are cleared, and wl_surface.set_input_region is ignored until the wl_surface is no longer used as the cursor. When the use as a cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. This request gives the surface the role of a zwp_tablet_tool_v2 cursor. A surface may only ever be used as the cursor surface for one zwp_tablet_tool_v2. If the surface already has another role or has previously been used as cursor surface for a different tool, a protocol error is raised.
363func (o *TabletTool) SetCursor(serial uint32, surface *cross_wl_surface.Surface, hotspotX int32, hotspotY int32) error {
364	var arg1 wl.Object
365	if surface != nil {
366		arg1 = surface
367	}
368	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_tool_v2.set_cursor"}, wl.ArgUint(serial), wl.ArgObject(arg1), wl.ArgInt(hotspotX), wl.ArgInt(hotspotY)); err != nil {
369		return err
370	}
371	return nil
372}
373
374// This destroys the client's resource for this tool object.
375func (o *TabletTool) Destroy() error {
376	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_tool_v2.destroy", Destructor: true}); err != nil {
377		return err
378	}
379	return nil
380}
381
382// OnType registers a handler for the type event.
383//
384// Handlers are appended, so a second call adds another handler rather than
385// replacing the first. Registration is safe while another goroutine dispatches.
386func (o *TabletTool) OnType(handler func(toolType uint32)) {
387	if handler == nil {
388		return
389	}
390	o.handlersMu.Lock()
391	defer o.handlersMu.Unlock()
392	o.onType = append(o.onType, handler)
393}
394
395// handlersForType returns the handlers registered for type, taken
396// under the lock so a handler may register another handler while events are
397// being dispatched.
398func (o *TabletTool) handlersForType() []func(toolType uint32) {
399	o.handlersMu.Lock()
400	defer o.handlersMu.Unlock()
401	return o.onType
402}
403
404// OnHardwareSerial registers a handler for the hardware_serial event.
405//
406// Handlers are appended, so a second call adds another handler rather than
407// replacing the first. Registration is safe while another goroutine dispatches.
408func (o *TabletTool) OnHardwareSerial(handler func(hardwareSerialHi uint32, hardwareSerialLo uint32)) {
409	if handler == nil {
410		return
411	}
412	o.handlersMu.Lock()
413	defer o.handlersMu.Unlock()
414	o.onHardwareSerial = append(o.onHardwareSerial, handler)
415}
416
417// handlersForHardwareSerial returns the handlers registered for hardware_serial, taken
418// under the lock so a handler may register another handler while events are
419// being dispatched.
420func (o *TabletTool) handlersForHardwareSerial() []func(hardwareSerialHi uint32, hardwareSerialLo uint32) {
421	o.handlersMu.Lock()
422	defer o.handlersMu.Unlock()
423	return o.onHardwareSerial
424}
425
426// OnHardwareIdWacom registers a handler for the hardware_id_wacom event.
427//
428// Handlers are appended, so a second call adds another handler rather than
429// replacing the first. Registration is safe while another goroutine dispatches.
430func (o *TabletTool) OnHardwareIdWacom(handler func(hardwareIdHi uint32, hardwareIdLo uint32)) {
431	if handler == nil {
432		return
433	}
434	o.handlersMu.Lock()
435	defer o.handlersMu.Unlock()
436	o.onHardwareIdWacom = append(o.onHardwareIdWacom, handler)
437}
438
439// handlersForHardwareIdWacom returns the handlers registered for hardware_id_wacom, taken
440// under the lock so a handler may register another handler while events are
441// being dispatched.
442func (o *TabletTool) handlersForHardwareIdWacom() []func(hardwareIdHi uint32, hardwareIdLo uint32) {
443	o.handlersMu.Lock()
444	defer o.handlersMu.Unlock()
445	return o.onHardwareIdWacom
446}
447
448// OnCapability registers a handler for the capability event.
449//
450// Handlers are appended, so a second call adds another handler rather than
451// replacing the first. Registration is safe while another goroutine dispatches.
452func (o *TabletTool) OnCapability(handler func(capability uint32)) {
453	if handler == nil {
454		return
455	}
456	o.handlersMu.Lock()
457	defer o.handlersMu.Unlock()
458	o.onCapability = append(o.onCapability, handler)
459}
460
461// handlersForCapability returns the handlers registered for capability, taken
462// under the lock so a handler may register another handler while events are
463// being dispatched.
464func (o *TabletTool) handlersForCapability() []func(capability uint32) {
465	o.handlersMu.Lock()
466	defer o.handlersMu.Unlock()
467	return o.onCapability
468}
469
470// OnDone registers a handler for the done event.
471//
472// Handlers are appended, so a second call adds another handler rather than
473// replacing the first. Registration is safe while another goroutine dispatches.
474func (o *TabletTool) OnDone(handler func()) {
475	if handler == nil {
476		return
477	}
478	o.handlersMu.Lock()
479	defer o.handlersMu.Unlock()
480	o.onDone = append(o.onDone, handler)
481}
482
483// handlersForDone returns the handlers registered for done, taken
484// under the lock so a handler may register another handler while events are
485// being dispatched.
486func (o *TabletTool) handlersForDone() []func() {
487	o.handlersMu.Lock()
488	defer o.handlersMu.Unlock()
489	return o.onDone
490}
491
492// OnRemoved registers a handler for the removed event.
493//
494// Handlers are appended, so a second call adds another handler rather than
495// replacing the first. Registration is safe while another goroutine dispatches.
496func (o *TabletTool) OnRemoved(handler func()) {
497	if handler == nil {
498		return
499	}
500	o.handlersMu.Lock()
501	defer o.handlersMu.Unlock()
502	o.onRemoved = append(o.onRemoved, handler)
503}
504
505// handlersForRemoved returns the handlers registered for removed, taken
506// under the lock so a handler may register another handler while events are
507// being dispatched.
508func (o *TabletTool) handlersForRemoved() []func() {
509	o.handlersMu.Lock()
510	defer o.handlersMu.Unlock()
511	return o.onRemoved
512}
513
514// OnProximityIn registers a handler for the proximity_in event.
515//
516// Handlers are appended, so a second call adds another handler rather than
517// replacing the first. Registration is safe while another goroutine dispatches.
518func (o *TabletTool) OnProximityIn(handler func(serial uint32, tabletID uint32, surfaceID uint32)) {
519	if handler == nil {
520		return
521	}
522	o.handlersMu.Lock()
523	defer o.handlersMu.Unlock()
524	o.onProximityIn = append(o.onProximityIn, handler)
525}
526
527// handlersForProximityIn returns the handlers registered for proximity_in, taken
528// under the lock so a handler may register another handler while events are
529// being dispatched.
530func (o *TabletTool) handlersForProximityIn() []func(serial uint32, tabletID uint32, surfaceID uint32) {
531	o.handlersMu.Lock()
532	defer o.handlersMu.Unlock()
533	return o.onProximityIn
534}
535
536// OnProximityOut registers a handler for the proximity_out event.
537//
538// Handlers are appended, so a second call adds another handler rather than
539// replacing the first. Registration is safe while another goroutine dispatches.
540func (o *TabletTool) OnProximityOut(handler func()) {
541	if handler == nil {
542		return
543	}
544	o.handlersMu.Lock()
545	defer o.handlersMu.Unlock()
546	o.onProximityOut = append(o.onProximityOut, handler)
547}
548
549// handlersForProximityOut returns the handlers registered for proximity_out, taken
550// under the lock so a handler may register another handler while events are
551// being dispatched.
552func (o *TabletTool) handlersForProximityOut() []func() {
553	o.handlersMu.Lock()
554	defer o.handlersMu.Unlock()
555	return o.onProximityOut
556}
557
558// OnDown registers a handler for the down event.
559//
560// Handlers are appended, so a second call adds another handler rather than
561// replacing the first. Registration is safe while another goroutine dispatches.
562func (o *TabletTool) OnDown(handler func(serial uint32)) {
563	if handler == nil {
564		return
565	}
566	o.handlersMu.Lock()
567	defer o.handlersMu.Unlock()
568	o.onDown = append(o.onDown, handler)
569}
570
571// handlersForDown returns the handlers registered for down, taken
572// under the lock so a handler may register another handler while events are
573// being dispatched.
574func (o *TabletTool) handlersForDown() []func(serial uint32) {
575	o.handlersMu.Lock()
576	defer o.handlersMu.Unlock()
577	return o.onDown
578}
579
580// OnUp registers a handler for the up event.
581//
582// Handlers are appended, so a second call adds another handler rather than
583// replacing the first. Registration is safe while another goroutine dispatches.
584func (o *TabletTool) OnUp(handler func()) {
585	if handler == nil {
586		return
587	}
588	o.handlersMu.Lock()
589	defer o.handlersMu.Unlock()
590	o.onUp = append(o.onUp, handler)
591}
592
593// handlersForUp returns the handlers registered for up, taken
594// under the lock so a handler may register another handler while events are
595// being dispatched.
596func (o *TabletTool) handlersForUp() []func() {
597	o.handlersMu.Lock()
598	defer o.handlersMu.Unlock()
599	return o.onUp
600}
601
602// OnMotion registers a handler for the motion event.
603//
604// Handlers are appended, so a second call adds another handler rather than
605// replacing the first. Registration is safe while another goroutine dispatches.
606func (o *TabletTool) OnMotion(handler func(x wl.Fixed, y wl.Fixed)) {
607	if handler == nil {
608		return
609	}
610	o.handlersMu.Lock()
611	defer o.handlersMu.Unlock()
612	o.onMotion = append(o.onMotion, handler)
613}
614
615// handlersForMotion returns the handlers registered for motion, taken
616// under the lock so a handler may register another handler while events are
617// being dispatched.
618func (o *TabletTool) handlersForMotion() []func(x wl.Fixed, y wl.Fixed) {
619	o.handlersMu.Lock()
620	defer o.handlersMu.Unlock()
621	return o.onMotion
622}
623
624// OnPressure registers a handler for the pressure event.
625//
626// Handlers are appended, so a second call adds another handler rather than
627// replacing the first. Registration is safe while another goroutine dispatches.
628func (o *TabletTool) OnPressure(handler func(pressure uint32)) {
629	if handler == nil {
630		return
631	}
632	o.handlersMu.Lock()
633	defer o.handlersMu.Unlock()
634	o.onPressure = append(o.onPressure, handler)
635}
636
637// handlersForPressure returns the handlers registered for pressure, taken
638// under the lock so a handler may register another handler while events are
639// being dispatched.
640func (o *TabletTool) handlersForPressure() []func(pressure uint32) {
641	o.handlersMu.Lock()
642	defer o.handlersMu.Unlock()
643	return o.onPressure
644}
645
646// OnDistance registers a handler for the distance event.
647//
648// Handlers are appended, so a second call adds another handler rather than
649// replacing the first. Registration is safe while another goroutine dispatches.
650func (o *TabletTool) OnDistance(handler func(distance uint32)) {
651	if handler == nil {
652		return
653	}
654	o.handlersMu.Lock()
655	defer o.handlersMu.Unlock()
656	o.onDistance = append(o.onDistance, handler)
657}
658
659// handlersForDistance returns the handlers registered for distance, taken
660// under the lock so a handler may register another handler while events are
661// being dispatched.
662func (o *TabletTool) handlersForDistance() []func(distance uint32) {
663	o.handlersMu.Lock()
664	defer o.handlersMu.Unlock()
665	return o.onDistance
666}
667
668// OnTilt registers a handler for the tilt event.
669//
670// Handlers are appended, so a second call adds another handler rather than
671// replacing the first. Registration is safe while another goroutine dispatches.
672func (o *TabletTool) OnTilt(handler func(tiltX wl.Fixed, tiltY wl.Fixed)) {
673	if handler == nil {
674		return
675	}
676	o.handlersMu.Lock()
677	defer o.handlersMu.Unlock()
678	o.onTilt = append(o.onTilt, handler)
679}
680
681// handlersForTilt returns the handlers registered for tilt, taken
682// under the lock so a handler may register another handler while events are
683// being dispatched.
684func (o *TabletTool) handlersForTilt() []func(tiltX wl.Fixed, tiltY wl.Fixed) {
685	o.handlersMu.Lock()
686	defer o.handlersMu.Unlock()
687	return o.onTilt
688}
689
690// OnRotation registers a handler for the rotation event.
691//
692// Handlers are appended, so a second call adds another handler rather than
693// replacing the first. Registration is safe while another goroutine dispatches.
694func (o *TabletTool) OnRotation(handler func(degrees wl.Fixed)) {
695	if handler == nil {
696		return
697	}
698	o.handlersMu.Lock()
699	defer o.handlersMu.Unlock()
700	o.onRotation = append(o.onRotation, handler)
701}
702
703// handlersForRotation returns the handlers registered for rotation, taken
704// under the lock so a handler may register another handler while events are
705// being dispatched.
706func (o *TabletTool) handlersForRotation() []func(degrees wl.Fixed) {
707	o.handlersMu.Lock()
708	defer o.handlersMu.Unlock()
709	return o.onRotation
710}
711
712// OnSlider registers a handler for the slider event.
713//
714// Handlers are appended, so a second call adds another handler rather than
715// replacing the first. Registration is safe while another goroutine dispatches.
716func (o *TabletTool) OnSlider(handler func(position int32)) {
717	if handler == nil {
718		return
719	}
720	o.handlersMu.Lock()
721	defer o.handlersMu.Unlock()
722	o.onSlider = append(o.onSlider, handler)
723}
724
725// handlersForSlider returns the handlers registered for slider, taken
726// under the lock so a handler may register another handler while events are
727// being dispatched.
728func (o *TabletTool) handlersForSlider() []func(position int32) {
729	o.handlersMu.Lock()
730	defer o.handlersMu.Unlock()
731	return o.onSlider
732}
733
734// OnWheel registers a handler for the wheel event.
735//
736// Handlers are appended, so a second call adds another handler rather than
737// replacing the first. Registration is safe while another goroutine dispatches.
738func (o *TabletTool) OnWheel(handler func(degrees wl.Fixed, clicks int32)) {
739	if handler == nil {
740		return
741	}
742	o.handlersMu.Lock()
743	defer o.handlersMu.Unlock()
744	o.onWheel = append(o.onWheel, handler)
745}
746
747// handlersForWheel returns the handlers registered for wheel, taken
748// under the lock so a handler may register another handler while events are
749// being dispatched.
750func (o *TabletTool) handlersForWheel() []func(degrees wl.Fixed, clicks int32) {
751	o.handlersMu.Lock()
752	defer o.handlersMu.Unlock()
753	return o.onWheel
754}
755
756// OnButton registers a handler for the button event.
757//
758// Handlers are appended, so a second call adds another handler rather than
759// replacing the first. Registration is safe while another goroutine dispatches.
760func (o *TabletTool) OnButton(handler func(serial uint32, button uint32, state uint32)) {
761	if handler == nil {
762		return
763	}
764	o.handlersMu.Lock()
765	defer o.handlersMu.Unlock()
766	o.onButton = append(o.onButton, handler)
767}
768
769// handlersForButton returns the handlers registered for button, taken
770// under the lock so a handler may register another handler while events are
771// being dispatched.
772func (o *TabletTool) handlersForButton() []func(serial uint32, button uint32, state uint32) {
773	o.handlersMu.Lock()
774	defer o.handlersMu.Unlock()
775	return o.onButton
776}
777
778// OnFrame registers a handler for the frame event.
779//
780// Handlers are appended, so a second call adds another handler rather than
781// replacing the first. Registration is safe while another goroutine dispatches.
782func (o *TabletTool) OnFrame(handler func(time uint32)) {
783	if handler == nil {
784		return
785	}
786	o.handlersMu.Lock()
787	defer o.handlersMu.Unlock()
788	o.onFrame = append(o.onFrame, handler)
789}
790
791// handlersForFrame returns the handlers registered for frame, taken
792// under the lock so a handler may register another handler while events are
793// being dispatched.
794func (o *TabletTool) handlersForFrame() []func(time uint32) {
795	o.handlersMu.Lock()
796	defer o.handlersMu.Unlock()
797	return o.onFrame
798}
799
800// EventSignature returns the declared event argument types in wire order.
801func (o *TabletTool) EventSignature(opcode uint16) (string, bool) {
802	switch opcode {
803	case 0:
804		return "uint,", true
805	case 1:
806		return "uint,uint,", true
807	case 2:
808		return "uint,uint,", true
809	case 3:
810		return "uint,", true
811	case 4:
812		return "", true
813	case 5:
814		return "", true
815	case 6:
816		return "uint,object,object,", true
817	case 7:
818		return "", true
819	case 8:
820		return "uint,", true
821	case 9:
822		return "", true
823	case 10:
824		return "fixed,fixed,", true
825	case 11:
826		return "uint,", true
827	case 12:
828		return "uint,", true
829	case 13:
830		return "fixed,fixed,", true
831	case 14:
832		return "fixed,", true
833	case 15:
834		return "int,", true
835	case 16:
836		return "fixed,int,", true
837	case 17:
838		return "uint,uint,uint,", true
839	case 18:
840		return "uint,", true
841	default:
842		return "", false
843	}
844}
845
846// Dispatch decodes one event on zwp_tablet_tool_v2 and calls the registered handlers.
847func (o *TabletTool) Dispatch(event *wl.Event) {
848	switch event.Opcode {
849	case 0: // type
850		toolType := event.Uint32()
851
852		for i, handler := range o.handlersForType() {
853			_ = i
854			handler(toolType)
855		}
856	case 1: // hardware_serial
857		hardwareSerialHi := event.Uint32()
858		hardwareSerialLo := event.Uint32()
859
860		for i, handler := range o.handlersForHardwareSerial() {
861			_ = i
862			handler(hardwareSerialHi, hardwareSerialLo)
863		}
864	case 2: // hardware_id_wacom
865		hardwareIdHi := event.Uint32()
866		hardwareIdLo := event.Uint32()
867
868		for i, handler := range o.handlersForHardwareIdWacom() {
869			_ = i
870			handler(hardwareIdHi, hardwareIdLo)
871		}
872	case 3: // capability
873		capability := event.Uint32()
874
875		for i, handler := range o.handlersForCapability() {
876			_ = i
877			handler(capability)
878		}
879	case 4: // done
880
881		for i, handler := range o.handlersForDone() {
882			_ = i
883			handler()
884		}
885	case 5: // removed
886
887		for i, handler := range o.handlersForRemoved() {
888			_ = i
889			handler()
890		}
891	case 6: // proximity_in
892		serial := event.Uint32()
893		tabletID := event.Uint32()
894		surfaceID := event.Uint32()
895
896		for i, handler := range o.handlersForProximityIn() {
897			_ = i
898			handler(serial, tabletID, surfaceID)
899		}
900	case 7: // proximity_out
901
902		for i, handler := range o.handlersForProximityOut() {
903			_ = i
904			handler()
905		}
906	case 8: // down
907		serial := event.Uint32()
908
909		for i, handler := range o.handlersForDown() {
910			_ = i
911			handler(serial)
912		}
913	case 9: // up
914
915		for i, handler := range o.handlersForUp() {
916			_ = i
917			handler()
918		}
919	case 10: // motion
920		x := event.Fixed()
921		y := event.Fixed()
922
923		for i, handler := range o.handlersForMotion() {
924			_ = i
925			handler(x, y)
926		}
927	case 11: // pressure
928		pressure := event.Uint32()
929
930		for i, handler := range o.handlersForPressure() {
931			_ = i
932			handler(pressure)
933		}
934	case 12: // distance
935		distance := event.Uint32()
936
937		for i, handler := range o.handlersForDistance() {
938			_ = i
939			handler(distance)
940		}
941	case 13: // tilt
942		tiltX := event.Fixed()
943		tiltY := event.Fixed()
944
945		for i, handler := range o.handlersForTilt() {
946			_ = i
947			handler(tiltX, tiltY)
948		}
949	case 14: // rotation
950		degrees := event.Fixed()
951
952		for i, handler := range o.handlersForRotation() {
953			_ = i
954			handler(degrees)
955		}
956	case 15: // slider
957		position := event.Int32()
958
959		for i, handler := range o.handlersForSlider() {
960			_ = i
961			handler(position)
962		}
963	case 16: // wheel
964		degrees := event.Fixed()
965		clicks := event.Int32()
966
967		for i, handler := range o.handlersForWheel() {
968			_ = i
969			handler(degrees, clicks)
970		}
971	case 17: // button
972		serial := event.Uint32()
973		button := event.Uint32()
974		state := event.Uint32()
975
976		for i, handler := range o.handlersForButton() {
977			_ = i
978			handler(serial, button, state)
979		}
980	case 18: // frame
981		time := event.Uint32()
982
983		for i, handler := range o.handlersForFrame() {
984			_ = i
985			handler(time)
986		}
987	default:
988	}
989}
990
991// TabletInterface is the protocol interface name.
992const TabletInterface = "zwp_tablet_v2"
993
994// Tablet is the generated binding for zwp_tablet_v2 version 2.
995type Tablet struct {
996	wl.BaseProxy
997	// handlersMu guards the handler slices: a client may register or replace
998	// handlers while another goroutine dispatches events.
999	handlersMu sync.Mutex
1000	onName     []func(name string)
1001	onId       []func(vid uint32, pid uint32)
1002	onPath     []func(path string)
1003	onDone     []func()
1004	onRemoved  []func()
1005	onBustype  []func(bustype uint32)
1006}
1007
1008// NewTablet returns an unbound Tablet.
1009func NewTablet(ctx *wl.Context) *Tablet {
1010	obj := &Tablet{}
1011	obj.SetContext(ctx)
1012	ctx.Register(obj)
1013	return obj
1014}
1015
1016// This destroys the client's resource for this tablet object.
1017func (o *Tablet) Destroy() error {
1018	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_v2.destroy", Destructor: true}); err != nil {
1019		return err
1020	}
1021	return nil
1022}
1023
1024// OnName registers a handler for the name event.
1025//
1026// Handlers are appended, so a second call adds another handler rather than
1027// replacing the first. Registration is safe while another goroutine dispatches.
1028func (o *Tablet) OnName(handler func(name string)) {
1029	if handler == nil {
1030		return
1031	}
1032	o.handlersMu.Lock()
1033	defer o.handlersMu.Unlock()
1034	o.onName = append(o.onName, handler)
1035}
1036
1037// handlersForName returns the handlers registered for name, taken
1038// under the lock so a handler may register another handler while events are
1039// being dispatched.
1040func (o *Tablet) handlersForName() []func(name string) {
1041	o.handlersMu.Lock()
1042	defer o.handlersMu.Unlock()
1043	return o.onName
1044}
1045
1046// OnId registers a handler for the id event.
1047//
1048// Handlers are appended, so a second call adds another handler rather than
1049// replacing the first. Registration is safe while another goroutine dispatches.
1050func (o *Tablet) OnId(handler func(vid uint32, pid uint32)) {
1051	if handler == nil {
1052		return
1053	}
1054	o.handlersMu.Lock()
1055	defer o.handlersMu.Unlock()
1056	o.onId = append(o.onId, handler)
1057}
1058
1059// handlersForId returns the handlers registered for id, taken
1060// under the lock so a handler may register another handler while events are
1061// being dispatched.
1062func (o *Tablet) handlersForId() []func(vid uint32, pid uint32) {
1063	o.handlersMu.Lock()
1064	defer o.handlersMu.Unlock()
1065	return o.onId
1066}
1067
1068// OnPath registers a handler for the path event.
1069//
1070// Handlers are appended, so a second call adds another handler rather than
1071// replacing the first. Registration is safe while another goroutine dispatches.
1072func (o *Tablet) OnPath(handler func(path string)) {
1073	if handler == nil {
1074		return
1075	}
1076	o.handlersMu.Lock()
1077	defer o.handlersMu.Unlock()
1078	o.onPath = append(o.onPath, handler)
1079}
1080
1081// handlersForPath returns the handlers registered for path, taken
1082// under the lock so a handler may register another handler while events are
1083// being dispatched.
1084func (o *Tablet) handlersForPath() []func(path string) {
1085	o.handlersMu.Lock()
1086	defer o.handlersMu.Unlock()
1087	return o.onPath
1088}
1089
1090// OnDone registers a handler for the done event.
1091//
1092// Handlers are appended, so a second call adds another handler rather than
1093// replacing the first. Registration is safe while another goroutine dispatches.
1094func (o *Tablet) OnDone(handler func()) {
1095	if handler == nil {
1096		return
1097	}
1098	o.handlersMu.Lock()
1099	defer o.handlersMu.Unlock()
1100	o.onDone = append(o.onDone, handler)
1101}
1102
1103// handlersForDone returns the handlers registered for done, taken
1104// under the lock so a handler may register another handler while events are
1105// being dispatched.
1106func (o *Tablet) handlersForDone() []func() {
1107	o.handlersMu.Lock()
1108	defer o.handlersMu.Unlock()
1109	return o.onDone
1110}
1111
1112// OnRemoved registers a handler for the removed event.
1113//
1114// Handlers are appended, so a second call adds another handler rather than
1115// replacing the first. Registration is safe while another goroutine dispatches.
1116func (o *Tablet) OnRemoved(handler func()) {
1117	if handler == nil {
1118		return
1119	}
1120	o.handlersMu.Lock()
1121	defer o.handlersMu.Unlock()
1122	o.onRemoved = append(o.onRemoved, handler)
1123}
1124
1125// handlersForRemoved returns the handlers registered for removed, taken
1126// under the lock so a handler may register another handler while events are
1127// being dispatched.
1128func (o *Tablet) handlersForRemoved() []func() {
1129	o.handlersMu.Lock()
1130	defer o.handlersMu.Unlock()
1131	return o.onRemoved
1132}
1133
1134// OnBustype registers a handler for the bustype event.
1135//
1136// Handlers are appended, so a second call adds another handler rather than
1137// replacing the first. Registration is safe while another goroutine dispatches.
1138func (o *Tablet) OnBustype(handler func(bustype uint32)) {
1139	if handler == nil {
1140		return
1141	}
1142	o.handlersMu.Lock()
1143	defer o.handlersMu.Unlock()
1144	o.onBustype = append(o.onBustype, handler)
1145}
1146
1147// handlersForBustype returns the handlers registered for bustype, taken
1148// under the lock so a handler may register another handler while events are
1149// being dispatched.
1150func (o *Tablet) handlersForBustype() []func(bustype uint32) {
1151	o.handlersMu.Lock()
1152	defer o.handlersMu.Unlock()
1153	return o.onBustype
1154}
1155
1156// EventSignature returns the declared event argument types in wire order.
1157func (o *Tablet) EventSignature(opcode uint16) (string, bool) {
1158	switch opcode {
1159	case 0:
1160		return "string,", true
1161	case 1:
1162		return "uint,uint,", true
1163	case 2:
1164		return "string,", true
1165	case 3:
1166		return "", true
1167	case 4:
1168		return "", true
1169	case 5:
1170		return "uint,", true
1171	default:
1172		return "", false
1173	}
1174}
1175
1176// Dispatch decodes one event on zwp_tablet_v2 and calls the registered handlers.
1177func (o *Tablet) Dispatch(event *wl.Event) {
1178	switch event.Opcode {
1179	case 0: // name
1180		name := event.String()
1181
1182		for i, handler := range o.handlersForName() {
1183			_ = i
1184			handler(name)
1185		}
1186	case 1: // id
1187		vid := event.Uint32()
1188		pid := event.Uint32()
1189
1190		for i, handler := range o.handlersForId() {
1191			_ = i
1192			handler(vid, pid)
1193		}
1194	case 2: // path
1195		path := event.String()
1196
1197		for i, handler := range o.handlersForPath() {
1198			_ = i
1199			handler(path)
1200		}
1201	case 3: // done
1202
1203		for i, handler := range o.handlersForDone() {
1204			_ = i
1205			handler()
1206		}
1207	case 4: // removed
1208
1209		for i, handler := range o.handlersForRemoved() {
1210			_ = i
1211			handler()
1212		}
1213	case 5: // bustype
1214		bustype := event.Uint32()
1215
1216		for i, handler := range o.handlersForBustype() {
1217			_ = i
1218			handler(bustype)
1219		}
1220	default:
1221	}
1222}
1223
1224// TabletPadRingInterface is the protocol interface name.
1225const TabletPadRingInterface = "zwp_tablet_pad_ring_v2"
1226
1227// TabletPadRing is the generated binding for zwp_tablet_pad_ring_v2 version 2.
1228type TabletPadRing struct {
1229	wl.BaseProxy
1230	// handlersMu guards the handler slices: a client may register or replace
1231	// handlers while another goroutine dispatches events.
1232	handlersMu sync.Mutex
1233	onSource   []func(source uint32)
1234	onAngle    []func(degrees wl.Fixed)
1235	onStop     []func()
1236	onFrame    []func(time uint32)
1237}
1238
1239// NewTabletPadRing returns an unbound TabletPadRing.
1240func NewTabletPadRing(ctx *wl.Context) *TabletPadRing {
1241	obj := &TabletPadRing{}
1242	obj.SetContext(ctx)
1243	ctx.Register(obj)
1244	return obj
1245}
1246
1247// Request that the compositor use the provided feedback string associated with this ring. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the ring is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the ring; compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this ring. Requests providing other serials than the most recent one will be ignored.
1248func (o *TabletPadRing) SetFeedback(description string, serial uint32) error {
1249	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_ring_v2.set_feedback"}, wl.ArgString(description), wl.ArgUint(serial)); err != nil {
1250		return err
1251	}
1252	return nil
1253}
1254
1255// This destroys the client's resource for this ring object.
1256func (o *TabletPadRing) Destroy() error {
1257	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_ring_v2.destroy", Destructor: true}); err != nil {
1258		return err
1259	}
1260	return nil
1261}
1262
1263// OnSource registers a handler for the source event.
1264//
1265// Handlers are appended, so a second call adds another handler rather than
1266// replacing the first. Registration is safe while another goroutine dispatches.
1267func (o *TabletPadRing) OnSource(handler func(source uint32)) {
1268	if handler == nil {
1269		return
1270	}
1271	o.handlersMu.Lock()
1272	defer o.handlersMu.Unlock()
1273	o.onSource = append(o.onSource, handler)
1274}
1275
1276// handlersForSource returns the handlers registered for source, taken
1277// under the lock so a handler may register another handler while events are
1278// being dispatched.
1279func (o *TabletPadRing) handlersForSource() []func(source uint32) {
1280	o.handlersMu.Lock()
1281	defer o.handlersMu.Unlock()
1282	return o.onSource
1283}
1284
1285// OnAngle registers a handler for the angle event.
1286//
1287// Handlers are appended, so a second call adds another handler rather than
1288// replacing the first. Registration is safe while another goroutine dispatches.
1289func (o *TabletPadRing) OnAngle(handler func(degrees wl.Fixed)) {
1290	if handler == nil {
1291		return
1292	}
1293	o.handlersMu.Lock()
1294	defer o.handlersMu.Unlock()
1295	o.onAngle = append(o.onAngle, handler)
1296}
1297
1298// handlersForAngle returns the handlers registered for angle, taken
1299// under the lock so a handler may register another handler while events are
1300// being dispatched.
1301func (o *TabletPadRing) handlersForAngle() []func(degrees wl.Fixed) {
1302	o.handlersMu.Lock()
1303	defer o.handlersMu.Unlock()
1304	return o.onAngle
1305}
1306
1307// OnStop registers a handler for the stop event.
1308//
1309// Handlers are appended, so a second call adds another handler rather than
1310// replacing the first. Registration is safe while another goroutine dispatches.
1311func (o *TabletPadRing) OnStop(handler func()) {
1312	if handler == nil {
1313		return
1314	}
1315	o.handlersMu.Lock()
1316	defer o.handlersMu.Unlock()
1317	o.onStop = append(o.onStop, handler)
1318}
1319
1320// handlersForStop returns the handlers registered for stop, taken
1321// under the lock so a handler may register another handler while events are
1322// being dispatched.
1323func (o *TabletPadRing) handlersForStop() []func() {
1324	o.handlersMu.Lock()
1325	defer o.handlersMu.Unlock()
1326	return o.onStop
1327}
1328
1329// OnFrame registers a handler for the frame event.
1330//
1331// Handlers are appended, so a second call adds another handler rather than
1332// replacing the first. Registration is safe while another goroutine dispatches.
1333func (o *TabletPadRing) OnFrame(handler func(time uint32)) {
1334	if handler == nil {
1335		return
1336	}
1337	o.handlersMu.Lock()
1338	defer o.handlersMu.Unlock()
1339	o.onFrame = append(o.onFrame, handler)
1340}
1341
1342// handlersForFrame returns the handlers registered for frame, taken
1343// under the lock so a handler may register another handler while events are
1344// being dispatched.
1345func (o *TabletPadRing) handlersForFrame() []func(time uint32) {
1346	o.handlersMu.Lock()
1347	defer o.handlersMu.Unlock()
1348	return o.onFrame
1349}
1350
1351// EventSignature returns the declared event argument types in wire order.
1352func (o *TabletPadRing) EventSignature(opcode uint16) (string, bool) {
1353	switch opcode {
1354	case 0:
1355		return "uint,", true
1356	case 1:
1357		return "fixed,", true
1358	case 2:
1359		return "", true
1360	case 3:
1361		return "uint,", true
1362	default:
1363		return "", false
1364	}
1365}
1366
1367// Dispatch decodes one event on zwp_tablet_pad_ring_v2 and calls the registered handlers.
1368func (o *TabletPadRing) Dispatch(event *wl.Event) {
1369	switch event.Opcode {
1370	case 0: // source
1371		source := event.Uint32()
1372
1373		for i, handler := range o.handlersForSource() {
1374			_ = i
1375			handler(source)
1376		}
1377	case 1: // angle
1378		degrees := event.Fixed()
1379
1380		for i, handler := range o.handlersForAngle() {
1381			_ = i
1382			handler(degrees)
1383		}
1384	case 2: // stop
1385
1386		for i, handler := range o.handlersForStop() {
1387			_ = i
1388			handler()
1389		}
1390	case 3: // frame
1391		time := event.Uint32()
1392
1393		for i, handler := range o.handlersForFrame() {
1394			_ = i
1395			handler(time)
1396		}
1397	default:
1398	}
1399}
1400
1401// TabletPadStripInterface is the protocol interface name.
1402const TabletPadStripInterface = "zwp_tablet_pad_strip_v2"
1403
1404// TabletPadStrip is the generated binding for zwp_tablet_pad_strip_v2 version 2.
1405type TabletPadStrip struct {
1406	wl.BaseProxy
1407	// handlersMu guards the handler slices: a client may register or replace
1408	// handlers while another goroutine dispatches events.
1409	handlersMu sync.Mutex
1410	onSource   []func(source uint32)
1411	onPosition []func(position uint32)
1412	onStop     []func()
1413	onFrame    []func(time uint32)
1414}
1415
1416// NewTabletPadStrip returns an unbound TabletPadStrip.
1417func NewTabletPadStrip(ctx *wl.Context) *TabletPadStrip {
1418	obj := &TabletPadStrip{}
1419	obj.SetContext(ctx)
1420	ctx.Register(obj)
1421	return obj
1422}
1423
1424// Requests the compositor to use the provided feedback string associated with this strip. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the strip is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the strip, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this strip. Requests providing other serials than the most recent one will be ignored.
1425func (o *TabletPadStrip) SetFeedback(description string, serial uint32) error {
1426	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_strip_v2.set_feedback"}, wl.ArgString(description), wl.ArgUint(serial)); err != nil {
1427		return err
1428	}
1429	return nil
1430}
1431
1432// This destroys the client's resource for this strip object.
1433func (o *TabletPadStrip) Destroy() error {
1434	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_strip_v2.destroy", Destructor: true}); err != nil {
1435		return err
1436	}
1437	return nil
1438}
1439
1440// OnSource registers a handler for the source event.
1441//
1442// Handlers are appended, so a second call adds another handler rather than
1443// replacing the first. Registration is safe while another goroutine dispatches.
1444func (o *TabletPadStrip) OnSource(handler func(source uint32)) {
1445	if handler == nil {
1446		return
1447	}
1448	o.handlersMu.Lock()
1449	defer o.handlersMu.Unlock()
1450	o.onSource = append(o.onSource, handler)
1451}
1452
1453// handlersForSource returns the handlers registered for source, taken
1454// under the lock so a handler may register another handler while events are
1455// being dispatched.
1456func (o *TabletPadStrip) handlersForSource() []func(source uint32) {
1457	o.handlersMu.Lock()
1458	defer o.handlersMu.Unlock()
1459	return o.onSource
1460}
1461
1462// OnPosition registers a handler for the position event.
1463//
1464// Handlers are appended, so a second call adds another handler rather than
1465// replacing the first. Registration is safe while another goroutine dispatches.
1466func (o *TabletPadStrip) OnPosition(handler func(position uint32)) {
1467	if handler == nil {
1468		return
1469	}
1470	o.handlersMu.Lock()
1471	defer o.handlersMu.Unlock()
1472	o.onPosition = append(o.onPosition, handler)
1473}
1474
1475// handlersForPosition returns the handlers registered for position, taken
1476// under the lock so a handler may register another handler while events are
1477// being dispatched.
1478func (o *TabletPadStrip) handlersForPosition() []func(position uint32) {
1479	o.handlersMu.Lock()
1480	defer o.handlersMu.Unlock()
1481	return o.onPosition
1482}
1483
1484// OnStop registers a handler for the stop event.
1485//
1486// Handlers are appended, so a second call adds another handler rather than
1487// replacing the first. Registration is safe while another goroutine dispatches.
1488func (o *TabletPadStrip) OnStop(handler func()) {
1489	if handler == nil {
1490		return
1491	}
1492	o.handlersMu.Lock()
1493	defer o.handlersMu.Unlock()
1494	o.onStop = append(o.onStop, handler)
1495}
1496
1497// handlersForStop returns the handlers registered for stop, taken
1498// under the lock so a handler may register another handler while events are
1499// being dispatched.
1500func (o *TabletPadStrip) handlersForStop() []func() {
1501	o.handlersMu.Lock()
1502	defer o.handlersMu.Unlock()
1503	return o.onStop
1504}
1505
1506// OnFrame registers a handler for the frame event.
1507//
1508// Handlers are appended, so a second call adds another handler rather than
1509// replacing the first. Registration is safe while another goroutine dispatches.
1510func (o *TabletPadStrip) OnFrame(handler func(time uint32)) {
1511	if handler == nil {
1512		return
1513	}
1514	o.handlersMu.Lock()
1515	defer o.handlersMu.Unlock()
1516	o.onFrame = append(o.onFrame, handler)
1517}
1518
1519// handlersForFrame returns the handlers registered for frame, taken
1520// under the lock so a handler may register another handler while events are
1521// being dispatched.
1522func (o *TabletPadStrip) handlersForFrame() []func(time uint32) {
1523	o.handlersMu.Lock()
1524	defer o.handlersMu.Unlock()
1525	return o.onFrame
1526}
1527
1528// EventSignature returns the declared event argument types in wire order.
1529func (o *TabletPadStrip) EventSignature(opcode uint16) (string, bool) {
1530	switch opcode {
1531	case 0:
1532		return "uint,", true
1533	case 1:
1534		return "uint,", true
1535	case 2:
1536		return "", true
1537	case 3:
1538		return "uint,", true
1539	default:
1540		return "", false
1541	}
1542}
1543
1544// Dispatch decodes one event on zwp_tablet_pad_strip_v2 and calls the registered handlers.
1545func (o *TabletPadStrip) Dispatch(event *wl.Event) {
1546	switch event.Opcode {
1547	case 0: // source
1548		source := event.Uint32()
1549
1550		for i, handler := range o.handlersForSource() {
1551			_ = i
1552			handler(source)
1553		}
1554	case 1: // position
1555		position := event.Uint32()
1556
1557		for i, handler := range o.handlersForPosition() {
1558			_ = i
1559			handler(position)
1560		}
1561	case 2: // stop
1562
1563		for i, handler := range o.handlersForStop() {
1564			_ = i
1565			handler()
1566		}
1567	case 3: // frame
1568		time := event.Uint32()
1569
1570		for i, handler := range o.handlersForFrame() {
1571			_ = i
1572			handler(time)
1573		}
1574	default:
1575	}
1576}
1577
1578// TabletPadGroupInterface is the protocol interface name.
1579const TabletPadGroupInterface = "zwp_tablet_pad_group_v2"
1580
1581// TabletPadGroup is the generated binding for zwp_tablet_pad_group_v2 version 2.
1582type TabletPadGroup struct {
1583	wl.BaseProxy
1584	// handlersMu guards the handler slices: a client may register or replace
1585	// handlers while another goroutine dispatches events.
1586	handlersMu   sync.Mutex
1587	onButtons    []func(buttons []byte)
1588	onRing       []func(ringObject *TabletPadRing)
1589	onStrip      []func(stripObject *TabletPadStrip)
1590	onModes      []func(modes uint32)
1591	onDone       []func()
1592	onModeSwitch []func(time uint32, serial uint32, mode uint32)
1593	onDial       []func(dialObject *TabletPadDial)
1594}
1595
1596// NewTabletPadGroup returns an unbound TabletPadGroup.
1597func NewTabletPadGroup(ctx *wl.Context) *TabletPadGroup {
1598	obj := &TabletPadGroup{}
1599	obj.SetContext(ctx)
1600	ctx.Register(obj)
1601	return obj
1602}
1603
1604// Destroy the zwp_tablet_pad_group_v2 object. Objects created from this object are unaffected and should be destroyed separately.
1605func (o *TabletPadGroup) Destroy() error {
1606	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_group_v2.destroy", Destructor: true}); err != nil {
1607		return err
1608	}
1609	return nil
1610}
1611
1612// OnButtons registers a handler for the buttons event.
1613//
1614// Handlers are appended, so a second call adds another handler rather than
1615// replacing the first. Registration is safe while another goroutine dispatches.
1616func (o *TabletPadGroup) OnButtons(handler func(buttons []byte)) {
1617	if handler == nil {
1618		return
1619	}
1620	o.handlersMu.Lock()
1621	defer o.handlersMu.Unlock()
1622	o.onButtons = append(o.onButtons, handler)
1623}
1624
1625// handlersForButtons returns the handlers registered for buttons, taken
1626// under the lock so a handler may register another handler while events are
1627// being dispatched.
1628func (o *TabletPadGroup) handlersForButtons() []func(buttons []byte) {
1629	o.handlersMu.Lock()
1630	defer o.handlersMu.Unlock()
1631	return o.onButtons
1632}
1633
1634// OnRing registers a handler for the ring event.
1635//
1636// Handlers are appended, so a second call adds another handler rather than
1637// replacing the first. Registration is safe while another goroutine dispatches.
1638func (o *TabletPadGroup) OnRing(handler func(ringObject *TabletPadRing)) {
1639	if handler == nil {
1640		return
1641	}
1642	o.handlersMu.Lock()
1643	defer o.handlersMu.Unlock()
1644	o.onRing = append(o.onRing, handler)
1645}
1646
1647// handlersForRing returns the handlers registered for ring, taken
1648// under the lock so a handler may register another handler while events are
1649// being dispatched.
1650func (o *TabletPadGroup) handlersForRing() []func(ringObject *TabletPadRing) {
1651	o.handlersMu.Lock()
1652	defer o.handlersMu.Unlock()
1653	return o.onRing
1654}
1655
1656// OnStrip registers a handler for the strip event.
1657//
1658// Handlers are appended, so a second call adds another handler rather than
1659// replacing the first. Registration is safe while another goroutine dispatches.
1660func (o *TabletPadGroup) OnStrip(handler func(stripObject *TabletPadStrip)) {
1661	if handler == nil {
1662		return
1663	}
1664	o.handlersMu.Lock()
1665	defer o.handlersMu.Unlock()
1666	o.onStrip = append(o.onStrip, handler)
1667}
1668
1669// handlersForStrip returns the handlers registered for strip, taken
1670// under the lock so a handler may register another handler while events are
1671// being dispatched.
1672func (o *TabletPadGroup) handlersForStrip() []func(stripObject *TabletPadStrip) {
1673	o.handlersMu.Lock()
1674	defer o.handlersMu.Unlock()
1675	return o.onStrip
1676}
1677
1678// OnModes registers a handler for the modes event.
1679//
1680// Handlers are appended, so a second call adds another handler rather than
1681// replacing the first. Registration is safe while another goroutine dispatches.
1682func (o *TabletPadGroup) OnModes(handler func(modes uint32)) {
1683	if handler == nil {
1684		return
1685	}
1686	o.handlersMu.Lock()
1687	defer o.handlersMu.Unlock()
1688	o.onModes = append(o.onModes, handler)
1689}
1690
1691// handlersForModes returns the handlers registered for modes, taken
1692// under the lock so a handler may register another handler while events are
1693// being dispatched.
1694func (o *TabletPadGroup) handlersForModes() []func(modes uint32) {
1695	o.handlersMu.Lock()
1696	defer o.handlersMu.Unlock()
1697	return o.onModes
1698}
1699
1700// OnDone registers a handler for the done event.
1701//
1702// Handlers are appended, so a second call adds another handler rather than
1703// replacing the first. Registration is safe while another goroutine dispatches.
1704func (o *TabletPadGroup) OnDone(handler func()) {
1705	if handler == nil {
1706		return
1707	}
1708	o.handlersMu.Lock()
1709	defer o.handlersMu.Unlock()
1710	o.onDone = append(o.onDone, handler)
1711}
1712
1713// handlersForDone returns the handlers registered for done, taken
1714// under the lock so a handler may register another handler while events are
1715// being dispatched.
1716func (o *TabletPadGroup) handlersForDone() []func() {
1717	o.handlersMu.Lock()
1718	defer o.handlersMu.Unlock()
1719	return o.onDone
1720}
1721
1722// OnModeSwitch registers a handler for the mode_switch event.
1723//
1724// Handlers are appended, so a second call adds another handler rather than
1725// replacing the first. Registration is safe while another goroutine dispatches.
1726func (o *TabletPadGroup) OnModeSwitch(handler func(time uint32, serial uint32, mode uint32)) {
1727	if handler == nil {
1728		return
1729	}
1730	o.handlersMu.Lock()
1731	defer o.handlersMu.Unlock()
1732	o.onModeSwitch = append(o.onModeSwitch, handler)
1733}
1734
1735// handlersForModeSwitch returns the handlers registered for mode_switch, taken
1736// under the lock so a handler may register another handler while events are
1737// being dispatched.
1738func (o *TabletPadGroup) handlersForModeSwitch() []func(time uint32, serial uint32, mode uint32) {
1739	o.handlersMu.Lock()
1740	defer o.handlersMu.Unlock()
1741	return o.onModeSwitch
1742}
1743
1744// OnDial registers a handler for the dial event.
1745//
1746// Handlers are appended, so a second call adds another handler rather than
1747// replacing the first. Registration is safe while another goroutine dispatches.
1748func (o *TabletPadGroup) OnDial(handler func(dialObject *TabletPadDial)) {
1749	if handler == nil {
1750		return
1751	}
1752	o.handlersMu.Lock()
1753	defer o.handlersMu.Unlock()
1754	o.onDial = append(o.onDial, handler)
1755}
1756
1757// handlersForDial returns the handlers registered for dial, taken
1758// under the lock so a handler may register another handler while events are
1759// being dispatched.
1760func (o *TabletPadGroup) handlersForDial() []func(dialObject *TabletPadDial) {
1761	o.handlersMu.Lock()
1762	defer o.handlersMu.Unlock()
1763	return o.onDial
1764}
1765
1766// EventSignature returns the declared event argument types in wire order.
1767func (o *TabletPadGroup) EventSignature(opcode uint16) (string, bool) {
1768	switch opcode {
1769	case 0:
1770		return "array,", true
1771	case 1:
1772		return "new_id,", true
1773	case 2:
1774		return "new_id,", true
1775	case 3:
1776		return "uint,", true
1777	case 4:
1778		return "", true
1779	case 5:
1780		return "uint,uint,uint,", true
1781	case 6:
1782		return "new_id,", true
1783	default:
1784		return "", false
1785	}
1786}
1787
1788// Dispatch decodes one event on zwp_tablet_pad_group_v2 and calls the registered handlers.
1789func (o *TabletPadGroup) Dispatch(event *wl.Event) {
1790	switch event.Opcode {
1791	case 0: // buttons
1792		buttons := event.Array()
1793
1794		for i, handler := range o.handlersForButtons() {
1795			_ = i
1796			handler(buttons)
1797		}
1798	case 1: // ring
1799		ringID := event.Uint32()
1800		ringObject := &TabletPadRing{}
1801		ringObject.SetContext(o.Context())
1802		ringObject.SetID(ringID)
1803		ringObject.SetVersion(o.Version())
1804		o.Context().Register(ringObject)
1805
1806		for i, handler := range o.handlersForRing() {
1807			_ = i
1808			handler(ringObject)
1809		}
1810	case 2: // strip
1811		stripID := event.Uint32()
1812		stripObject := &TabletPadStrip{}
1813		stripObject.SetContext(o.Context())
1814		stripObject.SetID(stripID)
1815		stripObject.SetVersion(o.Version())
1816		o.Context().Register(stripObject)
1817
1818		for i, handler := range o.handlersForStrip() {
1819			_ = i
1820			handler(stripObject)
1821		}
1822	case 3: // modes
1823		modes := event.Uint32()
1824
1825		for i, handler := range o.handlersForModes() {
1826			_ = i
1827			handler(modes)
1828		}
1829	case 4: // done
1830
1831		for i, handler := range o.handlersForDone() {
1832			_ = i
1833			handler()
1834		}
1835	case 5: // mode_switch
1836		time := event.Uint32()
1837		serial := event.Uint32()
1838		mode := event.Uint32()
1839
1840		for i, handler := range o.handlersForModeSwitch() {
1841			_ = i
1842			handler(time, serial, mode)
1843		}
1844	case 6: // dial
1845		dialID := event.Uint32()
1846		dialObject := &TabletPadDial{}
1847		dialObject.SetContext(o.Context())
1848		dialObject.SetID(dialID)
1849		dialObject.SetVersion(o.Version())
1850		o.Context().Register(dialObject)
1851
1852		for i, handler := range o.handlersForDial() {
1853			_ = i
1854			handler(dialObject)
1855		}
1856	default:
1857	}
1858}
1859
1860// TabletPadInterface is the protocol interface name.
1861const TabletPadInterface = "zwp_tablet_pad_v2"
1862
1863// TabletPad is the generated binding for zwp_tablet_pad_v2 version 2.
1864type TabletPad struct {
1865	wl.BaseProxy
1866	// handlersMu guards the handler slices: a client may register or replace
1867	// handlers while another goroutine dispatches events.
1868	handlersMu sync.Mutex
1869	onGroup    []func(padGroupObject *TabletPadGroup)
1870	onPath     []func(path string)
1871	onButtons  []func(buttons uint32)
1872	onDone     []func()
1873	onButton   []func(time uint32, button uint32, state uint32)
1874	onEnter    []func(serial uint32, tabletID uint32, surfaceID uint32)
1875	onLeave    []func(serial uint32, surfaceID uint32)
1876	onRemoved  []func()
1877}
1878
1879// NewTabletPad returns an unbound TabletPad.
1880func NewTabletPad(ctx *wl.Context) *TabletPad {
1881	obj := &TabletPad{}
1882	obj.SetContext(ctx)
1883	ctx.Register(obj)
1884	return obj
1885}
1886
1887// Requests the compositor to use the provided feedback string associated with this button. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever a button is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with each button, and compositors may use this information to offer visual feedback on the button layout (e.g. on-screen displays). Button indices start at 0. Setting the feedback string on a button that is reserved by the compositor (i.e. not belonging to any zwp_tablet_pad_group_v2) does not generate an error but the compositor is free to ignore the request. The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this button. Requests providing other serials than the most recent one will be ignored.
1888func (o *TabletPad) SetFeedback(button uint32, description string, serial uint32) error {
1889	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_v2.set_feedback"}, wl.ArgUint(button), wl.ArgString(description), wl.ArgUint(serial)); err != nil {
1890		return err
1891	}
1892	return nil
1893}
1894
1895// Destroy the zwp_tablet_pad_v2 object. Objects created from this object are unaffected and should be destroyed separately.
1896func (o *TabletPad) Destroy() error {
1897	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_v2.destroy", Destructor: true}); err != nil {
1898		return err
1899	}
1900	return nil
1901}
1902
1903// OnGroup registers a handler for the group event.
1904//
1905// Handlers are appended, so a second call adds another handler rather than
1906// replacing the first. Registration is safe while another goroutine dispatches.
1907func (o *TabletPad) OnGroup(handler func(padGroupObject *TabletPadGroup)) {
1908	if handler == nil {
1909		return
1910	}
1911	o.handlersMu.Lock()
1912	defer o.handlersMu.Unlock()
1913	o.onGroup = append(o.onGroup, handler)
1914}
1915
1916// handlersForGroup returns the handlers registered for group, taken
1917// under the lock so a handler may register another handler while events are
1918// being dispatched.
1919func (o *TabletPad) handlersForGroup() []func(padGroupObject *TabletPadGroup) {
1920	o.handlersMu.Lock()
1921	defer o.handlersMu.Unlock()
1922	return o.onGroup
1923}
1924
1925// OnPath registers a handler for the path event.
1926//
1927// Handlers are appended, so a second call adds another handler rather than
1928// replacing the first. Registration is safe while another goroutine dispatches.
1929func (o *TabletPad) OnPath(handler func(path string)) {
1930	if handler == nil {
1931		return
1932	}
1933	o.handlersMu.Lock()
1934	defer o.handlersMu.Unlock()
1935	o.onPath = append(o.onPath, handler)
1936}
1937
1938// handlersForPath returns the handlers registered for path, taken
1939// under the lock so a handler may register another handler while events are
1940// being dispatched.
1941func (o *TabletPad) handlersForPath() []func(path string) {
1942	o.handlersMu.Lock()
1943	defer o.handlersMu.Unlock()
1944	return o.onPath
1945}
1946
1947// OnButtons registers a handler for the buttons event.
1948//
1949// Handlers are appended, so a second call adds another handler rather than
1950// replacing the first. Registration is safe while another goroutine dispatches.
1951func (o *TabletPad) OnButtons(handler func(buttons uint32)) {
1952	if handler == nil {
1953		return
1954	}
1955	o.handlersMu.Lock()
1956	defer o.handlersMu.Unlock()
1957	o.onButtons = append(o.onButtons, handler)
1958}
1959
1960// handlersForButtons returns the handlers registered for buttons, taken
1961// under the lock so a handler may register another handler while events are
1962// being dispatched.
1963func (o *TabletPad) handlersForButtons() []func(buttons uint32) {
1964	o.handlersMu.Lock()
1965	defer o.handlersMu.Unlock()
1966	return o.onButtons
1967}
1968
1969// OnDone registers a handler for the done event.
1970//
1971// Handlers are appended, so a second call adds another handler rather than
1972// replacing the first. Registration is safe while another goroutine dispatches.
1973func (o *TabletPad) OnDone(handler func()) {
1974	if handler == nil {
1975		return
1976	}
1977	o.handlersMu.Lock()
1978	defer o.handlersMu.Unlock()
1979	o.onDone = append(o.onDone, handler)
1980}
1981
1982// handlersForDone returns the handlers registered for done, taken
1983// under the lock so a handler may register another handler while events are
1984// being dispatched.
1985func (o *TabletPad) handlersForDone() []func() {
1986	o.handlersMu.Lock()
1987	defer o.handlersMu.Unlock()
1988	return o.onDone
1989}
1990
1991// OnButton registers a handler for the button event.
1992//
1993// Handlers are appended, so a second call adds another handler rather than
1994// replacing the first. Registration is safe while another goroutine dispatches.
1995func (o *TabletPad) OnButton(handler func(time uint32, button uint32, state uint32)) {
1996	if handler == nil {
1997		return
1998	}
1999	o.handlersMu.Lock()
2000	defer o.handlersMu.Unlock()
2001	o.onButton = append(o.onButton, handler)
2002}
2003
2004// handlersForButton returns the handlers registered for button, taken
2005// under the lock so a handler may register another handler while events are
2006// being dispatched.
2007func (o *TabletPad) handlersForButton() []func(time uint32, button uint32, state uint32) {
2008	o.handlersMu.Lock()
2009	defer o.handlersMu.Unlock()
2010	return o.onButton
2011}
2012
2013// OnEnter registers a handler for the enter event.
2014//
2015// Handlers are appended, so a second call adds another handler rather than
2016// replacing the first. Registration is safe while another goroutine dispatches.
2017func (o *TabletPad) OnEnter(handler func(serial uint32, tabletID uint32, surfaceID uint32)) {
2018	if handler == nil {
2019		return
2020	}
2021	o.handlersMu.Lock()
2022	defer o.handlersMu.Unlock()
2023	o.onEnter = append(o.onEnter, handler)
2024}
2025
2026// handlersForEnter returns the handlers registered for enter, taken
2027// under the lock so a handler may register another handler while events are
2028// being dispatched.
2029func (o *TabletPad) handlersForEnter() []func(serial uint32, tabletID uint32, surfaceID uint32) {
2030	o.handlersMu.Lock()
2031	defer o.handlersMu.Unlock()
2032	return o.onEnter
2033}
2034
2035// OnLeave registers a handler for the leave event.
2036//
2037// Handlers are appended, so a second call adds another handler rather than
2038// replacing the first. Registration is safe while another goroutine dispatches.
2039func (o *TabletPad) OnLeave(handler func(serial uint32, surfaceID uint32)) {
2040	if handler == nil {
2041		return
2042	}
2043	o.handlersMu.Lock()
2044	defer o.handlersMu.Unlock()
2045	o.onLeave = append(o.onLeave, handler)
2046}
2047
2048// handlersForLeave returns the handlers registered for leave, taken
2049// under the lock so a handler may register another handler while events are
2050// being dispatched.
2051func (o *TabletPad) handlersForLeave() []func(serial uint32, surfaceID uint32) {
2052	o.handlersMu.Lock()
2053	defer o.handlersMu.Unlock()
2054	return o.onLeave
2055}
2056
2057// OnRemoved registers a handler for the removed event.
2058//
2059// Handlers are appended, so a second call adds another handler rather than
2060// replacing the first. Registration is safe while another goroutine dispatches.
2061func (o *TabletPad) OnRemoved(handler func()) {
2062	if handler == nil {
2063		return
2064	}
2065	o.handlersMu.Lock()
2066	defer o.handlersMu.Unlock()
2067	o.onRemoved = append(o.onRemoved, handler)
2068}
2069
2070// handlersForRemoved returns the handlers registered for removed, taken
2071// under the lock so a handler may register another handler while events are
2072// being dispatched.
2073func (o *TabletPad) handlersForRemoved() []func() {
2074	o.handlersMu.Lock()
2075	defer o.handlersMu.Unlock()
2076	return o.onRemoved
2077}
2078
2079// EventSignature returns the declared event argument types in wire order.
2080func (o *TabletPad) EventSignature(opcode uint16) (string, bool) {
2081	switch opcode {
2082	case 0:
2083		return "new_id,", true
2084	case 1:
2085		return "string,", true
2086	case 2:
2087		return "uint,", true
2088	case 3:
2089		return "", true
2090	case 4:
2091		return "uint,uint,uint,", true
2092	case 5:
2093		return "uint,object,object,", true
2094	case 6:
2095		return "uint,object,", true
2096	case 7:
2097		return "", true
2098	default:
2099		return "", false
2100	}
2101}
2102
2103// Dispatch decodes one event on zwp_tablet_pad_v2 and calls the registered handlers.
2104func (o *TabletPad) Dispatch(event *wl.Event) {
2105	switch event.Opcode {
2106	case 0: // group
2107		padGroupID := event.Uint32()
2108		padGroupObject := &TabletPadGroup{}
2109		padGroupObject.SetContext(o.Context())
2110		padGroupObject.SetID(padGroupID)
2111		padGroupObject.SetVersion(o.Version())
2112		o.Context().Register(padGroupObject)
2113
2114		for i, handler := range o.handlersForGroup() {
2115			_ = i
2116			handler(padGroupObject)
2117		}
2118	case 1: // path
2119		path := event.String()
2120
2121		for i, handler := range o.handlersForPath() {
2122			_ = i
2123			handler(path)
2124		}
2125	case 2: // buttons
2126		buttons := event.Uint32()
2127
2128		for i, handler := range o.handlersForButtons() {
2129			_ = i
2130			handler(buttons)
2131		}
2132	case 3: // done
2133
2134		for i, handler := range o.handlersForDone() {
2135			_ = i
2136			handler()
2137		}
2138	case 4: // button
2139		time := event.Uint32()
2140		button := event.Uint32()
2141		state := event.Uint32()
2142
2143		for i, handler := range o.handlersForButton() {
2144			_ = i
2145			handler(time, button, state)
2146		}
2147	case 5: // enter
2148		serial := event.Uint32()
2149		tabletID := event.Uint32()
2150		surfaceID := event.Uint32()
2151
2152		for i, handler := range o.handlersForEnter() {
2153			_ = i
2154			handler(serial, tabletID, surfaceID)
2155		}
2156	case 6: // leave
2157		serial := event.Uint32()
2158		surfaceID := event.Uint32()
2159
2160		for i, handler := range o.handlersForLeave() {
2161			_ = i
2162			handler(serial, surfaceID)
2163		}
2164	case 7: // removed
2165
2166		for i, handler := range o.handlersForRemoved() {
2167			_ = i
2168			handler()
2169		}
2170	default:
2171	}
2172}
2173
2174// TabletPadDialInterface is the protocol interface name.
2175const TabletPadDialInterface = "zwp_tablet_pad_dial_v2"
2176
2177// TabletPadDial is the generated binding for zwp_tablet_pad_dial_v2 version 2.
2178type TabletPadDial struct {
2179	wl.BaseProxy
2180	// handlersMu guards the handler slices: a client may register or replace
2181	// handlers while another goroutine dispatches events.
2182	handlersMu sync.Mutex
2183	onDelta    []func(value120 int32)
2184	onFrame    []func(time uint32)
2185}
2186
2187// NewTabletPadDial returns an unbound TabletPadDial.
2188func NewTabletPadDial(ctx *wl.Context) *TabletPadDial {
2189	obj := &TabletPadDial{}
2190	obj.SetContext(ctx)
2191	ctx.Register(obj)
2192	return obj
2193}
2194
2195// Requests the compositor to use the provided feedback string associated with this dial. This request should be issued immediately after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding group is received, or whenever the dial is mapped to a different action. See zwp_tablet_pad_group_v2.mode_switch for more details. Clients are encouraged to provide context-aware descriptions for the actions associated with the dial, and compositors may use this information to offer visual feedback about the button layout (eg. on-screen displays). The provided string 'description' is a UTF-8 encoded string to be associated with this ring, and is considered user-visible; general internationalization rules apply. The serial argument will be that of the last zwp_tablet_pad_group_v2.mode_switch event received for the group of this dial. Requests providing other serials than the most recent one will be ignored.
2196func (o *TabletPadDial) SetFeedback(description string, serial uint32) error {
2197	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_tablet_pad_dial_v2.set_feedback"}, wl.ArgString(description), wl.ArgUint(serial)); err != nil {
2198		return err
2199	}
2200	return nil
2201}
2202
2203// This destroys the client's resource for this dial object.
2204func (o *TabletPadDial) Destroy() error {
2205	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_tablet_pad_dial_v2.destroy", Destructor: true}); err != nil {
2206		return err
2207	}
2208	return nil
2209}
2210
2211// OnDelta registers a handler for the delta event.
2212//
2213// Handlers are appended, so a second call adds another handler rather than
2214// replacing the first. Registration is safe while another goroutine dispatches.
2215func (o *TabletPadDial) OnDelta(handler func(value120 int32)) {
2216	if handler == nil {
2217		return
2218	}
2219	o.handlersMu.Lock()
2220	defer o.handlersMu.Unlock()
2221	o.onDelta = append(o.onDelta, handler)
2222}
2223
2224// handlersForDelta returns the handlers registered for delta, taken
2225// under the lock so a handler may register another handler while events are
2226// being dispatched.
2227func (o *TabletPadDial) handlersForDelta() []func(value120 int32) {
2228	o.handlersMu.Lock()
2229	defer o.handlersMu.Unlock()
2230	return o.onDelta
2231}
2232
2233// OnFrame registers a handler for the frame event.
2234//
2235// Handlers are appended, so a second call adds another handler rather than
2236// replacing the first. Registration is safe while another goroutine dispatches.
2237func (o *TabletPadDial) OnFrame(handler func(time uint32)) {
2238	if handler == nil {
2239		return
2240	}
2241	o.handlersMu.Lock()
2242	defer o.handlersMu.Unlock()
2243	o.onFrame = append(o.onFrame, handler)
2244}
2245
2246// handlersForFrame returns the handlers registered for frame, taken
2247// under the lock so a handler may register another handler while events are
2248// being dispatched.
2249func (o *TabletPadDial) handlersForFrame() []func(time uint32) {
2250	o.handlersMu.Lock()
2251	defer o.handlersMu.Unlock()
2252	return o.onFrame
2253}
2254
2255// EventSignature returns the declared event argument types in wire order.
2256func (o *TabletPadDial) EventSignature(opcode uint16) (string, bool) {
2257	switch opcode {
2258	case 0:
2259		return "int,", true
2260	case 1:
2261		return "uint,", true
2262	default:
2263		return "", false
2264	}
2265}
2266
2267// Dispatch decodes one event on zwp_tablet_pad_dial_v2 and calls the registered handlers.
2268func (o *TabletPadDial) Dispatch(event *wl.Event) {
2269	switch event.Opcode {
2270	case 0: // delta
2271		value120 := event.Int32()
2272
2273		for i, handler := range o.handlersForDelta() {
2274			_ = i
2275			handler(value120)
2276		}
2277	case 1: // frame
2278		time := event.Uint32()
2279
2280		for i, handler := range o.handlersForFrame() {
2281			_ = i
2282			handler(time)
2283		}
2284	default:
2285	}
2286}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 1

↑↓ moveenter openesc close