v0.3.0 96f3aeb

tablet-v2_generated.go RawHistoryFolder

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

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 8

↑↓ moveenter openesc close