detached a2cb70a

Merge branch 'feat/cursor-shape': generate cursor-shape-v1 and tablet-v2

commit
a2cb70a5513a0913e8cd8f206178f28459d4b197
author
brice · · 2026-09-29 15:16 UTC
merge of
c910d98 + 9585e4b · diff against the first parent
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
7 files · +4047 -1
M protocol/SOURCE.md +5 -0
@@ -21,3 +21,8 @@ SHA-256 (of the vendored XML bytes):
2121 | `stable/viewporter/viewporter.xml` | `viewporter/viewporter.xml` | `dcb12279a03746301fe490aaed4b38a403485a925abfce2ccfceb644e104fe71` |
2222 | `staging/fractional-scale/fractional-scale-v1.xml` | `fractionalscale/fractional-scale-v1.xml` | `5941de5d28f427ecdadddc8623a6f6af0a30b0ab4726847236ba7a7652b81316` |
2323 | `unstable/text-input/text-input-unstable-v3.xml` | `textinput/text-input-unstable-v3.xml` | `160815cda13c285a30df1971d8f0a5b3aac07071537df59916d2f748b18e4f59` |
24+| `staging/cursor-shape/cursor-shape-v1.xml` | `cursorshape/cursor-shape-v1.xml` | `bb57d91e53a79dadab7c612dab87c233393cee73673feefa7442cfbfdd9aed2f` |
25+| `stable/tablet/tablet-v2.xml` | `tablet/tablet-v2.xml` | `ac1128b26c779cf90b9ed71182ba5e34a7262826789adae206d825a4d45908b4` |
26+
27+`tablet-v2.xml` is vendored because `wp_cursor_shape_manager_v1.get_tablet_tool_v2`
28+references `zwp_tablet_tool_v2`.
A protocol/cursorshape/cursor-shape-v1.xml +162 -0
@@ -0,0 +1,162 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<protocol name="cursor_shape_v1">
3+ <copyright>
4+ Copyright 2018 The Chromium Authors
5+ Copyright 2023 Simon Ser
6+
7+ Permission is hereby granted, free of charge, to any person obtaining a
8+ copy of this software and associated documentation files (the "Software"),
9+ to deal in the Software without restriction, including without limitation
10+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
11+ and/or sell copies of the Software, and to permit persons to whom the
12+ Software is furnished to do so, subject to the following conditions:
13+ The above copyright notice and this permission notice (including the next
14+ paragraph) shall be included in all copies or substantial portions of the
15+ Software.
16+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22+ DEALINGS IN THE SOFTWARE.
23+ </copyright>
24+
25+ <interface name="wp_cursor_shape_manager_v1" version="2">
26+ <description summary="cursor shape manager">
27+ This global offers an alternative, optional way to set cursor images. This
28+ new way uses enumerated cursors instead of a wl_surface like
29+ wl_pointer.set_cursor does.
30+
31+ Warning! The protocol described in this file is currently in the testing
32+ phase. Backward compatible changes may be added together with the
33+ corresponding interface version bump. Backward incompatible changes can
34+ only be done by creating a new major version of the extension.
35+ </description>
36+
37+ <request name="destroy" type="destructor">
38+ <description summary="destroy the manager">
39+ Destroy the cursor shape manager.
40+ </description>
41+ </request>
42+
43+ <request name="get_pointer">
44+ <description summary="manage the cursor shape of a pointer device">
45+ Obtain a wp_cursor_shape_device_v1 for a wl_pointer object.
46+
47+ When the pointer capability is removed from the wl_seat, the
48+ wp_cursor_shape_device_v1 object becomes inert.
49+ </description>
50+ <arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
51+ <arg name="pointer" type="object" interface="wl_pointer"/>
52+ </request>
53+
54+ <request name="get_tablet_tool_v2">
55+ <description summary="manage the cursor shape of a tablet tool device">
56+ Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object.
57+
58+ When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1
59+ object becomes inert.
60+ </description>
61+ <arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
62+ <arg name="tablet_tool" type="object" interface="zwp_tablet_tool_v2"/>
63+ </request>
64+ </interface>
65+
66+ <interface name="wp_cursor_shape_device_v1" version="2">
67+ <description summary="cursor shape for a device">
68+ This interface allows clients to set the cursor shape.
69+ </description>
70+
71+ <enum name="shape">
72+ <description summary="cursor shapes">
73+ This enum describes cursor shapes.
74+
75+ The names are taken from the CSS W3C specification:
76+ https://w3c.github.io/csswg-drafts/css-ui/#cursor
77+ with a few additions.
78+
79+ Note that there are some groups of cursor shapes that are related:
80+ The first group is drag-and-drop cursors which are used to indicate
81+ the selected action during dnd operations. The second group is resize
82+ cursors which are used to indicate resizing and moving possibilities
83+ on window borders. It is recommended that the shapes in these groups
84+ should use visually compatible images and metaphors.
85+ </description>
86+ <entry name="default" value="1" summary="default cursor"/>
87+ <entry name="context_menu" value="2" summary="a context menu is available for the object under the cursor"/>
88+ <entry name="help" value="3" summary="help is available for the object under the cursor"/>
89+ <entry name="pointer" value="4" summary="pointer that indicates a link or another interactive element"/>
90+ <entry name="progress" value="5" summary="progress indicator"/>
91+ <entry name="wait" value="6" summary="program is busy, user should wait"/>
92+ <entry name="cell" value="7" summary="a cell or set of cells may be selected"/>
93+ <entry name="crosshair" value="8" summary="simple crosshair"/>
94+ <entry name="text" value="9" summary="text may be selected"/>
95+ <entry name="vertical_text" value="10" summary="vertical text may be selected"/>
96+ <entry name="alias" value="11" summary="drag-and-drop: alias of/shortcut to something is to be created"/>
97+ <entry name="copy" value="12" summary="drag-and-drop: something is to be copied"/>
98+ <entry name="move" value="13" summary="drag-and-drop: something is to be moved"/>
99+ <entry name="no_drop" value="14" summary="drag-and-drop: the dragged item cannot be dropped at the current cursor location"/>
100+ <entry name="not_allowed" value="15" summary="drag-and-drop: the requested action will not be carried out"/>
101+ <entry name="grab" value="16" summary="drag-and-drop: something can be grabbed"/>
102+ <entry name="grabbing" value="17" summary="drag-and-drop: something is being grabbed"/>
103+ <entry name="e_resize" value="18" summary="resizing: the east border is to be moved"/>
104+ <entry name="n_resize" value="19" summary="resizing: the north border is to be moved"/>
105+ <entry name="ne_resize" value="20" summary="resizing: the north-east corner is to be moved"/>
106+ <entry name="nw_resize" value="21" summary="resizing: the north-west corner is to be moved"/>
107+ <entry name="s_resize" value="22" summary="resizing: the south border is to be moved"/>
108+ <entry name="se_resize" value="23" summary="resizing: the south-east corner is to be moved"/>
109+ <entry name="sw_resize" value="24" summary="resizing: the south-west corner is to be moved"/>
110+ <entry name="w_resize" value="25" summary="resizing: the west border is to be moved"/>
111+ <entry name="ew_resize" value="26" summary="resizing: the east and west borders are to be moved"/>
112+ <entry name="ns_resize" value="27" summary="resizing: the north and south borders are to be moved"/>
113+ <entry name="nesw_resize" value="28" summary="resizing: the north-east and south-west corners are to be moved"/>
114+ <entry name="nwse_resize" value="29" summary="resizing: the north-west and south-east corners are to be moved"/>
115+ <entry name="col_resize" value="30" summary="resizing: that the item/column can be resized horizontally"/>
116+ <entry name="row_resize" value="31" summary="resizing: that the item/row can be resized vertically"/>
117+ <entry name="all_scroll" value="32" summary="something can be scrolled in any direction"/>
118+ <entry name="zoom_in" value="33" summary="something can be zoomed in"/>
119+ <entry name="zoom_out" value="34" summary="something can be zoomed out"/>
120+ <entry name="dnd_ask" value="35" summary="drag-and-drop: the user will select which action will be carried out (non-css value)" since="2"/>
121+ <entry name="all_resize" value="36" summary="resizing: something can be moved or resized in any direction (non-css value)" since="2"/>
122+ </enum>
123+
124+ <enum name="error">
125+ <entry name="invalid_shape" value="1"
126+ summary="the specified shape value is invalid"/>
127+ </enum>
128+
129+ <request name="destroy" type="destructor">
130+ <description summary="destroy the cursor shape device">
131+ Destroy the cursor shape device.
132+
133+ The device cursor shape remains unchanged.
134+ </description>
135+ </request>
136+
137+ <request name="set_shape">
138+ <description summary="set device cursor to the shape">
139+ Sets the device cursor to the specified shape. The compositor will
140+ change the cursor image based on the specified shape.
141+
142+ The cursor actually changes only if the input device focus is one of
143+ the requesting client's surfaces. If any, the previous cursor image
144+ (surface or shape) is replaced.
145+
146+ The "shape" argument must be a valid enum entry, otherwise the
147+ invalid_shape protocol error is raised.
148+
149+ This is similar to the wl_pointer.set_cursor and
150+ zwp_tablet_tool_v2.set_cursor requests, but this request accepts a
151+ shape instead of contents in the form of a surface. Clients can mix
152+ set_cursor and set_shape requests.
153+
154+ The serial parameter must match the latest wl_pointer.enter or
155+ zwp_tablet_tool_v2.proximity_in serial number sent to the client.
156+ Otherwise the request will be ignored.
157+ </description>
158+ <arg name="serial" type="uint" summary="serial number of the enter event"/>
159+ <arg name="shape" type="uint" enum="shape"/>
160+ </request>
161+ </interface>
162+</protocol>
A protocol/cursorshape/cursor-shape-v1_generated.go +257 -0
@@ -0,0 +1,257 @@
1+// Code generated by wlturbo-scanner. DO NOT EDIT.
2+// Protocol: cursor_shape_v1
3+// Source: cursor-shape-v1.xml
4+
5+package cursorshape
6+
7+import (
8+ cross_wl_pointer "github.com/bnema/wlturbo/protocol/core"
9+ cross_zwp_tablet_tool_v2 "github.com/bnema/wlturbo/protocol/tablet"
10+ "github.com/bnema/wlturbo/wl"
11+)
12+
13+// SHAPE_DEFAULT is the shape default value.
14+const SHAPE_DEFAULT = 1
15+
16+// SHAPE_CONTEXT_MENU is the shape context_menu value.
17+const SHAPE_CONTEXT_MENU = 2
18+
19+// SHAPE_HELP is the shape help value.
20+const SHAPE_HELP = 3
21+
22+// SHAPE_POINTER is the shape pointer value.
23+const SHAPE_POINTER = 4
24+
25+// SHAPE_PROGRESS is the shape progress value.
26+const SHAPE_PROGRESS = 5
27+
28+// SHAPE_WAIT is the shape wait value.
29+const SHAPE_WAIT = 6
30+
31+// SHAPE_CELL is the shape cell value.
32+const SHAPE_CELL = 7
33+
34+// SHAPE_CROSSHAIR is the shape crosshair value.
35+const SHAPE_CROSSHAIR = 8
36+
37+// SHAPE_TEXT is the shape text value.
38+const SHAPE_TEXT = 9
39+
40+// SHAPE_VERTICAL_TEXT is the shape vertical_text value.
41+const SHAPE_VERTICAL_TEXT = 10
42+
43+// SHAPE_ALIAS is the shape alias value.
44+const SHAPE_ALIAS = 11
45+
46+// SHAPE_COPY is the shape copy value.
47+const SHAPE_COPY = 12
48+
49+// SHAPE_MOVE is the shape move value.
50+const SHAPE_MOVE = 13
51+
52+// SHAPE_NO_DROP is the shape no_drop value.
53+const SHAPE_NO_DROP = 14
54+
55+// SHAPE_NOT_ALLOWED is the shape not_allowed value.
56+const SHAPE_NOT_ALLOWED = 15
57+
58+// SHAPE_GRAB is the shape grab value.
59+const SHAPE_GRAB = 16
60+
61+// SHAPE_GRABBING is the shape grabbing value.
62+const SHAPE_GRABBING = 17
63+
64+// SHAPE_E_RESIZE is the shape e_resize value.
65+const SHAPE_E_RESIZE = 18
66+
67+// SHAPE_N_RESIZE is the shape n_resize value.
68+const SHAPE_N_RESIZE = 19
69+
70+// SHAPE_NE_RESIZE is the shape ne_resize value.
71+const SHAPE_NE_RESIZE = 20
72+
73+// SHAPE_NW_RESIZE is the shape nw_resize value.
74+const SHAPE_NW_RESIZE = 21
75+
76+// SHAPE_S_RESIZE is the shape s_resize value.
77+const SHAPE_S_RESIZE = 22
78+
79+// SHAPE_SE_RESIZE is the shape se_resize value.
80+const SHAPE_SE_RESIZE = 23
81+
82+// SHAPE_SW_RESIZE is the shape sw_resize value.
83+const SHAPE_SW_RESIZE = 24
84+
85+// SHAPE_W_RESIZE is the shape w_resize value.
86+const SHAPE_W_RESIZE = 25
87+
88+// SHAPE_EW_RESIZE is the shape ew_resize value.
89+const SHAPE_EW_RESIZE = 26
90+
91+// SHAPE_NS_RESIZE is the shape ns_resize value.
92+const SHAPE_NS_RESIZE = 27
93+
94+// SHAPE_NESW_RESIZE is the shape nesw_resize value.
95+const SHAPE_NESW_RESIZE = 28
96+
97+// SHAPE_NWSE_RESIZE is the shape nwse_resize value.
98+const SHAPE_NWSE_RESIZE = 29
99+
100+// SHAPE_COL_RESIZE is the shape col_resize value.
101+const SHAPE_COL_RESIZE = 30
102+
103+// SHAPE_ROW_RESIZE is the shape row_resize value.
104+const SHAPE_ROW_RESIZE = 31
105+
106+// SHAPE_ALL_SCROLL is the shape all_scroll value.
107+const SHAPE_ALL_SCROLL = 32
108+
109+// SHAPE_ZOOM_IN is the shape zoom_in value.
110+const SHAPE_ZOOM_IN = 33
111+
112+// SHAPE_ZOOM_OUT is the shape zoom_out value.
113+const SHAPE_ZOOM_OUT = 34
114+
115+// SHAPE_DND_ASK is the shape dnd_ask value.
116+const SHAPE_DND_ASK = 35
117+
118+// SHAPE_ALL_RESIZE is the shape all_resize value.
119+const SHAPE_ALL_RESIZE = 36
120+
121+// ERROR_INVALID_SHAPE is the error invalid_shape value.
122+const ERROR_INVALID_SHAPE = 1
123+
124+// WpCursorShapeManagerInterface is the protocol interface name.
125+const WpCursorShapeManagerInterface = "wp_cursor_shape_manager_v1"
126+
127+// WpCursorShapeManager is the generated binding for wp_cursor_shape_manager_v1 version 2.
128+type WpCursorShapeManager struct {
129+ wl.BaseProxy
130+}
131+
132+// NewWpCursorShapeManager returns an unbound WpCursorShapeManager.
133+func NewWpCursorShapeManager(ctx *wl.Context) *WpCursorShapeManager {
134+ obj := &WpCursorShapeManager{}
135+ obj.SetContext(ctx)
136+ ctx.Register(obj)
137+ return obj
138+}
139+
140+// Destroy the cursor shape manager.
141+func (o *WpCursorShapeManager) Destroy() error {
142+ if err := o.Context().CheckProxy(o); err != nil {
143+ return err
144+ }
145+ if err := o.Context().SendDestructor(o, 0); err != nil {
146+ return err
147+ }
148+ return nil
149+}
150+
151+// Obtain a wp_cursor_shape_device_v1 for a wl_pointer object. When the pointer capability is removed from the wl_seat, the wp_cursor_shape_device_v1 object becomes inert.
152+func (o *WpCursorShapeManager) GetPointer(pointer *cross_wl_pointer.Pointer) (*WpCursorShapeDevice, error) {
153+ if err := o.Context().CheckProxy(o); err != nil {
154+ return nil, err
155+ }
156+ var arg1 wl.Object
157+ if pointer != nil {
158+ arg1 = pointer
159+ }
160+ child := &WpCursorShapeDevice{}
161+ child.SetContext(o.Context())
162+ child.SetID(o.Context().AllocateID())
163+ o.Context().Register(child)
164+ if err := o.Context().SendRequest(o, 1, child, arg1); err != nil {
165+ o.Context().Unregister(child)
166+ return nil, err
167+ }
168+ return child, nil
169+}
170+
171+// Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object. When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1 object becomes inert.
172+func (o *WpCursorShapeManager) GetTabletTool(tabletTool *cross_zwp_tablet_tool_v2.TabletTool) (*WpCursorShapeDevice, error) {
173+ if err := o.Context().CheckProxy(o); err != nil {
174+ return nil, err
175+ }
176+ var arg1 wl.Object
177+ if tabletTool != nil {
178+ arg1 = tabletTool
179+ }
180+ child := &WpCursorShapeDevice{}
181+ child.SetContext(o.Context())
182+ child.SetID(o.Context().AllocateID())
183+ o.Context().Register(child)
184+ if err := o.Context().SendRequest(o, 2, child, arg1); err != nil {
185+ o.Context().Unregister(child)
186+ return nil, err
187+ }
188+ return child, nil
189+}
190+
191+// EventSignature returns the declared event argument types in wire order.
192+func (o *WpCursorShapeManager) EventSignature(opcode uint16) (string, bool) {
193+ switch opcode {
194+ default:
195+ return "", false
196+ }
197+}
198+
199+// Dispatch decodes one event on wp_cursor_shape_manager_v1 and calls the registered handlers.
200+func (o *WpCursorShapeManager) Dispatch(event *wl.Event) {
201+ switch event.Opcode {
202+ default:
203+ }
204+}
205+
206+// WpCursorShapeDeviceInterface is the protocol interface name.
207+const WpCursorShapeDeviceInterface = "wp_cursor_shape_device_v1"
208+
209+// WpCursorShapeDevice is the generated binding for wp_cursor_shape_device_v1 version 2.
210+type WpCursorShapeDevice struct {
211+ wl.BaseProxy
212+}
213+
214+// NewWpCursorShapeDevice returns an unbound WpCursorShapeDevice.
215+func NewWpCursorShapeDevice(ctx *wl.Context) *WpCursorShapeDevice {
216+ obj := &WpCursorShapeDevice{}
217+ obj.SetContext(ctx)
218+ ctx.Register(obj)
219+ return obj
220+}
221+
222+// Destroy the cursor shape device. The device cursor shape remains unchanged.
223+func (o *WpCursorShapeDevice) Destroy() error {
224+ if err := o.Context().CheckProxy(o); err != nil {
225+ return err
226+ }
227+ if err := o.Context().SendDestructor(o, 0); err != nil {
228+ return err
229+ }
230+ return nil
231+}
232+
233+// Sets the device cursor to the specified shape. The compositor will change the cursor image based on the specified shape. The cursor actually changes only if the input device focus is one of the requesting client's surfaces. If any, the previous cursor image (surface or shape) is replaced. The "shape" argument must be a valid enum entry, otherwise the invalid_shape protocol error is raised. This is similar to the wl_pointer.set_cursor and zwp_tablet_tool_v2.set_cursor requests, but this request accepts a shape instead of contents in the form of a surface. Clients can mix set_cursor and set_shape requests. The serial parameter must match the latest wl_pointer.enter or zwp_tablet_tool_v2.proximity_in serial number sent to the client. Otherwise the request will be ignored.
234+func (o *WpCursorShapeDevice) SetShape(serial uint32, shape uint32) error {
235+ if err := o.Context().CheckProxy(o); err != nil {
236+ return err
237+ }
238+ if err := o.Context().SendRequest(o, 1, serial, shape); err != nil {
239+ return err
240+ }
241+ return nil
242+}
243+
244+// EventSignature returns the declared event argument types in wire order.
245+func (o *WpCursorShapeDevice) EventSignature(opcode uint16) (string, bool) {
246+ switch opcode {
247+ default:
248+ return "", false
249+ }
250+}
251+
252+// Dispatch decodes one event on wp_cursor_shape_device_v1 and calls the registered handlers.
253+func (o *WpCursorShapeDevice) Dispatch(event *wl.Event) {
254+ switch event.Opcode {
255+ default:
256+ }
257+}
M protocol/extensions_test.go +22 -1
@@ -12,6 +12,7 @@ import (
1212
1313 "github.com/bnema/wlturbo"
1414 "github.com/bnema/wlturbo/protocol/core"
15+ "github.com/bnema/wlturbo/protocol/cursorshape"
1516 "github.com/bnema/wlturbo/protocol/drmsyncobj"
1617 "github.com/bnema/wlturbo/protocol/fractionalscale"
1718 "github.com/bnema/wlturbo/protocol/linuxdmabuf"
@@ -413,6 +414,26 @@ func TestExtensionsOverSocketpair(t *testing.T) {
413414 request(t, p)
414415 noerr(t, mgr.Release())
415416 request(t, p)
417+ // Cursor shape: get a device for a wl_pointer and set a shape at an
418+ // enter serial; check the exact wire arguments.
419+ pointer := core.NewPointer(d.Context())
420+ pointer.SetID(d.AllocateID())
421+ d.Context().Register(pointer)
422+ shapes := cursorshape.NewWpCursorShapeManager(d.Context())
423+ bind(t, d, p, 8, cursorshape.WpCursorShapeManagerInterface, 2, 1, shapes)
424+ shape, e := shapes.GetPointer(pointer)
425+ noerr(t, e)
426+ if id, op, b := request(t, p); id != shapes.ID() || op != 1 || binary.NativeEndian.Uint32(b) != shape.ID() || binary.NativeEndian.Uint32(b[4:]) != pointer.ID() {
427+ t.Fatalf("get_pointer wire id=%d op=%d %x", id, op, b)
428+ }
429+ noerr(t, shape.SetShape(42, cursorshape.SHAPE_POINTER))
430+ if id, op, b := request(t, p); id != shape.ID() || op != 1 || binary.NativeEndian.Uint32(b) != 42 || binary.NativeEndian.Uint32(b[4:]) != 4 {
431+ t.Fatalf("set_shape wire id=%d op=%d %x", id, op, b)
432+ }
433+ noerr(t, shape.Destroy())
434+ request(t, p)
435+ noerr(t, shapes.Destroy())
436+ request(t, p)
416437
417438 }
418439
@@ -424,7 +445,7 @@ func TestLiveFeedback(t *testing.T) {
424445 noerr(t, e)
425446 defer d.Close()
426447 noerr(t, d.Roundtrip())
427- for _, iface := range []string{xdgshell.XdgWmBaseInterface, linuxdmabuf.LinuxDmabufInterface, drmsyncobj.WpLinuxDrmSyncobjManagerInterface, viewporter.WpViewporterInterface, fractionalscale.WpFractionalScaleManagerInterface, textinput.TextInputManagerV3Interface} {
448+ for _, iface := range []string{xdgshell.XdgWmBaseInterface, linuxdmabuf.LinuxDmabufInterface, drmsyncobj.WpLinuxDrmSyncobjManagerInterface, viewporter.WpViewporterInterface, fractionalscale.WpFractionalScaleManagerInterface, textinput.TextInputManagerV3Interface, cursorshape.WpCursorShapeManagerInterface} {
428449 g, ok := d.Registry().FindGlobal(iface)
429450 if !ok {
430451 t.Logf("%s absent", iface)
M protocol/generate.go +2 -0
@@ -6,4 +6,6 @@ package protocol
66 //go:generate go run ../cmd/wlturbo-scanner -p drmsyncobj -o drmsyncobj/linux-drm-syncobj-v1_generated.go -import wl_surface=github.com/bnema/wlturbo/protocol/core drmsyncobj/linux-drm-syncobj-v1.xml
77 //go:generate go run ../cmd/wlturbo-scanner -p viewporter -o viewporter/viewporter_generated.go -import wl_surface=github.com/bnema/wlturbo/protocol/core viewporter/viewporter.xml
88 //go:generate go run ../cmd/wlturbo-scanner -p fractionalscale -o fractionalscale/fractional-scale-v1_generated.go -import wl_surface=github.com/bnema/wlturbo/protocol/core fractionalscale/fractional-scale-v1.xml
9+//go:generate go run ../cmd/wlturbo-scanner -p tablet -o tablet/tablet-v2_generated.go -import wl_surface=github.com/bnema/wlturbo/protocol/core -import wl_seat=github.com/bnema/wlturbo/protocol/core tablet/tablet-v2.xml
10+//go:generate go run ../cmd/wlturbo-scanner -p cursorshape -o cursorshape/cursor-shape-v1_generated.go -import wl_pointer=github.com/bnema/wlturbo/protocol/core -import zwp_tablet_tool_v2=github.com/bnema/wlturbo/protocol/tablet cursorshape/cursor-shape-v1.xml
911 //go:generate go run ../cmd/wlturbo-scanner -p textinput -o textinput/text-input-unstable-v3_generated.go -import wl_surface=github.com/bnema/wlturbo/protocol/core -import wl_seat=github.com/bnema/wlturbo/protocol/core textinput/text-input-unstable-v3.xml
A protocol/tablet/tablet-v2.xml +1297 -0
@@ -0,0 +1,1297 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<protocol name="tablet_v2">
3+
4+ <copyright>
5+ Copyright 2014 © Stephen "Lyude" Chandler Paul
6+ Copyright 2015-2024 © Red Hat, Inc.
7+
8+ Permission is hereby granted, free of charge, to any person
9+ obtaining a copy of this software and associated documentation files
10+ (the "Software"), to deal in the Software without restriction,
11+ including without limitation the rights to use, copy, modify, merge,
12+ publish, distribute, sublicense, and/or sell copies of the Software,
13+ and to permit persons to whom the Software is furnished to do so,
14+ subject to the following conditions:
15+
16+ The above copyright notice and this permission notice (including the
17+ next paragraph) shall be included in all copies or substantial
18+ portions of the Software.
19+
20+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+ SOFTWARE.
28+ </copyright>
29+
30+ <description summary="Wayland protocol for graphics tablets">
31+ This description provides a high-level overview of the interplay between
32+ the interfaces defined this protocol. For details, see the protocol
33+ specification.
34+
35+ More than one tablet may exist, and device-specifics matter. Tablets are
36+ not represented by a single virtual device like wl_pointer. A client
37+ binds to the tablet manager object which is just a proxy object. From
38+ that, the client requests zwp_tablet_manager_v2.get_tablet_seat(wl_seat)
39+ and that returns the actual interface that has all the tablets. With
40+ this indirection, we can avoid merging zwp_tablet_v2 into the actual Wayland
41+ protocol, a long-term benefit.
42+
43+ The zwp_tablet_seat_v2 sends a "tablet added" event for each tablet
44+ connected. That event is followed by descriptive events about the
45+ hardware; currently that includes events for name, vid/pid and
46+ a zwp_tablet_v2.path event that describes a local path. This path can be
47+ used to uniquely identify a tablet or get more information through
48+ libwacom. Emulated or nested tablets can skip any of those, e.g. a
49+ virtual tablet may not have a vid/pid. The sequence of descriptive
50+ events is terminated by a zwp_tablet_v2.done event to signal that a client
51+ may now finalize any initialization for that tablet.
52+
53+ Events from tablets require a tool in proximity. Tools are also managed
54+ by the tablet seat; a "tool added" event is sent whenever a tool is new
55+ to the compositor. That event is followed by a number of descriptive
56+ events about the hardware; currently that includes capabilities,
57+ hardware id and serial number, and tool type. Similar to the tablet
58+ interface, a zwp_tablet_tool_v2.done event is sent to terminate that initial
59+ sequence.
60+
61+ Any event from a tool happens on the zwp_tablet_tool_v2 interface. When the
62+ tool gets into proximity of the tablet, a proximity_in event is sent on
63+ the zwp_tablet_tool_v2 interface, listing the tablet and the surface. That
64+ event is followed by a motion event with the coordinates. After that,
65+ it's the usual motion, axis, button, etc. events. The protocol's
66+ serialisation means events are grouped by zwp_tablet_tool_v2.frame events.
67+
68+ Two special events (that don't exist in X) are down and up. They signal
69+ "tip touching the surface". For tablets without real proximity
70+ detection, the sequence is: proximity_in, motion, down, frame.
71+
72+ When the tool leaves proximity, a proximity_out event is sent. If any
73+ button is still down, a button release event is sent before this
74+ proximity event. These button events are sent in the same frame as the
75+ proximity event to signal to the client that the buttons were held when
76+ the tool left proximity.
77+
78+ If the tool moves out of the surface but stays in proximity (i.e.
79+ between windows), compositor-specific grab policies apply. This usually
80+ means that the proximity-out is delayed until all buttons are released.
81+
82+ Moving a tool physically from one tablet to the other has no real effect
83+ on the protocol, since we already have the tool object from the "tool
84+ added" event. All the information is already there and the proximity
85+ events on both tablets are all a client needs to reconstruct what
86+ happened.
87+
88+ Some extra axes are normalized, i.e. the client knows the range as
89+ specified in the protocol (e.g. [0, 65535]), the granularity however is
90+ unknown. The current normalized axes are pressure, distance, and slider.
91+
92+ Other extra axes are in physical units as specified in the protocol.
93+ The current extra axes with physical units are tilt, rotation and
94+ wheel rotation.
95+
96+ Since tablets work independently of the pointer controlled by the mouse,
97+ the focus handling is independent too and controlled by proximity.
98+ The zwp_tablet_tool_v2.set_cursor request sets a tool-specific cursor.
99+ This cursor surface may be the same as the mouse cursor, and it may be
100+ the same across tools but it is possible to be more fine-grained. For
101+ example, a client may set different cursors for the pen and eraser.
102+
103+ Tools are generally independent of tablets and it is
104+ compositor-specific policy when a tool can be removed. Common approaches
105+ will likely include some form of removing a tool when all tablets the
106+ tool was used on are removed.
107+ </description>
108+
109+ <interface name="zwp_tablet_manager_v2" version="2">
110+ <description summary="controller object for graphic tablet devices">
111+ An object that provides access to the graphics tablets available on this
112+ system. All tablets are associated with a seat, to get access to the
113+ actual tablets, use zwp_tablet_manager_v2.get_tablet_seat.
114+ </description>
115+
116+ <request name="get_tablet_seat">
117+ <description summary="get the tablet seat">
118+ Get the zwp_tablet_seat_v2 object for the given seat. This object
119+ provides access to all graphics tablets in this seat.
120+ </description>
121+ <arg name="tablet_seat" type="new_id" interface="zwp_tablet_seat_v2"/>
122+ <arg name="seat" type="object" interface="wl_seat" summary="The wl_seat object to retrieve the tablets for" />
123+ </request>
124+
125+ <request name="destroy" type="destructor">
126+ <description summary="release the memory for the tablet manager object">
127+ Destroy the zwp_tablet_manager_v2 object. Objects created from this
128+ object are unaffected and should be destroyed separately.
129+ </description>
130+ </request>
131+ </interface>
132+
133+ <interface name="zwp_tablet_seat_v2" version="2">
134+ <description summary="controller object for graphic tablet devices of a seat">
135+ An object that provides access to the graphics tablets available on this
136+ seat. After binding to this interface, the compositor sends a set of
137+ zwp_tablet_seat_v2.tablet_added and zwp_tablet_seat_v2.tool_added events.
138+ </description>
139+
140+ <request name="destroy" type="destructor">
141+ <description summary="release the memory for the tablet seat object">
142+ Destroy the zwp_tablet_seat_v2 object. Objects created from this
143+ object are unaffected and should be destroyed separately.
144+ </description>
145+ </request>
146+
147+ <event name="tablet_added">
148+ <description summary="new device notification">
149+ This event is sent whenever a new tablet becomes available on this
150+ seat. This event only provides the object id of the tablet, any
151+ static information about the tablet (device name, vid/pid, etc.) is
152+ sent through the zwp_tablet_v2 interface.
153+ </description>
154+ <arg name="id" type="new_id" interface="zwp_tablet_v2" summary="the newly added graphics tablet"/>
155+ </event>
156+
157+ <event name="tool_added">
158+ <description summary="a new tool has been used with a tablet">
159+ This event is sent whenever a tool that has not previously been used
160+ with a tablet comes into use. This event only provides the object id
161+ of the tool; any static information about the tool (capabilities,
162+ type, etc.) is sent through the zwp_tablet_tool_v2 interface.
163+ </description>
164+ <arg name="id" type="new_id" interface="zwp_tablet_tool_v2" summary="the newly added tablet tool"/>
165+ </event>
166+
167+ <event name="pad_added">
168+ <description summary="new pad notification">
169+ This event is sent whenever a new pad is known to the system. Typically,
170+ pads are physically attached to tablets and a pad_added event is
171+ sent immediately after the zwp_tablet_seat_v2.tablet_added.
172+ However, some standalone pad devices logically attach to tablets at
173+ runtime, and the client must wait for zwp_tablet_pad_v2.enter to know
174+ the tablet a pad is attached to.
175+
176+ This event only provides the object id of the pad. All further
177+ features (buttons, strips, rings) are sent through the zwp_tablet_pad_v2
178+ interface.
179+ </description>
180+ <arg name="id" type="new_id" interface="zwp_tablet_pad_v2" summary="the newly added pad"/>
181+ </event>
182+ </interface>
183+
184+ <interface name="zwp_tablet_tool_v2" version="2">
185+ <description summary="a physical tablet tool">
186+ An object that represents a physical tool that has been, or is
187+ currently in use with a tablet in this seat. Each zwp_tablet_tool_v2
188+ object stays valid until the client destroys it; the compositor
189+ reuses the zwp_tablet_tool_v2 object to indicate that the object's
190+ respective physical tool has come into proximity of a tablet again.
191+
192+ A zwp_tablet_tool_v2 object's relation to a physical tool depends on the
193+ tablet's ability to report serial numbers. If the tablet supports
194+ this capability, then the object represents a specific physical tool
195+ and can be identified even when used on multiple tablets.
196+
197+ A tablet tool has a number of static characteristics, e.g. tool type,
198+ hardware_serial and capabilities. These capabilities are sent in an
199+ event sequence after the zwp_tablet_seat_v2.tool_added event before any
200+ actual events from this tool. This initial event sequence is
201+ terminated by a zwp_tablet_tool_v2.done event.
202+
203+ Tablet tool events are grouped by zwp_tablet_tool_v2.frame events.
204+ Any events received before a zwp_tablet_tool_v2.frame event should be
205+ considered part of the same hardware state change.
206+ </description>
207+
208+ <request name="set_cursor">
209+ <description summary="set the tablet tool's surface">
210+ Sets the surface of the cursor used for this tool on the given
211+ tablet. This request only takes effect if the tool is in proximity
212+ of one of the requesting client's surfaces or the surface parameter
213+ is the current pointer surface. If there was a previous surface set
214+ with this request it is replaced. If surface is NULL, the cursor
215+ image is hidden.
216+
217+ The parameters hotspot_x and hotspot_y define the position of the
218+ pointer surface relative to the pointer location. Its top-left corner
219+ is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the
220+ coordinates of the pointer location, in surface-local coordinates.
221+
222+ On surface.attach requests to the pointer surface, hotspot_x and
223+ hotspot_y are decremented by the x and y parameters passed to the
224+ request. Attach must be confirmed by wl_surface.commit as usual.
225+
226+ The hotspot can also be updated by passing the currently set pointer
227+ surface to this request with new values for hotspot_x and hotspot_y.
228+
229+ The current and pending input regions of the wl_surface are cleared,
230+ and wl_surface.set_input_region is ignored until the wl_surface is no
231+ longer used as the cursor. When the use as a cursor ends, the current
232+ and pending input regions become undefined, and the wl_surface is
233+ unmapped.
234+
235+ This request gives the surface the role of a zwp_tablet_tool_v2 cursor. A
236+ surface may only ever be used as the cursor surface for one
237+ zwp_tablet_tool_v2. If the surface already has another role or has
238+ previously been used as cursor surface for a different tool, a
239+ protocol error is raised.
240+ </description>
241+ <arg name="serial" type="uint" summary="serial of the proximity_in event"/>
242+ <arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
243+ <arg name="hotspot_x" type="int" summary="surface-local x coordinate"/>
244+ <arg name="hotspot_y" type="int" summary="surface-local y coordinate"/>
245+ </request>
246+
247+ <request name="destroy" type="destructor">
248+ <description summary="destroy the tool object">
249+ This destroys the client's resource for this tool object.
250+ </description>
251+ </request>
252+
253+ <enum name="type">
254+ <description summary="a physical tool type">
255+ Describes the physical type of a tool. The physical type of a tool
256+ generally defines its base usage.
257+
258+ The mouse tool represents a mouse-shaped tool that is not a relative
259+ device but bound to the tablet's surface, providing absolute
260+ coordinates.
261+
262+ The lens tool is a mouse-shaped tool with an attached lens to
263+ provide precision focus.
264+ </description>
265+ <entry name="pen" value="0x140" summary="Pen"/>
266+ <entry name="eraser" value="0x141" summary="Eraser"/>
267+ <entry name="brush" value="0x142" summary="Brush"/>
268+ <entry name="pencil" value="0x143" summary="Pencil"/>
269+ <entry name="airbrush" value="0x144" summary="Airbrush"/>
270+ <entry name="finger" value="0x145" summary="Finger"/>
271+ <entry name="mouse" value="0x146" summary="Mouse"/>
272+ <entry name="lens" value="0x147" summary="Lens"/>
273+ </enum>
274+
275+ <event name="type">
276+ <description summary="tool type">
277+ The tool type is the high-level type of the tool and usually decides
278+ the interaction expected from this tool.
279+
280+ This event is sent in the initial burst of events before the
281+ zwp_tablet_tool_v2.done event.
282+ </description>
283+ <arg name="tool_type" type="uint" enum="type" summary="the physical tool type"/>
284+ </event>
285+
286+ <event name="hardware_serial">
287+ <description summary="unique hardware serial number of the tool">
288+ If the physical tool can be identified by a unique 64-bit serial
289+ number, this event notifies the client of this serial number.
290+
291+ If multiple tablets are available in the same seat and the tool is
292+ uniquely identifiable by the serial number, that tool may move
293+ between tablets.
294+
295+ Otherwise, if the tool has no serial number and this event is
296+ missing, the tool is tied to the tablet it first comes into
297+ proximity with. Even if the physical tool is used on multiple
298+ tablets, separate zwp_tablet_tool_v2 objects will be created, one per
299+ tablet.
300+
301+ This event is sent in the initial burst of events before the
302+ zwp_tablet_tool_v2.done event.
303+ </description>
304+ <arg name="hardware_serial_hi" type="uint" summary="the unique serial number of the tool, most significant bits"/>
305+ <arg name="hardware_serial_lo" type="uint" summary="the unique serial number of the tool, least significant bits"/>
306+ </event>
307+
308+ <event name="hardware_id_wacom">
309+ <description summary="hardware id notification in Wacom's format">
310+ This event notifies the client of a hardware id available on this tool.
311+
312+ The hardware id is a device-specific 64-bit id that provides extra
313+ information about the tool in use, beyond the wl_tool.type
314+ enumeration. The format of the id is specific to tablets made by
315+ Wacom Inc. For example, the hardware id of a Wacom Grip
316+ Pen (a stylus) is 0x802.
317+
318+ This event is sent in the initial burst of events before the
319+ zwp_tablet_tool_v2.done event.
320+ </description>
321+ <arg name="hardware_id_hi" type="uint" summary="the hardware id, most significant bits"/>
322+ <arg name="hardware_id_lo" type="uint" summary="the hardware id, least significant bits"/>
323+ </event>
324+
325+ <enum name="capability">
326+ <description summary="capability flags for a tool">
327+ Describes extra capabilities on a tablet.
328+
329+ Any tool must provide x and y values, extra axes are
330+ device-specific.
331+ </description>
332+ <entry name="tilt" value="1" summary="Tilt axes"/>
333+ <entry name="pressure" value="2" summary="Pressure axis"/>
334+ <entry name="distance" value="3" summary="Distance axis"/>
335+ <entry name="rotation" value="4" summary="Z-rotation axis"/>
336+ <entry name="slider" value="5" summary="Slider axis"/>
337+ <entry name="wheel" value="6" summary="Wheel axis"/>
338+ </enum>
339+
340+ <event name="capability">
341+ <description summary="tool capability notification">
342+ This event notifies the client of any capabilities of this tool,
343+ beyond the main set of x/y axes and tip up/down detection.
344+
345+ One event is sent for each extra capability available on this tool.
346+
347+ This event is sent in the initial burst of events before the
348+ zwp_tablet_tool_v2.done event.
349+ </description>
350+ <arg name="capability" type="uint" enum="capability" summary="the capability"/>
351+ </event>
352+
353+ <event name="done">
354+ <description summary="tool description events sequence complete">
355+ This event signals the end of the initial burst of descriptive
356+ events. A client may consider the static description of the tool to
357+ be complete and finalize initialization of the tool.
358+ </description>
359+ </event>
360+
361+ <event name="removed">
362+ <description summary="tool removed">
363+ This event is sent when the tool is removed from the system and will
364+ send no further events. Should the physical tool come back into
365+ proximity later, a new zwp_tablet_tool_v2 object will be created.
366+
367+ It is compositor-dependent when a tool is removed. A compositor may
368+ remove a tool on proximity out, tablet removal or any other reason.
369+ A compositor may also keep a tool alive until shutdown.
370+
371+ If the tool is currently in proximity, a proximity_out event will be
372+ sent before the removed event. See zwp_tablet_tool_v2.proximity_out for
373+ the handling of any buttons logically down.
374+
375+ When this event is received, the client must zwp_tablet_tool_v2.destroy
376+ the object.
377+ </description>
378+ </event>
379+
380+ <event name="proximity_in">
381+ <description summary="proximity in event">
382+ Notification that this tool is focused on a certain surface.
383+
384+ This event can be received when the tool has moved from one surface to
385+ another, or when the tool has come back into proximity above the
386+ surface.
387+
388+ If any button is logically down when the tool comes into proximity,
389+ the respective button event is sent after the proximity_in event but
390+ within the same frame as the proximity_in event.
391+ </description>
392+ <arg name="serial" type="uint"/>
393+ <arg name="tablet" type="object" interface="zwp_tablet_v2" summary="The tablet the tool is in proximity of"/>
394+ <arg name="surface" type="object" interface="wl_surface" summary="The current surface the tablet tool is over"/>
395+ </event>
396+
397+ <event name="proximity_out">
398+ <description summary="proximity out event">
399+ Notification that this tool has either left proximity, or is no
400+ longer focused on a certain surface.
401+
402+ When the tablet tool leaves proximity of the tablet, button release
403+ events are sent for each button that was held down at the time of
404+ leaving proximity. These events are sent before the proximity_out
405+ event but within the same zwp_tablet_v2.frame.
406+
407+ If the tool stays within proximity of the tablet, but the focus
408+ changes from one surface to another, a button release event may not
409+ be sent until the button is actually released or the tool leaves the
410+ proximity of the tablet.
411+ </description>
412+ </event>
413+
414+ <event name="down">
415+ <description summary="tablet tool is making contact">
416+ Sent whenever the tablet tool comes in contact with the surface of the
417+ tablet.
418+
419+ If the tool is already in contact with the tablet when entering the
420+ input region, the client owning said region will receive a
421+ zwp_tablet_v2.proximity_in event, followed by a zwp_tablet_v2.down
422+ event and a zwp_tablet_v2.frame event.
423+
424+ Note that this event describes logical contact, not physical
425+ contact. On some devices, a compositor may not consider a tool in
426+ logical contact until a minimum physical pressure threshold is
427+ exceeded.
428+ </description>
429+ <arg name="serial" type="uint"/>
430+ </event>
431+
432+ <event name="up">
433+ <description summary="tablet tool is no longer making contact">
434+ Sent whenever the tablet tool stops making contact with the surface of
435+ the tablet, or when the tablet tool moves out of the input region
436+ and the compositor grab (if any) is dismissed.
437+
438+ If the tablet tool moves out of the input region while in contact
439+ with the surface of the tablet and the compositor does not have an
440+ ongoing grab on the surface, the client owning said region will
441+ receive a zwp_tablet_v2.up event, followed by a zwp_tablet_v2.proximity_out
442+ event and a zwp_tablet_v2.frame event. If the compositor has an ongoing
443+ grab on this device, this event sequence is sent whenever the grab
444+ is dismissed in the future.
445+
446+ Note that this event describes logical contact, not physical
447+ contact. On some devices, a compositor may not consider a tool out
448+ of logical contact until physical pressure falls below a specific
449+ threshold.
450+ </description>
451+ </event>
452+
453+ <event name="motion">
454+ <description summary="motion event">
455+ Sent whenever a tablet tool moves.
456+ </description>
457+ <arg name="x" type="fixed" summary="surface-local x coordinate"/>
458+ <arg name="y" type="fixed" summary="surface-local y coordinate"/>
459+ </event>
460+
461+ <event name="pressure">
462+ <description summary="pressure change event">
463+ Sent whenever the pressure axis on a tool changes. The value of this
464+ event is normalized to a value between 0 and 65535.
465+
466+ Note that pressure may be nonzero even when a tool is not in logical
467+ contact. See the down and up events for more details.
468+ </description>
469+ <arg name="pressure" type="uint" summary="The current pressure value"/>
470+ </event>
471+
472+ <event name="distance">
473+ <description summary="distance change event">
474+ Sent whenever the distance axis on a tool changes. The value of this
475+ event is normalized to a value between 0 and 65535.
476+
477+ Note that distance may be nonzero even when a tool is not in logical
478+ contact. See the down and up events for more details.
479+ </description>
480+ <arg name="distance" type="uint" summary="The current distance value"/>
481+ </event>
482+
483+ <event name="tilt">
484+ <description summary="tilt change event">
485+ Sent whenever one or both of the tilt axes on a tool change. Each tilt
486+ value is in degrees, relative to the z-axis of the tablet.
487+ The angle is positive when the top of a tool tilts along the
488+ positive x or y axis.
489+ </description>
490+ <arg name="tilt_x" type="fixed" summary="The current value of the X tilt axis"/>
491+ <arg name="tilt_y" type="fixed" summary="The current value of the Y tilt axis"/>
492+ </event>
493+
494+ <event name="rotation">
495+ <description summary="z-rotation change event">
496+ Sent whenever the z-rotation axis on the tool changes. The
497+ rotation value is in degrees clockwise from the tool's
498+ logical neutral position.
499+ </description>
500+ <arg name="degrees" type="fixed" summary="The current rotation of the Z axis"/>
501+ </event>
502+
503+ <event name="slider">
504+ <description summary="Slider position change event">
505+ Sent whenever the slider position on the tool changes. The
506+ value is normalized between -65535 and 65535, with 0 as the logical
507+ neutral position of the slider.
508+
509+ The slider is available on e.g. the Wacom Airbrush tool.
510+ </description>
511+ <arg name="position" type="int" summary="The current position of slider"/>
512+ </event>
513+
514+ <event name="wheel">
515+ <description summary="Wheel delta event">
516+ Sent whenever the wheel on the tool emits an event. This event
517+ contains two values for the same axis change. The degrees value is
518+ in the same orientation as the wl_pointer.vertical_scroll axis. The
519+ clicks value is in discrete logical clicks of the mouse wheel. This
520+ value may be zero if the movement of the wheel was less
521+ than one logical click.
522+
523+ Clients should choose either value and avoid mixing degrees and
524+ clicks. The compositor may accumulate values smaller than a logical
525+ click and emulate click events when a certain threshold is met.
526+ Thus, zwp_tablet_tool_v2.wheel events with non-zero clicks values may
527+ have different degrees values.
528+ </description>
529+ <arg name="degrees" type="fixed" summary="The wheel delta in degrees"/>
530+ <arg name="clicks" type="int" summary="The wheel delta in discrete clicks"/>
531+ </event>
532+
533+ <enum name="button_state">
534+ <description summary="physical button state">
535+ Describes the physical state of a button that produced the button event.
536+ </description>
537+ <entry name="released" value="0" summary="button is not pressed"/>
538+ <entry name="pressed" value="1" summary="button is pressed"/>
539+ </enum>
540+
541+ <event name="button">
542+ <description summary="button event">
543+ Sent whenever a button on the tool is pressed or released.
544+
545+ If a button is held down when the tool moves in or out of proximity,
546+ button events are generated by the compositor. See
547+ zwp_tablet_tool_v2.proximity_in and zwp_tablet_tool_v2.proximity_out for
548+ details.
549+ </description>
550+ <arg name="serial" type="uint"/>
551+ <arg name="button" type="uint" summary="The button whose state has changed"/>
552+ <arg name="state" type="uint" enum="button_state" summary="Whether the button was pressed or released"/>
553+ </event>
554+
555+ <event name="frame">
556+ <description summary="frame event">
557+ Marks the end of a series of axis and/or button updates from the
558+ tablet. The Wayland protocol requires axis updates to be sent
559+ sequentially, however all events within a frame should be considered
560+ one hardware event.
561+ </description>
562+ <arg name="time" type="uint" summary="The time of the event with millisecond granularity"/>
563+ </event>
564+
565+ <enum name="error">
566+ <entry name="role" value="0" summary="given wl_surface has another role"/>
567+ </enum>
568+ </interface>
569+
570+ <interface name="zwp_tablet_v2" version="2">
571+ <description summary="graphics tablet device">
572+ The zwp_tablet_v2 interface represents one graphics tablet device. The
573+ tablet interface itself does not generate events; all events are
574+ generated by zwp_tablet_tool_v2 objects when in proximity above a tablet.
575+
576+ A tablet has a number of static characteristics, e.g. device name and
577+ pid/vid. These capabilities are sent in an event sequence after the
578+ zwp_tablet_seat_v2.tablet_added event. This initial event sequence is
579+ terminated by a zwp_tablet_v2.done event.
580+ </description>
581+
582+ <request name="destroy" type="destructor">
583+ <description summary="destroy the tablet object">
584+ This destroys the client's resource for this tablet object.
585+ </description>
586+ </request>
587+
588+ <event name="name">
589+ <description summary="tablet device name">
590+ A descriptive name for the tablet device.
591+
592+ If the device has no descriptive name, this event is not sent.
593+
594+ This event is sent in the initial burst of events before the
595+ zwp_tablet_v2.done event.
596+ </description>
597+ <arg name="name" type="string" summary="the device name"/>
598+ </event>
599+
600+ <event name="id">
601+ <description summary="tablet device vendor/product id">
602+ The vendor and product IDs for the tablet device.
603+
604+ The interpretation of the id depends on the zwp_tablet_v2.bustype.
605+ Prior to version v2 of this protocol, the id was implied to be a USB
606+ vendor and product ID. If no zwp_tablet_v2.bustype is sent, the ID
607+ is to be interpreted as USB vendor and product ID.
608+
609+ If the device has no vendor/product ID, this event is not sent.
610+ This can happen for virtual devices or non-USB devices, for instance.
611+
612+ This event is sent in the initial burst of events before the
613+ zwp_tablet_v2.done event.
614+ </description>
615+ <arg name="vid" type="uint" summary="vendor id"/>
616+ <arg name="pid" type="uint" summary="product id"/>
617+ </event>
618+
619+ <event name="path">
620+ <description summary="path to the device">
621+ A system-specific device path that indicates which device is behind
622+ this zwp_tablet_v2. This information may be used to gather additional
623+ information about the device, e.g. through libwacom.
624+
625+ A device may have more than one device path. If so, multiple
626+ zwp_tablet_v2.path events are sent. A device may be emulated and not
627+ have a device path, and in that case this event will not be sent.
628+
629+ The format of the path is unspecified, it may be a device node, a
630+ sysfs path, or some other identifier. It is up to the client to
631+ identify the string provided.
632+
633+ This event is sent in the initial burst of events before the
634+ zwp_tablet_v2.done event.
635+ </description>
636+ <arg name="path" type="string" summary="path to local device"/>
637+ </event>
638+
639+ <event name="done">
640+ <description summary="tablet description events sequence complete">
641+ This event is sent immediately to signal the end of the initial
642+ burst of descriptive events. A client may consider the static
643+ description of the tablet to be complete and finalize initialization
644+ of the tablet.
645+ </description>
646+ </event>
647+
648+ <event name="removed">
649+ <description summary="tablet removed event">
650+ Sent when the tablet has been removed from the system. When a tablet
651+ is removed, some tools may be removed.
652+
653+ When this event is received, the client must zwp_tablet_v2.destroy
654+ the object.
655+ </description>
656+ </event>
657+
658+ <!-- Version 2 additions -->
659+
660+ <enum name="bustype" since="2">
661+ <description summary="bus type ">
662+ Describes the bus types this tablet is connected to.
663+ </description>
664+ <entry name="usb" value="3" summary="USB"/>
665+ <entry name="bluetooth" value="5" summary="Bluetooth"/>
666+ <entry name="virtual" value="6" summary="Virtual"/>
667+ <entry name="serial" value="17" summary="Serial"/>
668+ <entry name="i2c" value="24" summary="I2C"/>
669+ </enum>
670+
671+ <event name="bustype" since="2">
672+ <description summary="tablet device bus type">
673+ The bustype argument is one of the BUS_ defines in the Linux kernel's
674+ linux/input.h
675+
676+ If the device has no known bustype or the bustype cannot be
677+ queried, this event is not sent.
678+
679+ This event is sent in the initial burst of events before the
680+ zwp_tablet_v2.done event.
681+ </description>
682+ <arg name="bustype" type="uint" enum="bustype" summary="bus type"/>
683+ </event>
684+ </interface>
685+
686+ <interface name="zwp_tablet_pad_ring_v2" version="2">
687+ <description summary="pad ring">
688+ A circular interaction area, such as the touch ring on the Wacom Intuos
689+ Pro series tablets.
690+
691+ Events on a ring are logically grouped by the zwp_tablet_pad_ring_v2.frame
692+ event.
693+ </description>
694+
695+ <request name="set_feedback">
696+ <description summary="set compositor feedback">
697+ Request that the compositor use the provided feedback string
698+ associated with this ring. This request should be issued immediately
699+ after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding
700+ group is received, or whenever the ring is mapped to a different
701+ action. See zwp_tablet_pad_group_v2.mode_switch for more details.
702+
703+ Clients are encouraged to provide context-aware descriptions for
704+ the actions associated with the ring; compositors may use this
705+ information to offer visual feedback about the button layout
706+ (eg. on-screen displays).
707+
708+ The provided string 'description' is a UTF-8 encoded string to be
709+ associated with this ring, and is considered user-visible; general
710+ internationalization rules apply.
711+
712+ The serial argument will be that of the last
713+ zwp_tablet_pad_group_v2.mode_switch event received for the group of this
714+ ring. Requests providing other serials than the most recent one will be
715+ ignored.
716+ </description>
717+ <arg name="description" type="string" summary="ring description"/>
718+ <arg name="serial" type="uint" summary="serial of the mode switch event"/>
719+ </request>
720+
721+ <request name="destroy" type="destructor">
722+ <description summary="destroy the ring object">
723+ This destroys the client's resource for this ring object.
724+ </description>
725+ </request>
726+
727+ <enum name="source">
728+ <description summary="ring axis source">
729+ Describes the source types for ring events. This indicates to the
730+ client how a ring event was physically generated; a client may
731+ adjust the user interface accordingly. For example, events
732+ from a "finger" source may trigger kinetic scrolling.
733+ </description>
734+ <entry name="finger" value="1" summary="finger"/>
735+ </enum>
736+
737+ <event name="source">
738+ <description summary="ring event source">
739+ Source information for ring events.
740+
741+ This event does not occur on its own. It is sent before a
742+ zwp_tablet_pad_ring_v2.frame event and carries the source information
743+ for all events within that frame.
744+
745+ The source specifies how this event was generated. If the source is
746+ zwp_tablet_pad_ring_v2.source.finger, a zwp_tablet_pad_ring_v2.stop event
747+ will be sent when the user lifts the finger off the device.
748+
749+ This event is optional. If the source is unknown for an interaction,
750+ no event is sent.
751+ </description>
752+ <arg name="source" type="uint" enum="source" summary="the event source"/>
753+ </event>
754+
755+ <event name="angle">
756+ <description summary="angle changed">
757+ Sent whenever the angle on a ring changes.
758+
759+ The angle is provided in degrees clockwise from the logical
760+ north of the ring in the pad's current rotation.
761+ </description>
762+ <arg name="degrees" type="fixed" summary="the current angle in degrees"/>
763+ </event>
764+
765+ <event name="stop">
766+ <description summary="interaction stopped">
767+ Stop notification for ring events.
768+
769+ For some zwp_tablet_pad_ring_v2.source types, a zwp_tablet_pad_ring_v2.stop
770+ event is sent to notify a client that the interaction with the ring
771+ has terminated. This enables the client to implement kinetic scrolling.
772+ See the zwp_tablet_pad_ring_v2.source documentation for information on
773+ when this event may be generated.
774+
775+ Any zwp_tablet_pad_ring_v2.angle events with the same source after this
776+ event should be considered as the start of a new interaction.
777+ </description>
778+ </event>
779+
780+ <event name="frame">
781+ <description summary="end of a ring event sequence">
782+ Indicates the end of a set of ring events that logically belong
783+ together. A client is expected to accumulate the data in all events
784+ within the frame before proceeding.
785+
786+ All zwp_tablet_pad_ring_v2 events before a zwp_tablet_pad_ring_v2.frame event belong
787+ logically together. For example, on termination of a finger interaction
788+ on a ring the compositor will send a zwp_tablet_pad_ring_v2.source event,
789+ a zwp_tablet_pad_ring_v2.stop event and a zwp_tablet_pad_ring_v2.frame event.
790+
791+ A zwp_tablet_pad_ring_v2.frame event is sent for every logical event
792+ group, even if the group only contains a single zwp_tablet_pad_ring_v2
793+ event. Specifically, a client may get a sequence: angle, frame,
794+ angle, frame, etc.
795+ </description>
796+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
797+ </event>
798+ </interface>
799+
800+ <interface name="zwp_tablet_pad_strip_v2" version="2">
801+ <description summary="pad strip">
802+ A linear interaction area, such as the strips found in Wacom Cintiq
803+ models.
804+
805+ Events on a strip are logically grouped by the zwp_tablet_pad_strip_v2.frame
806+ event.
807+ </description>
808+
809+ <request name="set_feedback">
810+ <description summary="set compositor feedback">
811+ Requests the compositor to use the provided feedback string
812+ associated with this strip. This request should be issued immediately
813+ after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding
814+ group is received, or whenever the strip is mapped to a different
815+ action. See zwp_tablet_pad_group_v2.mode_switch for more details.
816+
817+ Clients are encouraged to provide context-aware descriptions for
818+ the actions associated with the strip, and compositors may use this
819+ information to offer visual feedback about the button layout
820+ (eg. on-screen displays).
821+
822+ The provided string 'description' is a UTF-8 encoded string to be
823+ associated with this ring, and is considered user-visible; general
824+ internationalization rules apply.
825+
826+ The serial argument will be that of the last
827+ zwp_tablet_pad_group_v2.mode_switch event received for the group of this
828+ strip. Requests providing other serials than the most recent one will be
829+ ignored.
830+ </description>
831+ <arg name="description" type="string" summary="strip description"/>
832+ <arg name="serial" type="uint" summary="serial of the mode switch event"/>
833+ </request>
834+
835+ <request name="destroy" type="destructor">
836+ <description summary="destroy the strip object">
837+ This destroys the client's resource for this strip object.
838+ </description>
839+ </request>
840+
841+ <enum name="source">
842+ <description summary="strip axis source">
843+ Describes the source types for strip events. This indicates to the
844+ client how a strip event was physically generated; a client may
845+ adjust the user interface accordingly. For example, events
846+ from a "finger" source may trigger kinetic scrolling.
847+ </description>
848+ <entry name="finger" value="1" summary="finger"/>
849+ </enum>
850+
851+ <event name="source">
852+ <description summary="strip event source">
853+ Source information for strip events.
854+
855+ This event does not occur on its own. It is sent before a
856+ zwp_tablet_pad_strip_v2.frame event and carries the source information
857+ for all events within that frame.
858+
859+ The source specifies how this event was generated. If the source is
860+ zwp_tablet_pad_strip_v2.source.finger, a zwp_tablet_pad_strip_v2.stop event
861+ will be sent when the user lifts their finger off the device.
862+
863+ This event is optional. If the source is unknown for an interaction,
864+ no event is sent.
865+ </description>
866+ <arg name="source" type="uint" enum="source" summary="the event source"/>
867+ </event>
868+
869+ <event name="position">
870+ <description summary="position changed">
871+ Sent whenever the position on a strip changes.
872+
873+ The position is normalized to a range of [0, 65535], the 0-value
874+ represents the top-most and/or left-most position of the strip in
875+ the pad's current rotation.
876+ </description>
877+ <arg name="position" type="uint" summary="the current position"/>
878+ </event>
879+
880+ <event name="stop">
881+ <description summary="interaction stopped">
882+ Stop notification for strip events.
883+
884+ For some zwp_tablet_pad_strip_v2.source types, a zwp_tablet_pad_strip_v2.stop
885+ event is sent to notify a client that the interaction with the strip
886+ has terminated. This enables the client to implement kinetic
887+ scrolling. See the zwp_tablet_pad_strip_v2.source documentation for
888+ information on when this event may be generated.
889+
890+ Any zwp_tablet_pad_strip_v2.position events with the same source after this
891+ event should be considered as the start of a new interaction.
892+ </description>
893+ </event>
894+
895+ <event name="frame">
896+ <description summary="end of a strip event sequence">
897+ Indicates the end of a set of events that represent one logical
898+ hardware strip event. A client is expected to accumulate the data
899+ in all events within the frame before proceeding.
900+
901+ All zwp_tablet_pad_strip_v2 events before a zwp_tablet_pad_strip_v2.frame event belong
902+ logically together. For example, on termination of a finger interaction
903+ on a strip the compositor will send a zwp_tablet_pad_strip_v2.source event,
904+ a zwp_tablet_pad_strip_v2.stop event and a zwp_tablet_pad_strip_v2.frame
905+ event.
906+
907+ A zwp_tablet_pad_strip_v2.frame event is sent for every logical event
908+ group, even if the group only contains a single zwp_tablet_pad_strip_v2
909+ event. Specifically, a client may get a sequence: position, frame,
910+ position, frame, etc.
911+ </description>
912+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
913+ </event>
914+ </interface>
915+
916+ <interface name="zwp_tablet_pad_group_v2" version="2">
917+ <description summary="a set of buttons, rings and strips">
918+ A pad group describes a distinct (sub)set of buttons, rings and strips
919+ present in the tablet. The criteria of this grouping is usually positional,
920+ eg. if a tablet has buttons on the left and right side, 2 groups will be
921+ presented. The physical arrangement of groups is undisclosed and may
922+ change on the fly.
923+
924+ Pad groups will announce their features during pad initialization. Between
925+ the corresponding zwp_tablet_pad_v2.group event and zwp_tablet_pad_group_v2.done, the
926+ pad group will announce the buttons, rings and strips contained in it,
927+ plus the number of supported modes.
928+
929+ Modes are a mechanism to allow multiple groups of actions for every element
930+ in the pad group. The number of groups and available modes in each is
931+ persistent across device plugs. The current mode is user-switchable, it
932+ will be announced through the zwp_tablet_pad_group_v2.mode_switch event both
933+ whenever it is switched, and after zwp_tablet_pad_v2.enter.
934+
935+ The current mode logically applies to all elements in the pad group,
936+ although it is at clients' discretion whether to actually perform different
937+ actions, and/or issue the respective .set_feedback requests to notify the
938+ compositor. See the zwp_tablet_pad_group_v2.mode_switch event for more details.
939+ </description>
940+
941+ <request name="destroy" type="destructor">
942+ <description summary="destroy the pad object">
943+ Destroy the zwp_tablet_pad_group_v2 object. Objects created from this object
944+ are unaffected and should be destroyed separately.
945+ </description>
946+ </request>
947+
948+ <event name="buttons">
949+ <description summary="buttons announced">
950+ Sent on zwp_tablet_pad_group_v2 initialization to announce the available
951+ buttons in the group. Button indices start at 0, a button may only be
952+ in one group at a time.
953+
954+ This event is first sent in the initial burst of events before the
955+ zwp_tablet_pad_group_v2.done event.
956+
957+ Some buttons are reserved by the compositor. These buttons may not be
958+ assigned to any zwp_tablet_pad_group_v2. Compositors may broadcast this
959+ event in the case of changes to the mapping of these reserved buttons.
960+ If the compositor happens to reserve all buttons in a group, this event
961+ will be sent with an empty array.
962+ </description>
963+ <arg name="buttons" type="array" summary="buttons in this group"/>
964+ </event>
965+
966+ <event name="ring">
967+ <description summary="ring announced">
968+ Sent on zwp_tablet_pad_group_v2 initialization to announce available rings.
969+ One event is sent for each ring available on this pad group.
970+
971+ This event is sent in the initial burst of events before the
972+ zwp_tablet_pad_group_v2.done event.
973+ </description>
974+ <arg name="ring" type="new_id" interface="zwp_tablet_pad_ring_v2"/>
975+ </event>
976+
977+ <event name="strip">
978+ <description summary="strip announced">
979+ Sent on zwp_tablet_pad_v2 initialization to announce available strips.
980+ One event is sent for each strip available on this pad group.
981+
982+ This event is sent in the initial burst of events before the
983+ zwp_tablet_pad_group_v2.done event.
984+ </description>
985+ <arg name="strip" type="new_id" interface="zwp_tablet_pad_strip_v2"/>
986+ </event>
987+
988+ <event name="modes">
989+ <description summary="mode-switch ability announced">
990+ Sent on zwp_tablet_pad_group_v2 initialization to announce that the pad
991+ group may switch between modes. A client may use a mode to store a
992+ specific configuration for buttons, rings and strips and use the
993+ zwp_tablet_pad_group_v2.mode_switch event to toggle between these
994+ configurations. Mode indices start at 0.
995+
996+ Switching modes is compositor-dependent. See the
997+ zwp_tablet_pad_group_v2.mode_switch event for more details.
998+
999+ This event is sent in the initial burst of events before the
1000+ zwp_tablet_pad_group_v2.done event. This event is only sent when
1001+ more than one mode is available.
1002+ </description>
1003+ <arg name="modes" type="uint" summary="the number of modes"/>
1004+ </event>
1005+
1006+ <event name="done">
1007+ <description summary="tablet group description events sequence complete">
1008+ This event is sent immediately to signal the end of the initial
1009+ burst of descriptive events. A client may consider the static
1010+ description of the tablet to be complete and finalize initialization
1011+ of the tablet group.
1012+ </description>
1013+ </event>
1014+
1015+ <event name="mode_switch">
1016+ <description summary="mode switch event">
1017+ Notification that the mode was switched.
1018+
1019+ A mode applies to all buttons, rings, strips and dials in a group
1020+ simultaneously, but a client is not required to assign different actions
1021+ for each mode. For example, a client may have mode-specific button
1022+ mappings but map the ring to vertical scrolling in all modes. Mode
1023+ indices start at 0.
1024+
1025+ Switching modes is compositor-dependent. The compositor may provide
1026+ visual cues to the user about the mode, e.g. by toggling LEDs on
1027+ the tablet device. Mode-switching may be software-controlled or
1028+ controlled by one or more physical buttons. For example, on a Wacom
1029+ Intuos Pro, the button inside the ring may be assigned to switch
1030+ between modes.
1031+
1032+ The compositor will also send this event after zwp_tablet_pad_v2.enter on
1033+ each group in order to notify of the current mode. Groups that only
1034+ feature one mode will use mode=0 when emitting this event.
1035+
1036+ If a button action in the new mode differs from the action in the
1037+ previous mode, the client should immediately issue a
1038+ zwp_tablet_pad_v2.set_feedback request for each changed button.
1039+
1040+ If a ring, strip or dial action in the new mode differs from the action
1041+ in the previous mode, the client should immediately issue a
1042+ zwp_tablet_ring_v2.set_feedback, zwp_tablet_strip_v2.set_feedback or
1043+ zwp_tablet_dial_v2.set_feedback request for each changed ring, strip or dial.
1044+ </description>
1045+ <arg name="time" type="uint" summary="the time of the event with millisecond granularity"/>
1046+ <arg name="serial" type="uint"/>
1047+ <arg name="mode" type="uint" summary="the new mode of the pad"/>
1048+ </event>
1049+
1050+ <!-- Version 2 additions -->
1051+
1052+ <event name="dial" since="2">
1053+ <description summary="dial announced">
1054+ Sent on zwp_tablet_pad_v2 initialization to announce available dials.
1055+ One event is sent for each dial available on this pad group.
1056+
1057+ This event is sent in the initial burst of events before the
1058+ zwp_tablet_pad_group_v2.done event.
1059+ </description>
1060+ <arg name="dial" type="new_id" interface="zwp_tablet_pad_dial_v2"/>
1061+ </event>
1062+ </interface>
1063+
1064+ <interface name="zwp_tablet_pad_v2" version="2">
1065+ <description summary="a set of buttons, rings, strips and dials">
1066+ A pad device is a set of buttons, rings, strips and dials
1067+ usually physically present on the tablet device itself. Some
1068+ exceptions exist where the pad device is physically detached, e.g. the
1069+ Wacom ExpressKey Remote.
1070+
1071+ Pad devices have no axes that control the cursor and are generally
1072+ auxiliary devices to the tool devices used on the tablet surface.
1073+
1074+ A pad device has a number of static characteristics, e.g. the number
1075+ of rings. These capabilities are sent in an event sequence after the
1076+ zwp_tablet_seat_v2.pad_added event before any actual events from this pad.
1077+ This initial event sequence is terminated by a zwp_tablet_pad_v2.done
1078+ event.
1079+
1080+ All pad features (buttons, rings, strips and dials) are logically divided into
1081+ groups and all pads have at least one group. The available groups are
1082+ notified through the zwp_tablet_pad_v2.group event; the compositor will
1083+ emit one event per group before emitting zwp_tablet_pad_v2.done.
1084+
1085+ Groups may have multiple modes. Modes allow clients to map multiple
1086+ actions to a single pad feature. Only one mode can be active per group,
1087+ although different groups may have different active modes.
1088+ </description>
1089+
1090+ <request name="set_feedback">
1091+ <description summary="set compositor feedback">
1092+ Requests the compositor to use the provided feedback string
1093+ associated with this button. This request should be issued immediately
1094+ after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding
1095+ group is received, or whenever a button is mapped to a different
1096+ action. See zwp_tablet_pad_group_v2.mode_switch for more details.
1097+
1098+ Clients are encouraged to provide context-aware descriptions for
1099+ the actions associated with each button, and compositors may use
1100+ this information to offer visual feedback on the button layout
1101+ (e.g. on-screen displays).
1102+
1103+ Button indices start at 0. Setting the feedback string on a button
1104+ that is reserved by the compositor (i.e. not belonging to any
1105+ zwp_tablet_pad_group_v2) does not generate an error but the compositor
1106+ is free to ignore the request.
1107+
1108+ The provided string 'description' is a UTF-8 encoded string to be
1109+ associated with this ring, and is considered user-visible; general
1110+ internationalization rules apply.
1111+
1112+ The serial argument will be that of the last
1113+ zwp_tablet_pad_group_v2.mode_switch event received for the group of this
1114+ button. Requests providing other serials than the most recent one will
1115+ be ignored.
1116+ </description>
1117+ <arg name="button" type="uint" summary="button index"/>
1118+ <arg name="description" type="string" summary="button description"/>
1119+ <arg name="serial" type="uint" summary="serial of the mode switch event"/>
1120+ </request>
1121+
1122+ <request name="destroy" type="destructor">
1123+ <description summary="destroy the pad object">
1124+ Destroy the zwp_tablet_pad_v2 object. Objects created from this object
1125+ are unaffected and should be destroyed separately.
1126+ </description>
1127+ </request>
1128+
1129+ <event name="group">
1130+ <description summary="group announced">
1131+ Sent on zwp_tablet_pad_v2 initialization to announce available groups.
1132+ One event is sent for each pad group available.
1133+
1134+ This event is sent in the initial burst of events before the
1135+ zwp_tablet_pad_v2.done event. At least one group will be announced.
1136+ </description>
1137+ <arg name="pad_group" type="new_id" interface="zwp_tablet_pad_group_v2"/>
1138+ </event>
1139+
1140+ <event name="path">
1141+ <description summary="path to the device">
1142+ A system-specific device path that indicates which device is behind
1143+ this zwp_tablet_pad_v2. This information may be used to gather additional
1144+ information about the device, e.g. through libwacom.
1145+
1146+ The format of the path is unspecified, it may be a device node, a
1147+ sysfs path, or some other identifier. It is up to the client to
1148+ identify the string provided.
1149+
1150+ This event is sent in the initial burst of events before the
1151+ zwp_tablet_pad_v2.done event.
1152+ </description>
1153+ <arg name="path" type="string" summary="path to local device"/>
1154+ </event>
1155+
1156+ <event name="buttons">
1157+ <description summary="buttons announced">
1158+ Sent on zwp_tablet_pad_v2 initialization to announce the available
1159+ buttons.
1160+
1161+ This event is sent in the initial burst of events before the
1162+ zwp_tablet_pad_v2.done event. This event is only sent when at least one
1163+ button is available.
1164+ </description>
1165+ <arg name="buttons" type="uint" summary="the number of buttons"/>
1166+ </event>
1167+
1168+ <event name="done">
1169+ <description summary="pad description event sequence complete">
1170+ This event signals the end of the initial burst of descriptive
1171+ events. A client may consider the static description of the pad to
1172+ be complete and finalize initialization of the pad.
1173+ </description>
1174+ </event>
1175+
1176+ <enum name="button_state">
1177+ <description summary="physical button state">
1178+ Describes the physical state of a button that caused the button
1179+ event.
1180+ </description>
1181+ <entry name="released" value="0" summary="the button is not pressed"/>
1182+ <entry name="pressed" value="1" summary="the button is pressed"/>
1183+ </enum>
1184+
1185+ <event name="button">
1186+ <description summary="physical button state">
1187+ Sent whenever the physical state of a button changes.
1188+ </description>
1189+ <arg name="time" type="uint" summary="the time of the event with millisecond granularity"/>
1190+ <arg name="button" type="uint" summary="the index of the button that changed state"/>
1191+ <arg name="state" type="uint" enum="button_state"/>
1192+ </event>
1193+
1194+ <event name="enter">
1195+ <description summary="enter event">
1196+ Notification that this pad is focused on the specified surface.
1197+ </description>
1198+ <arg name="serial" type="uint" summary="serial number of the enter event"/>
1199+ <arg name="tablet" type="object" interface="zwp_tablet_v2" summary="the tablet the pad is attached to"/>
1200+ <arg name="surface" type="object" interface="wl_surface" summary="surface the pad is focused on"/>
1201+ </event>
1202+
1203+ <event name="leave">
1204+ <description summary="leave event">
1205+ Notification that this pad is no longer focused on the specified
1206+ surface.
1207+ </description>
1208+ <arg name="serial" type="uint" summary="serial number of the leave event"/>
1209+ <arg name="surface" type="object" interface="wl_surface" summary="surface the pad is no longer focused on"/>
1210+ </event>
1211+
1212+ <event name="removed">
1213+ <description summary="pad removed event">
1214+ Sent when the pad has been removed from the system. When a tablet
1215+ is removed its pad(s) will be removed too.
1216+
1217+ When this event is received, the client must destroy all rings, strips
1218+ and groups that were offered by this pad, and issue zwp_tablet_pad_v2.destroy
1219+ the pad itself.
1220+ </description>
1221+ </event>
1222+ </interface>
1223+
1224+ <interface name="zwp_tablet_pad_dial_v2" version="2">
1225+ <description summary="pad dial">
1226+ A rotary control, e.g. a dial or a wheel.
1227+
1228+ Events on a dial are logically grouped by the zwp_tablet_pad_dial_v2.frame
1229+ event.
1230+ </description>
1231+
1232+ <request name="set_feedback">
1233+ <description summary="set compositor feedback">
1234+ Requests the compositor to use the provided feedback string
1235+ associated with this dial. This request should be issued immediately
1236+ after a zwp_tablet_pad_group_v2.mode_switch event from the corresponding
1237+ group is received, or whenever the dial is mapped to a different
1238+ action. See zwp_tablet_pad_group_v2.mode_switch for more details.
1239+
1240+ Clients are encouraged to provide context-aware descriptions for
1241+ the actions associated with the dial, and compositors may use this
1242+ information to offer visual feedback about the button layout
1243+ (eg. on-screen displays).
1244+
1245+ The provided string 'description' is a UTF-8 encoded string to be
1246+ associated with this ring, and is considered user-visible; general
1247+ internationalization rules apply.
1248+
1249+ The serial argument will be that of the last
1250+ zwp_tablet_pad_group_v2.mode_switch event received for the group of this
1251+ dial. Requests providing other serials than the most recent one will be
1252+ ignored.
1253+ </description>
1254+ <arg name="description" type="string" summary="dial description"/>
1255+ <arg name="serial" type="uint" summary="serial of the mode switch event"/>
1256+ </request>
1257+
1258+ <request name="destroy" type="destructor">
1259+ <description summary="destroy the dial object">
1260+ This destroys the client's resource for this dial object.
1261+ </description>
1262+ </request>
1263+
1264+ <event name="delta">
1265+ <description summary="delta movement">
1266+ Sent whenever the position on a dial changes.
1267+
1268+ This event carries the wheel delta as multiples or fractions
1269+ of 120 with each multiple of 120 representing one logical wheel detent.
1270+ For example, an axis_value120 of 30 is one quarter of
1271+ a logical wheel step in the positive direction, a value120 of
1272+ -240 are two logical wheel steps in the negative direction within the
1273+ same hardware event. See the wl_pointer.axis_value120 for more details.
1274+
1275+ The value120 must not be zero.
1276+ </description>
1277+ <arg name="value120" type="int" summary="rotation distance as fraction of 120"/>
1278+ </event>
1279+
1280+ <event name="frame">
1281+ <description summary="end of a dial event sequence">
1282+ Indicates the end of a set of events that represent one logical
1283+ hardware dial event. A client is expected to accumulate the data
1284+ in all events within the frame before proceeding.
1285+
1286+ All zwp_tablet_pad_dial_v2 events before a zwp_tablet_pad_dial_v2.frame event belong
1287+ logically together.
1288+
1289+ A zwp_tablet_pad_dial_v2.frame event is sent for every logical event
1290+ group, even if the group only contains a single zwp_tablet_pad_dial_v2
1291+ event. Specifically, a client may get a sequence: delta, frame,
1292+ delta, frame, etc.
1293+ </description>
1294+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
1295+ </event>
1296+ </interface>
1297+</protocol>
A protocol/tablet/tablet-v2_generated.go +2302 -0
@@ -0,0 +1,2302 @@
1+// Code generated by wlturbo-scanner. DO NOT EDIT.
2+// Protocol: tablet_v2
3+// Source: tablet-v2.xml
4+
5+package tablet
6+
7+import (
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.
16+const TYPE_PEN = 0x140
17+
18+// TYPE_ERASER is the type eraser value.
19+const TYPE_ERASER = 0x141
20+
21+// TYPE_BRUSH is the type brush value.
22+const TYPE_BRUSH = 0x142
23+
24+// TYPE_PENCIL is the type pencil value.
25+const TYPE_PENCIL = 0x143
26+
27+// TYPE_AIRBRUSH is the type airbrush value.
28+const TYPE_AIRBRUSH = 0x144
29+
30+// TYPE_FINGER is the type finger value.
31+const TYPE_FINGER = 0x145
32+
33+// TYPE_MOUSE is the type mouse value.
34+const TYPE_MOUSE = 0x146
35+
36+// TYPE_LENS is the type lens value.
37+const TYPE_LENS = 0x147
38+
39+// CAPABILITY_TILT is the capability tilt value.
40+const CAPABILITY_TILT = 1
41+
42+// CAPABILITY_PRESSURE is the capability pressure value.
43+const CAPABILITY_PRESSURE = 2
44+
45+// CAPABILITY_DISTANCE is the capability distance value.
46+const CAPABILITY_DISTANCE = 3
47+
48+// CAPABILITY_ROTATION is the capability rotation value.
49+const CAPABILITY_ROTATION = 4
50+
51+// CAPABILITY_SLIDER is the capability slider value.
52+const CAPABILITY_SLIDER = 5
53+
54+// CAPABILITY_WHEEL is the capability wheel value.
55+const CAPABILITY_WHEEL = 6
56+
57+// ZWP_TABLET_TOOL_V2_BUTTON_STATE_RELEASED is the button_state released value.
58+const ZWP_TABLET_TOOL_V2_BUTTON_STATE_RELEASED = 0
59+
60+// ZWP_TABLET_TOOL_V2_BUTTON_STATE_PRESSED is the button_state pressed value.
61+const ZWP_TABLET_TOOL_V2_BUTTON_STATE_PRESSED = 1
62+
63+// ERROR_ROLE is the error role value.
64+const ERROR_ROLE = 0
65+
66+// BUSTYPE_USB is the bustype usb value.
67+const BUSTYPE_USB = 3
68+
69+// BUSTYPE_BLUETOOTH is the bustype bluetooth value.
70+const BUSTYPE_BLUETOOTH = 5
71+
72+// BUSTYPE_VIRTUAL is the bustype virtual value.
73+const BUSTYPE_VIRTUAL = 6
74+
75+// BUSTYPE_SERIAL is the bustype serial value.
76+const BUSTYPE_SERIAL = 17
77+
78+// BUSTYPE_I2C is the bustype i2c value.
79+const BUSTYPE_I2C = 24
80+
81+// ZWP_TABLET_PAD_RING_V2_SOURCE_FINGER is the source finger value.
82+const ZWP_TABLET_PAD_RING_V2_SOURCE_FINGER = 1
83+
84+// ZWP_TABLET_PAD_STRIP_V2_SOURCE_FINGER is the source finger value.
85+const ZWP_TABLET_PAD_STRIP_V2_SOURCE_FINGER = 1
86+
87+// ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED is the button_state released value.
88+const ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED = 0
89+
90+// ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED is the button_state pressed value.
91+const ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED = 1
92+
93+// TabletManagerInterface is the protocol interface name.
94+const TabletManagerInterface = "zwp_tablet_manager_v2"
95+
96+// TabletManager is the generated binding for zwp_tablet_manager_v2 version 2.
97+type TabletManager struct {
98+ wl.BaseProxy
99+}
100+
101+// NewTabletManager returns an unbound TabletManager.
102+func 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.
110+func (o *TabletManager) GetTabletSeat(seat *cross_wl_seat.Seat) (*TabletSeat, error) {
111+ if err := o.Context().CheckProxy(o); err != nil {
112+ return nil, err
113+ }
114+ var arg1 wl.Object
115+ if seat != nil {
116+ arg1 = seat
117+ }
118+ child := &TabletSeat{}
119+ child.SetContext(o.Context())
120+ child.SetID(o.Context().AllocateID())
121+ o.Context().Register(child)
122+ if err := o.Context().SendRequest(o, 0, child, arg1); err != nil {
123+ o.Context().Unregister(child)
124+ return nil, err
125+ }
126+ return child, nil
127+}
128+
129+// Destroy the zwp_tablet_manager_v2 object. Objects created from this object are unaffected and should be destroyed separately.
130+func (o *TabletManager) Destroy() error {
131+ if err := o.Context().CheckProxy(o); err != nil {
132+ return err
133+ }
134+ if err := o.Context().SendDestructor(o, 1); err != nil {
135+ return err
136+ }
137+ return nil
138+}
139+
140+// EventSignature returns the declared event argument types in wire order.
141+func (o *TabletManager) EventSignature(opcode uint16) (string, bool) {
142+ switch opcode {
143+ default:
144+ return "", false
145+ }
146+}
147+
148+// Dispatch decodes one event on zwp_tablet_manager_v2 and calls the registered handlers.
149+func (o *TabletManager) Dispatch(event *wl.Event) {
150+ switch event.Opcode {
151+ default:
152+ }
153+}
154+
155+// TabletSeatInterface is the protocol interface name.
156+const TabletSeatInterface = "zwp_tablet_seat_v2"
157+
158+// TabletSeat is the generated binding for zwp_tablet_seat_v2 version 2.
159+type TabletSeat struct {
160+ wl.BaseProxy
161+ // handlersMu guards the handler slices: a client may register or replace
162+ // handlers while another goroutine dispatches events.
163+ handlersMu sync.Mutex
164+ onTabletAdded []func(idObject *Tablet)
165+ onToolAdded []func(idObject *TabletTool)
166+ onPadAdded []func(idObject *TabletPad)
167+}
168+
169+// NewTabletSeat returns an unbound TabletSeat.
170+func NewTabletSeat(ctx *wl.Context) *TabletSeat {
171+ obj := &TabletSeat{}
172+ obj.SetContext(ctx)
173+ ctx.Register(obj)
174+ return obj
175+}
176+
177+// Destroy the zwp_tablet_seat_v2 object. Objects created from this object are unaffected and should be destroyed separately.
178+func (o *TabletSeat) Destroy() error {
179+ if err := o.Context().CheckProxy(o); err != nil {
180+ return err
181+ }
182+ if err := o.Context().SendDestructor(o, 0); err != nil {
183+ return err
184+ }
185+ return nil
186+}
187+
188+// OnTabletAdded registers a handler for the tablet_added event.
189+//
190+// Handlers are appended, so a second call adds another handler rather than
191+// replacing the first. Registration is safe while another goroutine dispatches.
192+func (o *TabletSeat) OnTabletAdded(handler func(idObject *Tablet)) {
193+ if handler == nil {
194+ return
195+ }
196+ o.handlersMu.Lock()
197+ defer o.handlersMu.Unlock()
198+ o.onTabletAdded = append(o.onTabletAdded, handler)
199+}
200+
201+// handlersForTabletAdded returns the handlers registered for tablet_added, taken
202+// under the lock so a handler may register another handler while events are
203+// being dispatched.
204+func (o *TabletSeat) handlersForTabletAdded() []func(idObject *Tablet) {
205+ o.handlersMu.Lock()
206+ defer o.handlersMu.Unlock()
207+ return o.onTabletAdded
208+}
209+
210+// OnToolAdded registers a handler for the tool_added event.
211+//
212+// Handlers are appended, so a second call adds another handler rather than
213+// replacing the first. Registration is safe while another goroutine dispatches.
214+func (o *TabletSeat) OnToolAdded(handler func(idObject *TabletTool)) {
215+ if handler == nil {
216+ return
217+ }
218+ o.handlersMu.Lock()
219+ defer o.handlersMu.Unlock()
220+ o.onToolAdded = append(o.onToolAdded, handler)
221+}
222+
223+// handlersForToolAdded returns the handlers registered for tool_added, taken
224+// under the lock so a handler may register another handler while events are
225+// being dispatched.
226+func (o *TabletSeat) handlersForToolAdded() []func(idObject *TabletTool) {
227+ o.handlersMu.Lock()
228+ defer o.handlersMu.Unlock()
229+ return o.onToolAdded
230+}
231+
232+// OnPadAdded registers a handler for the pad_added event.
233+//
234+// Handlers are appended, so a second call adds another handler rather than
235+// replacing the first. Registration is safe while another goroutine dispatches.
236+func (o *TabletSeat) OnPadAdded(handler func(idObject *TabletPad)) {
237+ if handler == nil {
238+ return
239+ }
240+ o.handlersMu.Lock()
241+ defer o.handlersMu.Unlock()
242+ o.onPadAdded = append(o.onPadAdded, handler)
243+}
244+
245+// handlersForPadAdded returns the handlers registered for pad_added, taken
246+// under the lock so a handler may register another handler while events are
247+// being dispatched.
248+func (o *TabletSeat) handlersForPadAdded() []func(idObject *TabletPad) {
249+ o.handlersMu.Lock()
250+ defer o.handlersMu.Unlock()
251+ return o.onPadAdded
252+}
253+
254+// EventSignature returns the declared event argument types in wire order.
255+func (o *TabletSeat) EventSignature(opcode uint16) (string, bool) {
256+ switch opcode {
257+ case 0:
258+ return "new_id,", true
259+ case 1:
260+ return "new_id,", true
261+ case 2:
262+ return "new_id,", true
263+ default:
264+ return "", false
265+ }
266+}
267+
268+// Dispatch decodes one event on zwp_tablet_seat_v2 and calls the registered handlers.
269+func (o *TabletSeat) Dispatch(event *wl.Event) {
270+ switch event.Opcode {
271+ case 0: // tablet_added
272+ idID := event.Uint32()
273+ idObject := &Tablet{}
274+ idObject.SetContext(o.Context())
275+ idObject.SetID(idID)
276+ o.Context().Register(idObject)
277+
278+ for i, handler := range o.handlersForTabletAdded() {
279+ _ = i
280+ handler(idObject)
281+ }
282+ case 1: // tool_added
283+ idID := event.Uint32()
284+ idObject := &TabletTool{}
285+ idObject.SetContext(o.Context())
286+ idObject.SetID(idID)
287+ o.Context().Register(idObject)
288+
289+ for i, handler := range o.handlersForToolAdded() {
290+ _ = i
291+ handler(idObject)
292+ }
293+ case 2: // pad_added
294+ idID := event.Uint32()
295+ idObject := &TabletPad{}
296+ idObject.SetContext(o.Context())
297+ idObject.SetID(idID)
298+ o.Context().Register(idObject)
299+
300+ for i, handler := range o.handlersForPadAdded() {
301+ _ = i
302+ handler(idObject)
303+ }
304+ default:
305+ }
306+}
307+
308+// TabletToolInterface is the protocol interface name.
309+const TabletToolInterface = "zwp_tablet_tool_v2"
310+
311+// TabletTool is the generated binding for zwp_tablet_tool_v2 version 2.
312+type TabletTool struct {
313+ wl.BaseProxy
314+ // handlersMu guards the handler slices: a client may register or replace
315+ // handlers while another goroutine dispatches events.
316+ handlersMu sync.Mutex
317+ onType []func(toolType uint32)
318+ onHardwareSerial []func(hardwareSerialHi uint32, hardwareSerialLo uint32)
319+ onHardwareIdWacom []func(hardwareIdHi uint32, hardwareIdLo uint32)
320+ onCapability []func(capability uint32)
321+ onDone []func()
322+ onRemoved []func()
323+ onProximityIn []func(serial uint32, tabletID uint32, surfaceID uint32)
324+ onProximityOut []func()
325+ onDown []func(serial uint32)
326+ onUp []func()
327+ onMotion []func(x wl.Fixed, y wl.Fixed)
328+ onPressure []func(pressure uint32)
329+ onDistance []func(distance uint32)
330+ onTilt []func(tiltX wl.Fixed, tiltY wl.Fixed)
331+ onRotation []func(degrees wl.Fixed)
332+ onSlider []func(position int32)
333+ onWheel []func(degrees wl.Fixed, clicks int32)
334+ onButton []func(serial uint32, button uint32, state uint32)
335+ onFrame []func(time uint32)
336+}
337+
338+// NewTabletTool returns an unbound TabletTool.
339+func NewTabletTool(ctx *wl.Context) *TabletTool {
340+ obj := &TabletTool{}
341+ obj.SetContext(ctx)
342+ ctx.Register(obj)
343+ return obj
344+}
345+
346+// 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.
347+func (o *TabletTool) SetCursor(serial uint32, surface *cross_wl_surface.Surface, hotspotX int32, hotspotY int32) error {
348+ if err := o.Context().CheckProxy(o); err != nil {
349+ return err
350+ }
351+ var arg1 wl.Object
352+ if surface != nil {
353+ arg1 = surface
354+ }
355+ if err := o.Context().SendRequest(o, 0, serial, arg1, hotspotX, hotspotY); err != nil {
356+ return err
357+ }
358+ return nil
359+}
360+
361+// This destroys the client's resource for this tool object.
362+func (o *TabletTool) Destroy() error {
363+ if err := o.Context().CheckProxy(o); err != nil {
364+ return err
365+ }
366+ if err := o.Context().SendDestructor(o, 1); err != nil {
367+ return err
368+ }
369+ return nil
370+}
371+
372+// OnType registers a handler for the type event.
373+//
374+// Handlers are appended, so a second call adds another handler rather than
375+// replacing the first. Registration is safe while another goroutine dispatches.
376+func (o *TabletTool) OnType(handler func(toolType uint32)) {
377+ if handler == nil {
378+ return
379+ }
380+ o.handlersMu.Lock()
381+ defer o.handlersMu.Unlock()
382+ o.onType = append(o.onType, handler)
383+}
384+
385+// handlersForType returns the handlers registered for type, taken
386+// under the lock so a handler may register another handler while events are
387+// being dispatched.
388+func (o *TabletTool) handlersForType() []func(toolType uint32) {
389+ o.handlersMu.Lock()
390+ defer o.handlersMu.Unlock()
391+ return o.onType
392+}
393+
394+// OnHardwareSerial registers a handler for the hardware_serial event.
395+//
396+// Handlers are appended, so a second call adds another handler rather than
397+// replacing the first. Registration is safe while another goroutine dispatches.
398+func (o *TabletTool) OnHardwareSerial(handler func(hardwareSerialHi uint32, hardwareSerialLo uint32)) {
399+ if handler == nil {
400+ return
401+ }
402+ o.handlersMu.Lock()
403+ defer o.handlersMu.Unlock()
404+ o.onHardwareSerial = append(o.onHardwareSerial, handler)
405+}
406+
407+// handlersForHardwareSerial returns the handlers registered for hardware_serial, taken
408+// under the lock so a handler may register another handler while events are
409+// being dispatched.
410+func (o *TabletTool) handlersForHardwareSerial() []func(hardwareSerialHi uint32, hardwareSerialLo uint32) {
411+ o.handlersMu.Lock()
412+ defer o.handlersMu.Unlock()
413+ return o.onHardwareSerial
414+}
415+
416+// OnHardwareIdWacom registers a handler for the hardware_id_wacom event.
417+//
418+// Handlers are appended, so a second call adds another handler rather than
419+// replacing the first. Registration is safe while another goroutine dispatches.
420+func (o *TabletTool) OnHardwareIdWacom(handler func(hardwareIdHi uint32, hardwareIdLo uint32)) {
421+ if handler == nil {
422+ return
423+ }
424+ o.handlersMu.Lock()
425+ defer o.handlersMu.Unlock()
426+ o.onHardwareIdWacom = append(o.onHardwareIdWacom, handler)
427+}
428+
429+// handlersForHardwareIdWacom returns the handlers registered for hardware_id_wacom, taken
430+// under the lock so a handler may register another handler while events are
431+// being dispatched.
432+func (o *TabletTool) handlersForHardwareIdWacom() []func(hardwareIdHi uint32, hardwareIdLo uint32) {
433+ o.handlersMu.Lock()
434+ defer o.handlersMu.Unlock()
435+ return o.onHardwareIdWacom
436+}
437+
438+// OnCapability registers a handler for the capability event.
439+//
440+// Handlers are appended, so a second call adds another handler rather than
441+// replacing the first. Registration is safe while another goroutine dispatches.
442+func (o *TabletTool) OnCapability(handler func(capability uint32)) {
443+ if handler == nil {
444+ return
445+ }
446+ o.handlersMu.Lock()
447+ defer o.handlersMu.Unlock()
448+ o.onCapability = append(o.onCapability, handler)
449+}
450+
451+// handlersForCapability returns the handlers registered for capability, taken
452+// under the lock so a handler may register another handler while events are
453+// being dispatched.
454+func (o *TabletTool) handlersForCapability() []func(capability uint32) {
455+ o.handlersMu.Lock()
456+ defer o.handlersMu.Unlock()
457+ return o.onCapability
458+}
459+
460+// OnDone registers a handler for the done event.
461+//
462+// Handlers are appended, so a second call adds another handler rather than
463+// replacing the first. Registration is safe while another goroutine dispatches.
464+func (o *TabletTool) OnDone(handler func()) {
465+ if handler == nil {
466+ return
467+ }
468+ o.handlersMu.Lock()
469+ defer o.handlersMu.Unlock()
470+ o.onDone = append(o.onDone, handler)
471+}
472+
473+// handlersForDone returns the handlers registered for done, taken
474+// under the lock so a handler may register another handler while events are
475+// being dispatched.
476+func (o *TabletTool) handlersForDone() []func() {
477+ o.handlersMu.Lock()
478+ defer o.handlersMu.Unlock()
479+ return o.onDone
480+}
481+
482+// OnRemoved registers a handler for the removed event.
483+//
484+// Handlers are appended, so a second call adds another handler rather than
485+// replacing the first. Registration is safe while another goroutine dispatches.
486+func (o *TabletTool) OnRemoved(handler func()) {
487+ if handler == nil {
488+ return
489+ }
490+ o.handlersMu.Lock()
491+ defer o.handlersMu.Unlock()
492+ o.onRemoved = append(o.onRemoved, handler)
493+}
494+
495+// handlersForRemoved returns the handlers registered for removed, taken
496+// under the lock so a handler may register another handler while events are
497+// being dispatched.
498+func (o *TabletTool) handlersForRemoved() []func() {
499+ o.handlersMu.Lock()
500+ defer o.handlersMu.Unlock()
501+ return o.onRemoved
502+}
503+
504+// OnProximityIn registers a handler for the proximity_in event.
505+//
506+// Handlers are appended, so a second call adds another handler rather than
507+// replacing the first. Registration is safe while another goroutine dispatches.
508+func (o *TabletTool) OnProximityIn(handler func(serial uint32, tabletID uint32, surfaceID uint32)) {
509+ if handler == nil {
510+ return
511+ }
512+ o.handlersMu.Lock()
513+ defer o.handlersMu.Unlock()
514+ o.onProximityIn = append(o.onProximityIn, handler)
515+}
516+
517+// handlersForProximityIn returns the handlers registered for proximity_in, taken
518+// under the lock so a handler may register another handler while events are
519+// being dispatched.
520+func (o *TabletTool) handlersForProximityIn() []func(serial uint32, tabletID uint32, surfaceID uint32) {
521+ o.handlersMu.Lock()
522+ defer o.handlersMu.Unlock()
523+ return o.onProximityIn
524+}
525+
526+// OnProximityOut registers a handler for the proximity_out event.
527+//
528+// Handlers are appended, so a second call adds another handler rather than
529+// replacing the first. Registration is safe while another goroutine dispatches.
530+func (o *TabletTool) OnProximityOut(handler func()) {
531+ if handler == nil {
532+ return
533+ }
534+ o.handlersMu.Lock()
535+ defer o.handlersMu.Unlock()
536+ o.onProximityOut = append(o.onProximityOut, handler)
537+}
538+
539+// handlersForProximityOut returns the handlers registered for proximity_out, taken
540+// under the lock so a handler may register another handler while events are
541+// being dispatched.
542+func (o *TabletTool) handlersForProximityOut() []func() {
543+ o.handlersMu.Lock()
544+ defer o.handlersMu.Unlock()
545+ return o.onProximityOut
546+}
547+
548+// OnDown registers a handler for the down event.
549+//
550+// Handlers are appended, so a second call adds another handler rather than
551+// replacing the first. Registration is safe while another goroutine dispatches.
552+func (o *TabletTool) OnDown(handler func(serial uint32)) {
553+ if handler == nil {
554+ return
555+ }
556+ o.handlersMu.Lock()
557+ defer o.handlersMu.Unlock()
558+ o.onDown = append(o.onDown, handler)
559+}
560+
561+// handlersForDown returns the handlers registered for down, taken
562+// under the lock so a handler may register another handler while events are
563+// being dispatched.
564+func (o *TabletTool) handlersForDown() []func(serial uint32) {
565+ o.handlersMu.Lock()
566+ defer o.handlersMu.Unlock()
567+ return o.onDown
568+}
569+
570+// OnUp registers a handler for the up event.
571+//
572+// Handlers are appended, so a second call adds another handler rather than
573+// replacing the first. Registration is safe while another goroutine dispatches.
574+func (o *TabletTool) OnUp(handler func()) {
575+ if handler == nil {
576+ return
577+ }
578+ o.handlersMu.Lock()
579+ defer o.handlersMu.Unlock()
580+ o.onUp = append(o.onUp, handler)
581+}
582+
583+// handlersForUp returns the handlers registered for up, taken
584+// under the lock so a handler may register another handler while events are
585+// being dispatched.
586+func (o *TabletTool) handlersForUp() []func() {
587+ o.handlersMu.Lock()
588+ defer o.handlersMu.Unlock()
589+ return o.onUp
590+}
591+
592+// OnMotion registers a handler for the motion event.
593+//
594+// Handlers are appended, so a second call adds another handler rather than
595+// replacing the first. Registration is safe while another goroutine dispatches.
596+func (o *TabletTool) OnMotion(handler func(x wl.Fixed, y wl.Fixed)) {
597+ if handler == nil {
598+ return
599+ }
600+ o.handlersMu.Lock()
601+ defer o.handlersMu.Unlock()
602+ o.onMotion = append(o.onMotion, handler)
603+}
604+
605+// handlersForMotion returns the handlers registered for motion, taken
606+// under the lock so a handler may register another handler while events are
607+// being dispatched.
608+func (o *TabletTool) handlersForMotion() []func(x wl.Fixed, y wl.Fixed) {
609+ o.handlersMu.Lock()
610+ defer o.handlersMu.Unlock()
611+ return o.onMotion
612+}
613+
614+// OnPressure registers a handler for the pressure event.
615+//
616+// Handlers are appended, so a second call adds another handler rather than
617+// replacing the first. Registration is safe while another goroutine dispatches.
618+func (o *TabletTool) OnPressure(handler func(pressure uint32)) {
619+ if handler == nil {
620+ return
621+ }
622+ o.handlersMu.Lock()
623+ defer o.handlersMu.Unlock()
624+ o.onPressure = append(o.onPressure, handler)
625+}
626+
627+// handlersForPressure returns the handlers registered for pressure, taken
628+// under the lock so a handler may register another handler while events are
629+// being dispatched.
630+func (o *TabletTool) handlersForPressure() []func(pressure uint32) {
631+ o.handlersMu.Lock()
632+ defer o.handlersMu.Unlock()
633+ return o.onPressure
634+}
635+
636+// OnDistance registers a handler for the distance event.
637+//
638+// Handlers are appended, so a second call adds another handler rather than
639+// replacing the first. Registration is safe while another goroutine dispatches.
640+func (o *TabletTool) OnDistance(handler func(distance uint32)) {
641+ if handler == nil {
642+ return
643+ }
644+ o.handlersMu.Lock()
645+ defer o.handlersMu.Unlock()
646+ o.onDistance = append(o.onDistance, handler)
647+}
648+
649+// handlersForDistance returns the handlers registered for distance, taken
650+// under the lock so a handler may register another handler while events are
651+// being dispatched.
652+func (o *TabletTool) handlersForDistance() []func(distance uint32) {
653+ o.handlersMu.Lock()
654+ defer o.handlersMu.Unlock()
655+ return o.onDistance
656+}
657+
658+// OnTilt registers a handler for the tilt event.
659+//
660+// Handlers are appended, so a second call adds another handler rather than
661+// replacing the first. Registration is safe while another goroutine dispatches.
662+func (o *TabletTool) OnTilt(handler func(tiltX wl.Fixed, tiltY wl.Fixed)) {
663+ if handler == nil {
664+ return
665+ }
666+ o.handlersMu.Lock()
667+ defer o.handlersMu.Unlock()
668+ o.onTilt = append(o.onTilt, handler)
669+}
670+
671+// handlersForTilt returns the handlers registered for tilt, taken
672+// under the lock so a handler may register another handler while events are
673+// being dispatched.
674+func (o *TabletTool) handlersForTilt() []func(tiltX wl.Fixed, tiltY wl.Fixed) {
675+ o.handlersMu.Lock()
676+ defer o.handlersMu.Unlock()
677+ return o.onTilt
678+}
679+
680+// OnRotation registers a handler for the rotation event.
681+//
682+// Handlers are appended, so a second call adds another handler rather than
683+// replacing the first. Registration is safe while another goroutine dispatches.
684+func (o *TabletTool) OnRotation(handler func(degrees wl.Fixed)) {
685+ if handler == nil {
686+ return
687+ }
688+ o.handlersMu.Lock()
689+ defer o.handlersMu.Unlock()
690+ o.onRotation = append(o.onRotation, handler)
691+}
692+
693+// handlersForRotation returns the handlers registered for rotation, taken
694+// under the lock so a handler may register another handler while events are
695+// being dispatched.
696+func (o *TabletTool) handlersForRotation() []func(degrees wl.Fixed) {
697+ o.handlersMu.Lock()
698+ defer o.handlersMu.Unlock()
699+ return o.onRotation
700+}
701+
702+// OnSlider registers a handler for the slider event.
703+//
704+// Handlers are appended, so a second call adds another handler rather than
705+// replacing the first. Registration is safe while another goroutine dispatches.
706+func (o *TabletTool) OnSlider(handler func(position int32)) {
707+ if handler == nil {
708+ return
709+ }
710+ o.handlersMu.Lock()
711+ defer o.handlersMu.Unlock()
712+ o.onSlider = append(o.onSlider, handler)
713+}
714+
715+// handlersForSlider returns the handlers registered for slider, taken
716+// under the lock so a handler may register another handler while events are
717+// being dispatched.
718+func (o *TabletTool) handlersForSlider() []func(position int32) {
719+ o.handlersMu.Lock()
720+ defer o.handlersMu.Unlock()
721+ return o.onSlider
722+}
723+
724+// OnWheel registers a handler for the wheel event.
725+//
726+// Handlers are appended, so a second call adds another handler rather than
727+// replacing the first. Registration is safe while another goroutine dispatches.
728+func (o *TabletTool) OnWheel(handler func(degrees wl.Fixed, clicks int32)) {
729+ if handler == nil {
730+ return
731+ }
732+ o.handlersMu.Lock()
733+ defer o.handlersMu.Unlock()
734+ o.onWheel = append(o.onWheel, handler)
735+}
736+
737+// handlersForWheel returns the handlers registered for wheel, taken
738+// under the lock so a handler may register another handler while events are
739+// being dispatched.
740+func (o *TabletTool) handlersForWheel() []func(degrees wl.Fixed, clicks int32) {
741+ o.handlersMu.Lock()
742+ defer o.handlersMu.Unlock()
743+ return o.onWheel
744+}
745+
746+// OnButton registers a handler for the button event.
747+//
748+// Handlers are appended, so a second call adds another handler rather than
749+// replacing the first. Registration is safe while another goroutine dispatches.
750+func (o *TabletTool) OnButton(handler func(serial uint32, button uint32, state uint32)) {
751+ if handler == nil {
752+ return
753+ }
754+ o.handlersMu.Lock()
755+ defer o.handlersMu.Unlock()
756+ o.onButton = append(o.onButton, handler)
757+}
758+
759+// handlersForButton returns the handlers registered for button, taken
760+// under the lock so a handler may register another handler while events are
761+// being dispatched.
762+func (o *TabletTool) handlersForButton() []func(serial uint32, button uint32, state uint32) {
763+ o.handlersMu.Lock()
764+ defer o.handlersMu.Unlock()
765+ return o.onButton
766+}
767+
768+// OnFrame registers a handler for the frame event.
769+//
770+// Handlers are appended, so a second call adds another handler rather than
771+// replacing the first. Registration is safe while another goroutine dispatches.
772+func (o *TabletTool) OnFrame(handler func(time uint32)) {
773+ if handler == nil {
774+ return
775+ }
776+ o.handlersMu.Lock()
777+ defer o.handlersMu.Unlock()
778+ o.onFrame = append(o.onFrame, handler)
779+}
780+
781+// handlersForFrame returns the handlers registered for frame, taken
782+// under the lock so a handler may register another handler while events are
783+// being dispatched.
784+func (o *TabletTool) handlersForFrame() []func(time uint32) {
785+ o.handlersMu.Lock()
786+ defer o.handlersMu.Unlock()
787+ return o.onFrame
788+}
789+
790+// EventSignature returns the declared event argument types in wire order.
791+func (o *TabletTool) EventSignature(opcode uint16) (string, bool) {
792+ switch opcode {
793+ case 0:
794+ return "uint,", true
795+ case 1:
796+ return "uint,uint,", true
797+ case 2:
798+ return "uint,uint,", true
799+ case 3:
800+ return "uint,", true
801+ case 4:
802+ return "", true
803+ case 5:
804+ return "", true
805+ case 6:
806+ return "uint,object,object,", true
807+ case 7:
808+ return "", true
809+ case 8:
810+ return "uint,", true
811+ case 9:
812+ return "", true
813+ case 10:
814+ return "fixed,fixed,", true
815+ case 11:
816+ return "uint,", true
817+ case 12:
818+ return "uint,", true
819+ case 13:
820+ return "fixed,fixed,", true
821+ case 14:
822+ return "fixed,", true
823+ case 15:
824+ return "int,", true
825+ case 16:
826+ return "fixed,int,", true
827+ case 17:
828+ return "uint,uint,uint,", true
829+ case 18:
830+ return "uint,", true
831+ default:
832+ return "", false
833+ }
834+}
835+
836+// Dispatch decodes one event on zwp_tablet_tool_v2 and calls the registered handlers.
837+func (o *TabletTool) Dispatch(event *wl.Event) {
838+ switch event.Opcode {
839+ case 0: // type
840+ toolType := event.Uint32()
841+
842+ for i, handler := range o.handlersForType() {
843+ _ = i
844+ handler(toolType)
845+ }
846+ case 1: // hardware_serial
847+ hardwareSerialHi := event.Uint32()
848+ hardwareSerialLo := event.Uint32()
849+
850+ for i, handler := range o.handlersForHardwareSerial() {
851+ _ = i
852+ handler(hardwareSerialHi, hardwareSerialLo)
853+ }
854+ case 2: // hardware_id_wacom
855+ hardwareIdHi := event.Uint32()
856+ hardwareIdLo := event.Uint32()
857+
858+ for i, handler := range o.handlersForHardwareIdWacom() {
859+ _ = i
860+ handler(hardwareIdHi, hardwareIdLo)
861+ }
862+ case 3: // capability
863+ capability := event.Uint32()
864+
865+ for i, handler := range o.handlersForCapability() {
866+ _ = i
867+ handler(capability)
868+ }
869+ case 4: // done
870+
871+ for i, handler := range o.handlersForDone() {
872+ _ = i
873+ handler()
874+ }
875+ case 5: // removed
876+
877+ for i, handler := range o.handlersForRemoved() {
878+ _ = i
879+ handler()
880+ }
881+ case 6: // proximity_in
882+ serial := event.Uint32()
883+ tabletID := event.Uint32()
884+ surfaceID := event.Uint32()
885+
886+ for i, handler := range o.handlersForProximityIn() {
887+ _ = i
888+ handler(serial, tabletID, surfaceID)
889+ }
890+ case 7: // proximity_out
891+
892+ for i, handler := range o.handlersForProximityOut() {
893+ _ = i
894+ handler()
895+ }
896+ case 8: // down
897+ serial := event.Uint32()
898+
899+ for i, handler := range o.handlersForDown() {
900+ _ = i
901+ handler(serial)
902+ }
903+ case 9: // up
904+
905+ for i, handler := range o.handlersForUp() {
906+ _ = i
907+ handler()
908+ }
909+ case 10: // motion
910+ x := event.Fixed()
911+ y := event.Fixed()
912+
913+ for i, handler := range o.handlersForMotion() {
914+ _ = i
915+ handler(x, y)
916+ }
917+ case 11: // pressure
918+ pressure := event.Uint32()
919+
920+ for i, handler := range o.handlersForPressure() {
921+ _ = i
922+ handler(pressure)
923+ }
924+ case 12: // distance
925+ distance := event.Uint32()
926+
927+ for i, handler := range o.handlersForDistance() {
928+ _ = i
929+ handler(distance)
930+ }
931+ case 13: // tilt
932+ tiltX := event.Fixed()
933+ tiltY := event.Fixed()
934+
935+ for i, handler := range o.handlersForTilt() {
936+ _ = i
937+ handler(tiltX, tiltY)
938+ }
939+ case 14: // rotation
940+ degrees := event.Fixed()
941+
942+ for i, handler := range o.handlersForRotation() {
943+ _ = i
944+ handler(degrees)
945+ }
946+ case 15: // slider
947+ position := event.Int32()
948+
949+ for i, handler := range o.handlersForSlider() {
950+ _ = i
951+ handler(position)
952+ }
953+ case 16: // wheel
954+ degrees := event.Fixed()
955+ clicks := event.Int32()
956+
957+ for i, handler := range o.handlersForWheel() {
958+ _ = i
959+ handler(degrees, clicks)
960+ }
961+ case 17: // button
962+ serial := event.Uint32()
963+ button := event.Uint32()
964+ state := event.Uint32()
965+
966+ for i, handler := range o.handlersForButton() {
967+ _ = i
968+ handler(serial, button, state)
969+ }
970+ case 18: // frame
971+ time := event.Uint32()
972+
973+ for i, handler := range o.handlersForFrame() {
974+ _ = i
975+ handler(time)
976+ }
977+ default:
978+ }
979+}
980+
981+// TabletInterface is the protocol interface name.
982+const TabletInterface = "zwp_tablet_v2"
983+
984+// Tablet is the generated binding for zwp_tablet_v2 version 2.
985+type Tablet struct {
986+ wl.BaseProxy
987+ // handlersMu guards the handler slices: a client may register or replace
988+ // handlers while another goroutine dispatches events.
989+ handlersMu sync.Mutex
990+ onName []func(name string)
991+ onId []func(vid uint32, pid uint32)
992+ onPath []func(path string)
993+ onDone []func()
994+ onRemoved []func()
995+ onBustype []func(bustype uint32)
996+}
997+
998+// NewTablet returns an unbound Tablet.
999+func NewTablet(ctx *wl.Context) *Tablet {
1000+ obj := &Tablet{}
1001+ obj.SetContext(ctx)
1002+ ctx.Register(obj)
1003+ return obj
1004+}
1005+
1006+// This destroys the client's resource for this tablet object.
1007+func (o *Tablet) Destroy() error {
1008+ if err := o.Context().CheckProxy(o); err != nil {
1009+ return err
1010+ }
1011+ if err := o.Context().SendDestructor(o, 0); err != nil {
1012+ return err
1013+ }
1014+ return nil
1015+}
1016+
1017+// OnName registers a handler for the name event.
1018+//
1019+// Handlers are appended, so a second call adds another handler rather than
1020+// replacing the first. Registration is safe while another goroutine dispatches.
1021+func (o *Tablet) OnName(handler func(name string)) {
1022+ if handler == nil {
1023+ return
1024+ }
1025+ o.handlersMu.Lock()
1026+ defer o.handlersMu.Unlock()
1027+ o.onName = append(o.onName, handler)
1028+}
1029+
1030+// handlersForName returns the handlers registered for name, taken
1031+// under the lock so a handler may register another handler while events are
1032+// being dispatched.
1033+func (o *Tablet) handlersForName() []func(name string) {
1034+ o.handlersMu.Lock()
1035+ defer o.handlersMu.Unlock()
1036+ return o.onName
1037+}
1038+
1039+// OnId registers a handler for the id event.
1040+//
1041+// Handlers are appended, so a second call adds another handler rather than
1042+// replacing the first. Registration is safe while another goroutine dispatches.
1043+func (o *Tablet) OnId(handler func(vid uint32, pid uint32)) {
1044+ if handler == nil {
1045+ return
1046+ }
1047+ o.handlersMu.Lock()
1048+ defer o.handlersMu.Unlock()
1049+ o.onId = append(o.onId, handler)
1050+}
1051+
1052+// handlersForId returns the handlers registered for id, taken
1053+// under the lock so a handler may register another handler while events are
1054+// being dispatched.
1055+func (o *Tablet) handlersForId() []func(vid uint32, pid uint32) {
1056+ o.handlersMu.Lock()
1057+ defer o.handlersMu.Unlock()
1058+ return o.onId
1059+}
1060+
1061+// OnPath registers a handler for the path event.
1062+//
1063+// Handlers are appended, so a second call adds another handler rather than
1064+// replacing the first. Registration is safe while another goroutine dispatches.
1065+func (o *Tablet) OnPath(handler func(path string)) {
1066+ if handler == nil {
1067+ return
1068+ }
1069+ o.handlersMu.Lock()
1070+ defer o.handlersMu.Unlock()
1071+ o.onPath = append(o.onPath, handler)
1072+}
1073+
1074+// handlersForPath returns the handlers registered for path, taken
1075+// under the lock so a handler may register another handler while events are
1076+// being dispatched.
1077+func (o *Tablet) handlersForPath() []func(path string) {
1078+ o.handlersMu.Lock()
1079+ defer o.handlersMu.Unlock()
1080+ return o.onPath
1081+}
1082+
1083+// OnDone registers a handler for the done event.
1084+//
1085+// Handlers are appended, so a second call adds another handler rather than
1086+// replacing the first. Registration is safe while another goroutine dispatches.
1087+func (o *Tablet) OnDone(handler func()) {
1088+ if handler == nil {
1089+ return
1090+ }
1091+ o.handlersMu.Lock()
1092+ defer o.handlersMu.Unlock()
1093+ o.onDone = append(o.onDone, handler)
1094+}
1095+
1096+// handlersForDone returns the handlers registered for done, taken
1097+// under the lock so a handler may register another handler while events are
1098+// being dispatched.
1099+func (o *Tablet) handlersForDone() []func() {
1100+ o.handlersMu.Lock()
1101+ defer o.handlersMu.Unlock()
1102+ return o.onDone
1103+}
1104+
1105+// OnRemoved registers a handler for the removed event.
1106+//
1107+// Handlers are appended, so a second call adds another handler rather than
1108+// replacing the first. Registration is safe while another goroutine dispatches.
1109+func (o *Tablet) OnRemoved(handler func()) {
1110+ if handler == nil {
1111+ return
1112+ }
1113+ o.handlersMu.Lock()
1114+ defer o.handlersMu.Unlock()
1115+ o.onRemoved = append(o.onRemoved, handler)
1116+}
1117+
1118+// handlersForRemoved returns the handlers registered for removed, taken
1119+// under the lock so a handler may register another handler while events are
1120+// being dispatched.
1121+func (o *Tablet) handlersForRemoved() []func() {
1122+ o.handlersMu.Lock()
1123+ defer o.handlersMu.Unlock()
1124+ return o.onRemoved
1125+}
1126+
1127+// OnBustype registers a handler for the bustype event.
1128+//
1129+// Handlers are appended, so a second call adds another handler rather than
1130+// replacing the first. Registration is safe while another goroutine dispatches.
1131+func (o *Tablet) OnBustype(handler func(bustype uint32)) {
1132+ if handler == nil {
1133+ return
1134+ }
1135+ o.handlersMu.Lock()
1136+ defer o.handlersMu.Unlock()
1137+ o.onBustype = append(o.onBustype, handler)
1138+}
1139+
1140+// handlersForBustype returns the handlers registered for bustype, taken
1141+// under the lock so a handler may register another handler while events are
1142+// being dispatched.
1143+func (o *Tablet) handlersForBustype() []func(bustype uint32) {
1144+ o.handlersMu.Lock()
1145+ defer o.handlersMu.Unlock()
1146+ return o.onBustype
1147+}
1148+
1149+// EventSignature returns the declared event argument types in wire order.
1150+func (o *Tablet) EventSignature(opcode uint16) (string, bool) {
1151+ switch opcode {
1152+ case 0:
1153+ return "string,", true
1154+ case 1:
1155+ return "uint,uint,", true
1156+ case 2:
1157+ return "string,", true
1158+ case 3:
1159+ return "", true
1160+ case 4:
1161+ return "", true
1162+ case 5:
1163+ return "uint,", true
1164+ default:
1165+ return "", false
1166+ }
1167+}
1168+
1169+// Dispatch decodes one event on zwp_tablet_v2 and calls the registered handlers.
1170+func (o *Tablet) Dispatch(event *wl.Event) {
1171+ switch event.Opcode {
1172+ case 0: // name
1173+ name := event.String()
1174+
1175+ for i, handler := range o.handlersForName() {
1176+ _ = i
1177+ handler(name)
1178+ }
1179+ case 1: // id
1180+ vid := event.Uint32()
1181+ pid := event.Uint32()
1182+
1183+ for i, handler := range o.handlersForId() {
1184+ _ = i
1185+ handler(vid, pid)
1186+ }
1187+ case 2: // path
1188+ path := event.String()
1189+
1190+ for i, handler := range o.handlersForPath() {
1191+ _ = i
1192+ handler(path)
1193+ }
1194+ case 3: // done
1195+
1196+ for i, handler := range o.handlersForDone() {
1197+ _ = i
1198+ handler()
1199+ }
1200+ case 4: // removed
1201+
1202+ for i, handler := range o.handlersForRemoved() {
1203+ _ = i
1204+ handler()
1205+ }
1206+ case 5: // bustype
1207+ bustype := event.Uint32()
1208+
1209+ for i, handler := range o.handlersForBustype() {
1210+ _ = i
1211+ handler(bustype)
1212+ }
1213+ default:
1214+ }
1215+}
1216+
1217+// TabletPadRingInterface is the protocol interface name.
1218+const TabletPadRingInterface = "zwp_tablet_pad_ring_v2"
1219+
1220+// TabletPadRing is the generated binding for zwp_tablet_pad_ring_v2 version 2.
1221+type TabletPadRing struct {
1222+ wl.BaseProxy
1223+ // handlersMu guards the handler slices: a client may register or replace
1224+ // handlers while another goroutine dispatches events.
1225+ handlersMu sync.Mutex
1226+ onSource []func(source uint32)
1227+ onAngle []func(degrees wl.Fixed)
1228+ onStop []func()
1229+ onFrame []func(time uint32)
1230+}
1231+
1232+// NewTabletPadRing returns an unbound TabletPadRing.
1233+func NewTabletPadRing(ctx *wl.Context) *TabletPadRing {
1234+ obj := &TabletPadRing{}
1235+ obj.SetContext(ctx)
1236+ ctx.Register(obj)
1237+ return obj
1238+}
1239+
1240+// 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.
1241+func (o *TabletPadRing) SetFeedback(description string, serial uint32) error {
1242+ if err := o.Context().CheckProxy(o); err != nil {
1243+ return err
1244+ }
1245+ if err := o.Context().SendRequest(o, 0, description, serial); err != nil {
1246+ return err
1247+ }
1248+ return nil
1249+}
1250+
1251+// This destroys the client's resource for this ring object.
1252+func (o *TabletPadRing) Destroy() error {
1253+ if err := o.Context().CheckProxy(o); err != nil {
1254+ return err
1255+ }
1256+ if err := o.Context().SendDestructor(o, 1); err != nil {
1257+ return err
1258+ }
1259+ return nil
1260+}
1261+
1262+// OnSource registers a handler for the source event.
1263+//
1264+// Handlers are appended, so a second call adds another handler rather than
1265+// replacing the first. Registration is safe while another goroutine dispatches.
1266+func (o *TabletPadRing) OnSource(handler func(source uint32)) {
1267+ if handler == nil {
1268+ return
1269+ }
1270+ o.handlersMu.Lock()
1271+ defer o.handlersMu.Unlock()
1272+ o.onSource = append(o.onSource, handler)
1273+}
1274+
1275+// handlersForSource returns the handlers registered for source, taken
1276+// under the lock so a handler may register another handler while events are
1277+// being dispatched.
1278+func (o *TabletPadRing) handlersForSource() []func(source uint32) {
1279+ o.handlersMu.Lock()
1280+ defer o.handlersMu.Unlock()
1281+ return o.onSource
1282+}
1283+
1284+// OnAngle registers a handler for the angle event.
1285+//
1286+// Handlers are appended, so a second call adds another handler rather than
1287+// replacing the first. Registration is safe while another goroutine dispatches.
1288+func (o *TabletPadRing) OnAngle(handler func(degrees wl.Fixed)) {
1289+ if handler == nil {
1290+ return
1291+ }
1292+ o.handlersMu.Lock()
1293+ defer o.handlersMu.Unlock()
1294+ o.onAngle = append(o.onAngle, handler)
1295+}
1296+
1297+// handlersForAngle returns the handlers registered for angle, taken
1298+// under the lock so a handler may register another handler while events are
1299+// being dispatched.
1300+func (o *TabletPadRing) handlersForAngle() []func(degrees wl.Fixed) {
1301+ o.handlersMu.Lock()
1302+ defer o.handlersMu.Unlock()
1303+ return o.onAngle
1304+}
1305+
1306+// OnStop registers a handler for the stop event.
1307+//
1308+// Handlers are appended, so a second call adds another handler rather than
1309+// replacing the first. Registration is safe while another goroutine dispatches.
1310+func (o *TabletPadRing) OnStop(handler func()) {
1311+ if handler == nil {
1312+ return
1313+ }
1314+ o.handlersMu.Lock()
1315+ defer o.handlersMu.Unlock()
1316+ o.onStop = append(o.onStop, handler)
1317+}
1318+
1319+// handlersForStop returns the handlers registered for stop, taken
1320+// under the lock so a handler may register another handler while events are
1321+// being dispatched.
1322+func (o *TabletPadRing) handlersForStop() []func() {
1323+ o.handlersMu.Lock()
1324+ defer o.handlersMu.Unlock()
1325+ return o.onStop
1326+}
1327+
1328+// OnFrame registers a handler for the frame event.
1329+//
1330+// Handlers are appended, so a second call adds another handler rather than
1331+// replacing the first. Registration is safe while another goroutine dispatches.
1332+func (o *TabletPadRing) OnFrame(handler func(time uint32)) {
1333+ if handler == nil {
1334+ return
1335+ }
1336+ o.handlersMu.Lock()
1337+ defer o.handlersMu.Unlock()
1338+ o.onFrame = append(o.onFrame, handler)
1339+}
1340+
1341+// handlersForFrame returns the handlers registered for frame, taken
1342+// under the lock so a handler may register another handler while events are
1343+// being dispatched.
1344+func (o *TabletPadRing) handlersForFrame() []func(time uint32) {
1345+ o.handlersMu.Lock()
1346+ defer o.handlersMu.Unlock()
1347+ return o.onFrame
1348+}
1349+
1350+// EventSignature returns the declared event argument types in wire order.
1351+func (o *TabletPadRing) EventSignature(opcode uint16) (string, bool) {
1352+ switch opcode {
1353+ case 0:
1354+ return "uint,", true
1355+ case 1:
1356+ return "fixed,", true
1357+ case 2:
1358+ return "", true
1359+ case 3:
1360+ return "uint,", true
1361+ default:
1362+ return "", false
1363+ }
1364+}
1365+
1366+// Dispatch decodes one event on zwp_tablet_pad_ring_v2 and calls the registered handlers.
1367+func (o *TabletPadRing) Dispatch(event *wl.Event) {
1368+ switch event.Opcode {
1369+ case 0: // source
1370+ source := event.Uint32()
1371+
1372+ for i, handler := range o.handlersForSource() {
1373+ _ = i
1374+ handler(source)
1375+ }
1376+ case 1: // angle
1377+ degrees := event.Fixed()
1378+
1379+ for i, handler := range o.handlersForAngle() {
1380+ _ = i
1381+ handler(degrees)
1382+ }
1383+ case 2: // stop
1384+
1385+ for i, handler := range o.handlersForStop() {
1386+ _ = i
1387+ handler()
1388+ }
1389+ case 3: // frame
1390+ time := event.Uint32()
1391+
1392+ for i, handler := range o.handlersForFrame() {
1393+ _ = i
1394+ handler(time)
1395+ }
1396+ default:
1397+ }
1398+}
1399+
1400+// TabletPadStripInterface is the protocol interface name.
1401+const TabletPadStripInterface = "zwp_tablet_pad_strip_v2"
1402+
1403+// TabletPadStrip is the generated binding for zwp_tablet_pad_strip_v2 version 2.
1404+type TabletPadStrip struct {
1405+ wl.BaseProxy
1406+ // handlersMu guards the handler slices: a client may register or replace
1407+ // handlers while another goroutine dispatches events.
1408+ handlersMu sync.Mutex
1409+ onSource []func(source uint32)
1410+ onPosition []func(position uint32)
1411+ onStop []func()
1412+ onFrame []func(time uint32)
1413+}
1414+
1415+// NewTabletPadStrip returns an unbound TabletPadStrip.
1416+func NewTabletPadStrip(ctx *wl.Context) *TabletPadStrip {
1417+ obj := &TabletPadStrip{}
1418+ obj.SetContext(ctx)
1419+ ctx.Register(obj)
1420+ return obj
1421+}
1422+
1423+// 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.
1424+func (o *TabletPadStrip) SetFeedback(description string, serial uint32) error {
1425+ if err := o.Context().CheckProxy(o); err != nil {
1426+ return err
1427+ }
1428+ if err := o.Context().SendRequest(o, 0, description, serial); err != nil {
1429+ return err
1430+ }
1431+ return nil
1432+}
1433+
1434+// This destroys the client's resource for this strip object.
1435+func (o *TabletPadStrip) Destroy() error {
1436+ if err := o.Context().CheckProxy(o); err != nil {
1437+ return err
1438+ }
1439+ if err := o.Context().SendDestructor(o, 1); err != nil {
1440+ return err
1441+ }
1442+ return nil
1443+}
1444+
1445+// OnSource registers a handler for the source event.
1446+//
1447+// Handlers are appended, so a second call adds another handler rather than
1448+// replacing the first. Registration is safe while another goroutine dispatches.
1449+func (o *TabletPadStrip) OnSource(handler func(source uint32)) {
1450+ if handler == nil {
1451+ return
1452+ }
1453+ o.handlersMu.Lock()
1454+ defer o.handlersMu.Unlock()
1455+ o.onSource = append(o.onSource, handler)
1456+}
1457+
1458+// handlersForSource returns the handlers registered for source, taken
1459+// under the lock so a handler may register another handler while events are
1460+// being dispatched.
1461+func (o *TabletPadStrip) handlersForSource() []func(source uint32) {
1462+ o.handlersMu.Lock()
1463+ defer o.handlersMu.Unlock()
1464+ return o.onSource
1465+}
1466+
1467+// OnPosition registers a handler for the position event.
1468+//
1469+// Handlers are appended, so a second call adds another handler rather than
1470+// replacing the first. Registration is safe while another goroutine dispatches.
1471+func (o *TabletPadStrip) OnPosition(handler func(position uint32)) {
1472+ if handler == nil {
1473+ return
1474+ }
1475+ o.handlersMu.Lock()
1476+ defer o.handlersMu.Unlock()
1477+ o.onPosition = append(o.onPosition, handler)
1478+}
1479+
1480+// handlersForPosition returns the handlers registered for position, taken
1481+// under the lock so a handler may register another handler while events are
1482+// being dispatched.
1483+func (o *TabletPadStrip) handlersForPosition() []func(position uint32) {
1484+ o.handlersMu.Lock()
1485+ defer o.handlersMu.Unlock()
1486+ return o.onPosition
1487+}
1488+
1489+// OnStop registers a handler for the stop event.
1490+//
1491+// Handlers are appended, so a second call adds another handler rather than
1492+// replacing the first. Registration is safe while another goroutine dispatches.
1493+func (o *TabletPadStrip) OnStop(handler func()) {
1494+ if handler == nil {
1495+ return
1496+ }
1497+ o.handlersMu.Lock()
1498+ defer o.handlersMu.Unlock()
1499+ o.onStop = append(o.onStop, handler)
1500+}
1501+
1502+// handlersForStop returns the handlers registered for stop, taken
1503+// under the lock so a handler may register another handler while events are
1504+// being dispatched.
1505+func (o *TabletPadStrip) handlersForStop() []func() {
1506+ o.handlersMu.Lock()
1507+ defer o.handlersMu.Unlock()
1508+ return o.onStop
1509+}
1510+
1511+// OnFrame registers a handler for the frame event.
1512+//
1513+// Handlers are appended, so a second call adds another handler rather than
1514+// replacing the first. Registration is safe while another goroutine dispatches.
1515+func (o *TabletPadStrip) OnFrame(handler func(time uint32)) {
1516+ if handler == nil {
1517+ return
1518+ }
1519+ o.handlersMu.Lock()
1520+ defer o.handlersMu.Unlock()
1521+ o.onFrame = append(o.onFrame, handler)
1522+}
1523+
1524+// handlersForFrame returns the handlers registered for frame, taken
1525+// under the lock so a handler may register another handler while events are
1526+// being dispatched.
1527+func (o *TabletPadStrip) handlersForFrame() []func(time uint32) {
1528+ o.handlersMu.Lock()
1529+ defer o.handlersMu.Unlock()
1530+ return o.onFrame
1531+}
1532+
1533+// EventSignature returns the declared event argument types in wire order.
1534+func (o *TabletPadStrip) EventSignature(opcode uint16) (string, bool) {
1535+ switch opcode {
1536+ case 0:
1537+ return "uint,", true
1538+ case 1:
1539+ return "uint,", true
1540+ case 2:
1541+ return "", true
1542+ case 3:
1543+ return "uint,", true
1544+ default:
1545+ return "", false
1546+ }
1547+}
1548+
1549+// Dispatch decodes one event on zwp_tablet_pad_strip_v2 and calls the registered handlers.
1550+func (o *TabletPadStrip) Dispatch(event *wl.Event) {
1551+ switch event.Opcode {
1552+ case 0: // source
1553+ source := event.Uint32()
1554+
1555+ for i, handler := range o.handlersForSource() {
1556+ _ = i
1557+ handler(source)
1558+ }
1559+ case 1: // position
1560+ position := event.Uint32()
1561+
1562+ for i, handler := range o.handlersForPosition() {
1563+ _ = i
1564+ handler(position)
1565+ }
1566+ case 2: // stop
1567+
1568+ for i, handler := range o.handlersForStop() {
1569+ _ = i
1570+ handler()
1571+ }
1572+ case 3: // frame
1573+ time := event.Uint32()
1574+
1575+ for i, handler := range o.handlersForFrame() {
1576+ _ = i
1577+ handler(time)
1578+ }
1579+ default:
1580+ }
1581+}
1582+
1583+// TabletPadGroupInterface is the protocol interface name.
1584+const TabletPadGroupInterface = "zwp_tablet_pad_group_v2"
1585+
1586+// TabletPadGroup is the generated binding for zwp_tablet_pad_group_v2 version 2.
1587+type TabletPadGroup struct {
1588+ wl.BaseProxy
1589+ // handlersMu guards the handler slices: a client may register or replace
1590+ // handlers while another goroutine dispatches events.
1591+ handlersMu sync.Mutex
1592+ onButtons []func(buttons []byte)
1593+ onRing []func(ringObject *TabletPadRing)
1594+ onStrip []func(stripObject *TabletPadStrip)
1595+ onModes []func(modes uint32)
1596+ onDone []func()
1597+ onModeSwitch []func(time uint32, serial uint32, mode uint32)
1598+ onDial []func(dialObject *TabletPadDial)
1599+}
1600+
1601+// NewTabletPadGroup returns an unbound TabletPadGroup.
1602+func NewTabletPadGroup(ctx *wl.Context) *TabletPadGroup {
1603+ obj := &TabletPadGroup{}
1604+ obj.SetContext(ctx)
1605+ ctx.Register(obj)
1606+ return obj
1607+}
1608+
1609+// Destroy the zwp_tablet_pad_group_v2 object. Objects created from this object are unaffected and should be destroyed separately.
1610+func (o *TabletPadGroup) Destroy() error {
1611+ if err := o.Context().CheckProxy(o); err != nil {
1612+ return err
1613+ }
1614+ if err := o.Context().SendDestructor(o, 0); err != nil {
1615+ return err
1616+ }
1617+ return nil
1618+}
1619+
1620+// OnButtons registers a handler for the buttons event.
1621+//
1622+// Handlers are appended, so a second call adds another handler rather than
1623+// replacing the first. Registration is safe while another goroutine dispatches.
1624+func (o *TabletPadGroup) OnButtons(handler func(buttons []byte)) {
1625+ if handler == nil {
1626+ return
1627+ }
1628+ o.handlersMu.Lock()
1629+ defer o.handlersMu.Unlock()
1630+ o.onButtons = append(o.onButtons, handler)
1631+}
1632+
1633+// handlersForButtons returns the handlers registered for buttons, taken
1634+// under the lock so a handler may register another handler while events are
1635+// being dispatched.
1636+func (o *TabletPadGroup) handlersForButtons() []func(buttons []byte) {
1637+ o.handlersMu.Lock()
1638+ defer o.handlersMu.Unlock()
1639+ return o.onButtons
1640+}
1641+
1642+// OnRing registers a handler for the ring event.
1643+//
1644+// Handlers are appended, so a second call adds another handler rather than
1645+// replacing the first. Registration is safe while another goroutine dispatches.
1646+func (o *TabletPadGroup) OnRing(handler func(ringObject *TabletPadRing)) {
1647+ if handler == nil {
1648+ return
1649+ }
1650+ o.handlersMu.Lock()
1651+ defer o.handlersMu.Unlock()
1652+ o.onRing = append(o.onRing, handler)
1653+}
1654+
1655+// handlersForRing returns the handlers registered for ring, taken
1656+// under the lock so a handler may register another handler while events are
1657+// being dispatched.
1658+func (o *TabletPadGroup) handlersForRing() []func(ringObject *TabletPadRing) {
1659+ o.handlersMu.Lock()
1660+ defer o.handlersMu.Unlock()
1661+ return o.onRing
1662+}
1663+
1664+// OnStrip registers a handler for the strip event.
1665+//
1666+// Handlers are appended, so a second call adds another handler rather than
1667+// replacing the first. Registration is safe while another goroutine dispatches.
1668+func (o *TabletPadGroup) OnStrip(handler func(stripObject *TabletPadStrip)) {
1669+ if handler == nil {
1670+ return
1671+ }
1672+ o.handlersMu.Lock()
1673+ defer o.handlersMu.Unlock()
1674+ o.onStrip = append(o.onStrip, handler)
1675+}
1676+
1677+// handlersForStrip returns the handlers registered for strip, taken
1678+// under the lock so a handler may register another handler while events are
1679+// being dispatched.
1680+func (o *TabletPadGroup) handlersForStrip() []func(stripObject *TabletPadStrip) {
1681+ o.handlersMu.Lock()
1682+ defer o.handlersMu.Unlock()
1683+ return o.onStrip
1684+}
1685+
1686+// OnModes registers a handler for the modes event.
1687+//
1688+// Handlers are appended, so a second call adds another handler rather than
1689+// replacing the first. Registration is safe while another goroutine dispatches.
1690+func (o *TabletPadGroup) OnModes(handler func(modes uint32)) {
1691+ if handler == nil {
1692+ return
1693+ }
1694+ o.handlersMu.Lock()
1695+ defer o.handlersMu.Unlock()
1696+ o.onModes = append(o.onModes, handler)
1697+}
1698+
1699+// handlersForModes returns the handlers registered for modes, taken
1700+// under the lock so a handler may register another handler while events are
1701+// being dispatched.
1702+func (o *TabletPadGroup) handlersForModes() []func(modes uint32) {
1703+ o.handlersMu.Lock()
1704+ defer o.handlersMu.Unlock()
1705+ return o.onModes
1706+}
1707+
1708+// OnDone registers a handler for the done event.
1709+//
1710+// Handlers are appended, so a second call adds another handler rather than
1711+// replacing the first. Registration is safe while another goroutine dispatches.
1712+func (o *TabletPadGroup) OnDone(handler func()) {
1713+ if handler == nil {
1714+ return
1715+ }
1716+ o.handlersMu.Lock()
1717+ defer o.handlersMu.Unlock()
1718+ o.onDone = append(o.onDone, handler)
1719+}
1720+
1721+// handlersForDone returns the handlers registered for done, taken
1722+// under the lock so a handler may register another handler while events are
1723+// being dispatched.
1724+func (o *TabletPadGroup) handlersForDone() []func() {
1725+ o.handlersMu.Lock()
1726+ defer o.handlersMu.Unlock()
1727+ return o.onDone
1728+}
1729+
1730+// OnModeSwitch registers a handler for the mode_switch event.
1731+//
1732+// Handlers are appended, so a second call adds another handler rather than
1733+// replacing the first. Registration is safe while another goroutine dispatches.
1734+func (o *TabletPadGroup) OnModeSwitch(handler func(time uint32, serial uint32, mode uint32)) {
1735+ if handler == nil {
1736+ return
1737+ }
1738+ o.handlersMu.Lock()
1739+ defer o.handlersMu.Unlock()
1740+ o.onModeSwitch = append(o.onModeSwitch, handler)
1741+}
1742+
1743+// handlersForModeSwitch returns the handlers registered for mode_switch, taken
1744+// under the lock so a handler may register another handler while events are
1745+// being dispatched.
1746+func (o *TabletPadGroup) handlersForModeSwitch() []func(time uint32, serial uint32, mode uint32) {
1747+ o.handlersMu.Lock()
1748+ defer o.handlersMu.Unlock()
1749+ return o.onModeSwitch
1750+}
1751+
1752+// OnDial registers a handler for the dial event.
1753+//
1754+// Handlers are appended, so a second call adds another handler rather than
1755+// replacing the first. Registration is safe while another goroutine dispatches.
1756+func (o *TabletPadGroup) OnDial(handler func(dialObject *TabletPadDial)) {
1757+ if handler == nil {
1758+ return
1759+ }
1760+ o.handlersMu.Lock()
1761+ defer o.handlersMu.Unlock()
1762+ o.onDial = append(o.onDial, handler)
1763+}
1764+
1765+// handlersForDial returns the handlers registered for dial, taken
1766+// under the lock so a handler may register another handler while events are
1767+// being dispatched.
1768+func (o *TabletPadGroup) handlersForDial() []func(dialObject *TabletPadDial) {
1769+ o.handlersMu.Lock()
1770+ defer o.handlersMu.Unlock()
1771+ return o.onDial
1772+}
1773+
1774+// EventSignature returns the declared event argument types in wire order.
1775+func (o *TabletPadGroup) EventSignature(opcode uint16) (string, bool) {
1776+ switch opcode {
1777+ case 0:
1778+ return "array,", true
1779+ case 1:
1780+ return "new_id,", true
1781+ case 2:
1782+ return "new_id,", true
1783+ case 3:
1784+ return "uint,", true
1785+ case 4:
1786+ return "", true
1787+ case 5:
1788+ return "uint,uint,uint,", true
1789+ case 6:
1790+ return "new_id,", true
1791+ default:
1792+ return "", false
1793+ }
1794+}
1795+
1796+// Dispatch decodes one event on zwp_tablet_pad_group_v2 and calls the registered handlers.
1797+func (o *TabletPadGroup) Dispatch(event *wl.Event) {
1798+ switch event.Opcode {
1799+ case 0: // buttons
1800+ buttons := event.Array()
1801+
1802+ for i, handler := range o.handlersForButtons() {
1803+ _ = i
1804+ handler(buttons)
1805+ }
1806+ case 1: // ring
1807+ ringID := event.Uint32()
1808+ ringObject := &TabletPadRing{}
1809+ ringObject.SetContext(o.Context())
1810+ ringObject.SetID(ringID)
1811+ o.Context().Register(ringObject)
1812+
1813+ for i, handler := range o.handlersForRing() {
1814+ _ = i
1815+ handler(ringObject)
1816+ }
1817+ case 2: // strip
1818+ stripID := event.Uint32()
1819+ stripObject := &TabletPadStrip{}
1820+ stripObject.SetContext(o.Context())
1821+ stripObject.SetID(stripID)
1822+ o.Context().Register(stripObject)
1823+
1824+ for i, handler := range o.handlersForStrip() {
1825+ _ = i
1826+ handler(stripObject)
1827+ }
1828+ case 3: // modes
1829+ modes := event.Uint32()
1830+
1831+ for i, handler := range o.handlersForModes() {
1832+ _ = i
1833+ handler(modes)
1834+ }
1835+ case 4: // done
1836+
1837+ for i, handler := range o.handlersForDone() {
1838+ _ = i
1839+ handler()
1840+ }
1841+ case 5: // mode_switch
1842+ time := event.Uint32()
1843+ serial := event.Uint32()
1844+ mode := event.Uint32()
1845+
1846+ for i, handler := range o.handlersForModeSwitch() {
1847+ _ = i
1848+ handler(time, serial, mode)
1849+ }
1850+ case 6: // dial
1851+ dialID := event.Uint32()
1852+ dialObject := &TabletPadDial{}
1853+ dialObject.SetContext(o.Context())
1854+ dialObject.SetID(dialID)
1855+ o.Context().Register(dialObject)
1856+
1857+ for i, handler := range o.handlersForDial() {
1858+ _ = i
1859+ handler(dialObject)
1860+ }
1861+ default:
1862+ }
1863+}
1864+
1865+// TabletPadInterface is the protocol interface name.
1866+const TabletPadInterface = "zwp_tablet_pad_v2"
1867+
1868+// TabletPad is the generated binding for zwp_tablet_pad_v2 version 2.
1869+type TabletPad struct {
1870+ wl.BaseProxy
1871+ // handlersMu guards the handler slices: a client may register or replace
1872+ // handlers while another goroutine dispatches events.
1873+ handlersMu sync.Mutex
1874+ onGroup []func(padGroupObject *TabletPadGroup)
1875+ onPath []func(path string)
1876+ onButtons []func(buttons uint32)
1877+ onDone []func()
1878+ onButton []func(time uint32, button uint32, state uint32)
1879+ onEnter []func(serial uint32, tabletID uint32, surfaceID uint32)
1880+ onLeave []func(serial uint32, surfaceID uint32)
1881+ onRemoved []func()
1882+}
1883+
1884+// NewTabletPad returns an unbound TabletPad.
1885+func NewTabletPad(ctx *wl.Context) *TabletPad {
1886+ obj := &TabletPad{}
1887+ obj.SetContext(ctx)
1888+ ctx.Register(obj)
1889+ return obj
1890+}
1891+
1892+// 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.
1893+func (o *TabletPad) SetFeedback(button uint32, description string, serial uint32) error {
1894+ if err := o.Context().CheckProxy(o); err != nil {
1895+ return err
1896+ }
1897+ if err := o.Context().SendRequest(o, 0, button, description, serial); err != nil {
1898+ return err
1899+ }
1900+ return nil
1901+}
1902+
1903+// Destroy the zwp_tablet_pad_v2 object. Objects created from this object are unaffected and should be destroyed separately.
1904+func (o *TabletPad) Destroy() error {
1905+ if err := o.Context().CheckProxy(o); err != nil {
1906+ return err
1907+ }
1908+ if err := o.Context().SendDestructor(o, 1); err != nil {
1909+ return err
1910+ }
1911+ return nil
1912+}
1913+
1914+// OnGroup registers a handler for the group event.
1915+//
1916+// Handlers are appended, so a second call adds another handler rather than
1917+// replacing the first. Registration is safe while another goroutine dispatches.
1918+func (o *TabletPad) OnGroup(handler func(padGroupObject *TabletPadGroup)) {
1919+ if handler == nil {
1920+ return
1921+ }
1922+ o.handlersMu.Lock()
1923+ defer o.handlersMu.Unlock()
1924+ o.onGroup = append(o.onGroup, handler)
1925+}
1926+
1927+// handlersForGroup returns the handlers registered for group, taken
1928+// under the lock so a handler may register another handler while events are
1929+// being dispatched.
1930+func (o *TabletPad) handlersForGroup() []func(padGroupObject *TabletPadGroup) {
1931+ o.handlersMu.Lock()
1932+ defer o.handlersMu.Unlock()
1933+ return o.onGroup
1934+}
1935+
1936+// OnPath registers a handler for the path event.
1937+//
1938+// Handlers are appended, so a second call adds another handler rather than
1939+// replacing the first. Registration is safe while another goroutine dispatches.
1940+func (o *TabletPad) OnPath(handler func(path string)) {
1941+ if handler == nil {
1942+ return
1943+ }
1944+ o.handlersMu.Lock()
1945+ defer o.handlersMu.Unlock()
1946+ o.onPath = append(o.onPath, handler)
1947+}
1948+
1949+// handlersForPath returns the handlers registered for path, taken
1950+// under the lock so a handler may register another handler while events are
1951+// being dispatched.
1952+func (o *TabletPad) handlersForPath() []func(path string) {
1953+ o.handlersMu.Lock()
1954+ defer o.handlersMu.Unlock()
1955+ return o.onPath
1956+}
1957+
1958+// OnButtons registers a handler for the buttons event.
1959+//
1960+// Handlers are appended, so a second call adds another handler rather than
1961+// replacing the first. Registration is safe while another goroutine dispatches.
1962+func (o *TabletPad) OnButtons(handler func(buttons uint32)) {
1963+ if handler == nil {
1964+ return
1965+ }
1966+ o.handlersMu.Lock()
1967+ defer o.handlersMu.Unlock()
1968+ o.onButtons = append(o.onButtons, handler)
1969+}
1970+
1971+// handlersForButtons returns the handlers registered for buttons, taken
1972+// under the lock so a handler may register another handler while events are
1973+// being dispatched.
1974+func (o *TabletPad) handlersForButtons() []func(buttons uint32) {
1975+ o.handlersMu.Lock()
1976+ defer o.handlersMu.Unlock()
1977+ return o.onButtons
1978+}
1979+
1980+// OnDone registers a handler for the done event.
1981+//
1982+// Handlers are appended, so a second call adds another handler rather than
1983+// replacing the first. Registration is safe while another goroutine dispatches.
1984+func (o *TabletPad) OnDone(handler func()) {
1985+ if handler == nil {
1986+ return
1987+ }
1988+ o.handlersMu.Lock()
1989+ defer o.handlersMu.Unlock()
1990+ o.onDone = append(o.onDone, handler)
1991+}
1992+
1993+// handlersForDone returns the handlers registered for done, taken
1994+// under the lock so a handler may register another handler while events are
1995+// being dispatched.
1996+func (o *TabletPad) handlersForDone() []func() {
1997+ o.handlersMu.Lock()
1998+ defer o.handlersMu.Unlock()
1999+ return o.onDone
2000+}
2001+
2002+// OnButton registers a handler for the button event.
2003+//
2004+// Handlers are appended, so a second call adds another handler rather than
2005+// replacing the first. Registration is safe while another goroutine dispatches.
2006+func (o *TabletPad) OnButton(handler func(time uint32, button uint32, state uint32)) {
2007+ if handler == nil {
2008+ return
2009+ }
2010+ o.handlersMu.Lock()
2011+ defer o.handlersMu.Unlock()
2012+ o.onButton = append(o.onButton, handler)
2013+}
2014+
2015+// handlersForButton returns the handlers registered for button, taken
2016+// under the lock so a handler may register another handler while events are
2017+// being dispatched.
2018+func (o *TabletPad) handlersForButton() []func(time uint32, button uint32, state uint32) {
2019+ o.handlersMu.Lock()
2020+ defer o.handlersMu.Unlock()
2021+ return o.onButton
2022+}
2023+
2024+// OnEnter registers a handler for the enter event.
2025+//
2026+// Handlers are appended, so a second call adds another handler rather than
2027+// replacing the first. Registration is safe while another goroutine dispatches.
2028+func (o *TabletPad) OnEnter(handler func(serial uint32, tabletID uint32, surfaceID uint32)) {
2029+ if handler == nil {
2030+ return
2031+ }
2032+ o.handlersMu.Lock()
2033+ defer o.handlersMu.Unlock()
2034+ o.onEnter = append(o.onEnter, handler)
2035+}
2036+
2037+// handlersForEnter returns the handlers registered for enter, taken
2038+// under the lock so a handler may register another handler while events are
2039+// being dispatched.
2040+func (o *TabletPad) handlersForEnter() []func(serial uint32, tabletID uint32, surfaceID uint32) {
2041+ o.handlersMu.Lock()
2042+ defer o.handlersMu.Unlock()
2043+ return o.onEnter
2044+}
2045+
2046+// OnLeave registers a handler for the leave event.
2047+//
2048+// Handlers are appended, so a second call adds another handler rather than
2049+// replacing the first. Registration is safe while another goroutine dispatches.
2050+func (o *TabletPad) OnLeave(handler func(serial uint32, surfaceID uint32)) {
2051+ if handler == nil {
2052+ return
2053+ }
2054+ o.handlersMu.Lock()
2055+ defer o.handlersMu.Unlock()
2056+ o.onLeave = append(o.onLeave, handler)
2057+}
2058+
2059+// handlersForLeave returns the handlers registered for leave, taken
2060+// under the lock so a handler may register another handler while events are
2061+// being dispatched.
2062+func (o *TabletPad) handlersForLeave() []func(serial uint32, surfaceID uint32) {
2063+ o.handlersMu.Lock()
2064+ defer o.handlersMu.Unlock()
2065+ return o.onLeave
2066+}
2067+
2068+// OnRemoved registers a handler for the removed event.
2069+//
2070+// Handlers are appended, so a second call adds another handler rather than
2071+// replacing the first. Registration is safe while another goroutine dispatches.
2072+func (o *TabletPad) OnRemoved(handler func()) {
2073+ if handler == nil {
2074+ return
2075+ }
2076+ o.handlersMu.Lock()
2077+ defer o.handlersMu.Unlock()
2078+ o.onRemoved = append(o.onRemoved, handler)
2079+}
2080+
2081+// handlersForRemoved returns the handlers registered for removed, taken
2082+// under the lock so a handler may register another handler while events are
2083+// being dispatched.
2084+func (o *TabletPad) handlersForRemoved() []func() {
2085+ o.handlersMu.Lock()
2086+ defer o.handlersMu.Unlock()
2087+ return o.onRemoved
2088+}
2089+
2090+// EventSignature returns the declared event argument types in wire order.
2091+func (o *TabletPad) EventSignature(opcode uint16) (string, bool) {
2092+ switch opcode {
2093+ case 0:
2094+ return "new_id,", true
2095+ case 1:
2096+ return "string,", true
2097+ case 2:
2098+ return "uint,", true
2099+ case 3:
2100+ return "", true
2101+ case 4:
2102+ return "uint,uint,uint,", true
2103+ case 5:
2104+ return "uint,object,object,", true
2105+ case 6:
2106+ return "uint,object,", true
2107+ case 7:
2108+ return "", true
2109+ default:
2110+ return "", false
2111+ }
2112+}
2113+
2114+// Dispatch decodes one event on zwp_tablet_pad_v2 and calls the registered handlers.
2115+func (o *TabletPad) Dispatch(event *wl.Event) {
2116+ switch event.Opcode {
2117+ case 0: // group
2118+ padGroupID := event.Uint32()
2119+ padGroupObject := &TabletPadGroup{}
2120+ padGroupObject.SetContext(o.Context())
2121+ padGroupObject.SetID(padGroupID)
2122+ o.Context().Register(padGroupObject)
2123+
2124+ for i, handler := range o.handlersForGroup() {
2125+ _ = i
2126+ handler(padGroupObject)
2127+ }
2128+ case 1: // path
2129+ path := event.String()
2130+
2131+ for i, handler := range o.handlersForPath() {
2132+ _ = i
2133+ handler(path)
2134+ }
2135+ case 2: // buttons
2136+ buttons := event.Uint32()
2137+
2138+ for i, handler := range o.handlersForButtons() {
2139+ _ = i
2140+ handler(buttons)
2141+ }
2142+ case 3: // done
2143+
2144+ for i, handler := range o.handlersForDone() {
2145+ _ = i
2146+ handler()
2147+ }
2148+ case 4: // button
2149+ time := event.Uint32()
2150+ button := event.Uint32()
2151+ state := event.Uint32()
2152+
2153+ for i, handler := range o.handlersForButton() {
2154+ _ = i
2155+ handler(time, button, state)
2156+ }
2157+ case 5: // enter
2158+ serial := event.Uint32()
2159+ tabletID := event.Uint32()
2160+ surfaceID := event.Uint32()
2161+
2162+ for i, handler := range o.handlersForEnter() {
2163+ _ = i
2164+ handler(serial, tabletID, surfaceID)
2165+ }
2166+ case 6: // leave
2167+ serial := event.Uint32()
2168+ surfaceID := event.Uint32()
2169+
2170+ for i, handler := range o.handlersForLeave() {
2171+ _ = i
2172+ handler(serial, surfaceID)
2173+ }
2174+ case 7: // removed
2175+
2176+ for i, handler := range o.handlersForRemoved() {
2177+ _ = i
2178+ handler()
2179+ }
2180+ default:
2181+ }
2182+}
2183+
2184+// TabletPadDialInterface is the protocol interface name.
2185+const TabletPadDialInterface = "zwp_tablet_pad_dial_v2"
2186+
2187+// TabletPadDial is the generated binding for zwp_tablet_pad_dial_v2 version 2.
2188+type TabletPadDial struct {
2189+ wl.BaseProxy
2190+ // handlersMu guards the handler slices: a client may register or replace
2191+ // handlers while another goroutine dispatches events.
2192+ handlersMu sync.Mutex
2193+ onDelta []func(value120 int32)
2194+ onFrame []func(time uint32)
2195+}
2196+
2197+// NewTabletPadDial returns an unbound TabletPadDial.
2198+func NewTabletPadDial(ctx *wl.Context) *TabletPadDial {
2199+ obj := &TabletPadDial{}
2200+ obj.SetContext(ctx)
2201+ ctx.Register(obj)
2202+ return obj
2203+}
2204+
2205+// 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.
2206+func (o *TabletPadDial) SetFeedback(description string, serial uint32) error {
2207+ if err := o.Context().CheckProxy(o); err != nil {
2208+ return err
2209+ }
2210+ if err := o.Context().SendRequest(o, 0, description, serial); err != nil {
2211+ return err
2212+ }
2213+ return nil
2214+}
2215+
2216+// This destroys the client's resource for this dial object.
2217+func (o *TabletPadDial) Destroy() error {
2218+ if err := o.Context().CheckProxy(o); err != nil {
2219+ return err
2220+ }
2221+ if err := o.Context().SendDestructor(o, 1); err != nil {
2222+ return err
2223+ }
2224+ return nil
2225+}
2226+
2227+// OnDelta registers a handler for the delta event.
2228+//
2229+// Handlers are appended, so a second call adds another handler rather than
2230+// replacing the first. Registration is safe while another goroutine dispatches.
2231+func (o *TabletPadDial) OnDelta(handler func(value120 int32)) {
2232+ if handler == nil {
2233+ return
2234+ }
2235+ o.handlersMu.Lock()
2236+ defer o.handlersMu.Unlock()
2237+ o.onDelta = append(o.onDelta, handler)
2238+}
2239+
2240+// handlersForDelta returns the handlers registered for delta, taken
2241+// under the lock so a handler may register another handler while events are
2242+// being dispatched.
2243+func (o *TabletPadDial) handlersForDelta() []func(value120 int32) {
2244+ o.handlersMu.Lock()
2245+ defer o.handlersMu.Unlock()
2246+ return o.onDelta
2247+}
2248+
2249+// OnFrame registers a handler for the frame event.
2250+//
2251+// Handlers are appended, so a second call adds another handler rather than
2252+// replacing the first. Registration is safe while another goroutine dispatches.
2253+func (o *TabletPadDial) OnFrame(handler func(time uint32)) {
2254+ if handler == nil {
2255+ return
2256+ }
2257+ o.handlersMu.Lock()
2258+ defer o.handlersMu.Unlock()
2259+ o.onFrame = append(o.onFrame, handler)
2260+}
2261+
2262+// handlersForFrame returns the handlers registered for frame, taken
2263+// under the lock so a handler may register another handler while events are
2264+// being dispatched.
2265+func (o *TabletPadDial) handlersForFrame() []func(time uint32) {
2266+ o.handlersMu.Lock()
2267+ defer o.handlersMu.Unlock()
2268+ return o.onFrame
2269+}
2270+
2271+// EventSignature returns the declared event argument types in wire order.
2272+func (o *TabletPadDial) EventSignature(opcode uint16) (string, bool) {
2273+ switch opcode {
2274+ case 0:
2275+ return "int,", true
2276+ case 1:
2277+ return "uint,", true
2278+ default:
2279+ return "", false
2280+ }
2281+}
2282+
2283+// Dispatch decodes one event on zwp_tablet_pad_dial_v2 and calls the registered handlers.
2284+func (o *TabletPadDial) Dispatch(event *wl.Event) {
2285+ switch event.Opcode {
2286+ case 0: // delta
2287+ value120 := event.Int32()
2288+
2289+ for i, handler := range o.handlersForDelta() {
2290+ _ = i
2291+ handler(value120)
2292+ }
2293+ case 1: // frame
2294+ time := event.Uint32()
2295+
2296+ for i, handler := range o.handlersForFrame() {
2297+ _ = i
2298+ handler(time)
2299+ }
2300+ default:
2301+ }
2302+}

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