1 /* Generated by wayland-scanner 1.22.0 */
2 
3 #ifndef TABLET_UNSTABLE_V2_CLIENT_PROTOCOL_H
4 #define TABLET_UNSTABLE_V2_CLIENT_PROTOCOL_H
5 
6 #include <stdint.h>
7 #include <stddef.h>
8 #include "wayland-client.h"
9 
10 #ifdef  __cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * @page page_tablet_unstable_v2 The tablet_unstable_v2 protocol
16  * Wayland protocol for graphics tablets
17  *
18  * @section page_desc_tablet_unstable_v2 Description
19  *
20  * This description provides a high-level overview of the interplay between
21  * the interfaces defined this protocol. For details, see the protocol
22  * specification.
23  *
24  * More than one tablet may exist, and device-specifics matter. Tablets are
25  * not represented by a single virtual device like wl_pointer. A client
26  * binds to the tablet manager object which is just a proxy object. From
27  * that, the client requests wp_tablet_manager.get_tablet_seat(wl_seat)
28  * and that returns the actual interface that has all the tablets. With
29  * this indirection, we can avoid merging wp_tablet into the actual Wayland
30  * protocol, a long-term benefit.
31  *
32  * The wp_tablet_seat sends a "tablet added" event for each tablet
33  * connected. That event is followed by descriptive events about the
34  * hardware; currently that includes events for name, vid/pid and
35  * a wp_tablet.path event that describes a local path. This path can be
36  * used to uniquely identify a tablet or get more information through
37  * libwacom. Emulated or nested tablets can skip any of those, e.g. a
38  * virtual tablet may not have a vid/pid. The sequence of descriptive
39  * events is terminated by a wp_tablet.done event to signal that a client
40  * may now finalize any initialization for that tablet.
41  *
42  * Events from tablets require a tool in proximity. Tools are also managed
43  * by the tablet seat; a "tool added" event is sent whenever a tool is new
44  * to the compositor. That event is followed by a number of descriptive
45  * events about the hardware; currently that includes capabilities,
46  * hardware id and serial number, and tool type. Similar to the tablet
47  * interface, a wp_tablet_tool.done event is sent to terminate that initial
48  * sequence.
49  *
50  * Any event from a tool happens on the wp_tablet_tool interface. When the
51  * tool gets into proximity of the tablet, a proximity_in event is sent on
52  * the wp_tablet_tool interface, listing the tablet and the surface. That
53  * event is followed by a motion event with the coordinates. After that,
54  * it's the usual motion, axis, button, etc. events. The protocol's
55  * serialisation means events are grouped by wp_tablet_tool.frame events.
56  *
57  * Two special events (that don't exist in X) are down and up. They signal
58  * "tip touching the surface". For tablets without real proximity
59  * detection, the sequence is: proximity_in, motion, down, frame.
60  *
61  * When the tool leaves proximity, a proximity_out event is sent. If any
62  * button is still down, a button release event is sent before this
63  * proximity event. These button events are sent in the same frame as the
64  * proximity event to signal to the client that the buttons were held when
65  * the tool left proximity.
66  *
67  * If the tool moves out of the surface but stays in proximity (i.e.
68  * between windows), compositor-specific grab policies apply. This usually
69  * means that the proximity-out is delayed until all buttons are released.
70  *
71  * Moving a tool physically from one tablet to the other has no real effect
72  * on the protocol, since we already have the tool object from the "tool
73  * added" event. All the information is already there and the proximity
74  * events on both tablets are all a client needs to reconstruct what
75  * happened.
76  *
77  * Some extra axes are normalized, i.e. the client knows the range as
78  * specified in the protocol (e.g. [0, 65535]), the granularity however is
79  * unknown. The current normalized axes are pressure, distance, and slider.
80  *
81  * Other extra axes are in physical units as specified in the protocol.
82  * The current extra axes with physical units are tilt, rotation and
83  * wheel rotation.
84  *
85  * Since tablets work independently of the pointer controlled by the mouse,
86  * the focus handling is independent too and controlled by proximity.
87  * The wp_tablet_tool.set_cursor request sets a tool-specific cursor.
88  * This cursor surface may be the same as the mouse cursor, and it may be
89  * the same across tools but it is possible to be more fine-grained. For
90  * example, a client may set different cursors for the pen and eraser.
91  *
92  * Tools are generally independent of tablets and it is
93  * compositor-specific policy when a tool can be removed. Common approaches
94  * will likely include some form of removing a tool when all tablets the
95  * tool was used on are removed.
96  *
97  * Warning! The protocol described in this file is experimental and
98  * backward incompatible changes may be made. Backward compatible changes
99  * may be added together with the corresponding interface version bump.
100  * Backward incompatible changes are done by bumping the version number in
101  * the protocol and interface names and resetting the interface version.
102  * Once the protocol is to be declared stable, the 'z' prefix and the
103  * version number in the protocol and interface names are removed and the
104  * interface version number is reset.
105  *
106  * @section page_ifaces_tablet_unstable_v2 Interfaces
107  * - @subpage page_iface_zwp_tablet_manager_v2 - controller object for graphic tablet devices
108  * - @subpage page_iface_zwp_tablet_seat_v2 - controller object for graphic tablet devices of a seat
109  * - @subpage page_iface_zwp_tablet_tool_v2 - a physical tablet tool
110  * - @subpage page_iface_zwp_tablet_v2 - graphics tablet device
111  * - @subpage page_iface_zwp_tablet_pad_ring_v2 - pad ring
112  * - @subpage page_iface_zwp_tablet_pad_strip_v2 - pad strip
113  * - @subpage page_iface_zwp_tablet_pad_group_v2 - a set of buttons, rings and strips
114  * - @subpage page_iface_zwp_tablet_pad_v2 - a set of buttons, rings and strips
115  * @section page_copyright_tablet_unstable_v2 Copyright
116  * <pre>
117  *
118  * Copyright 2014 © Stephen "Lyude" Chandler Paul
119  * Copyright 2015-2016 © Red Hat, Inc.
120  *
121  * Permission is hereby granted, free of charge, to any person
122  * obtaining a copy of this software and associated documentation files
123  * (the "Software"), to deal in the Software without restriction,
124  * including without limitation the rights to use, copy, modify, merge,
125  * publish, distribute, sublicense, and/or sell copies of the Software,
126  * and to permit persons to whom the Software is furnished to do so,
127  * subject to the following conditions:
128  *
129  * The above copyright notice and this permission notice (including the
130  * next paragraph) shall be included in all copies or substantial
131  * portions of the Software.
132  *
133  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
134  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
136  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
137  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
138  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
139  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
140  * SOFTWARE.
141  * </pre>
142  */
143 struct wl_seat;
144 struct wl_surface;
145 struct zwp_tablet_manager_v2;
146 struct zwp_tablet_pad_group_v2;
147 struct zwp_tablet_pad_ring_v2;
148 struct zwp_tablet_pad_strip_v2;
149 struct zwp_tablet_pad_v2;
150 struct zwp_tablet_seat_v2;
151 struct zwp_tablet_tool_v2;
152 struct zwp_tablet_v2;
153 
154 #ifndef ZWP_TABLET_MANAGER_V2_INTERFACE
155 #define ZWP_TABLET_MANAGER_V2_INTERFACE
156 /**
157  * @page page_iface_zwp_tablet_manager_v2 zwp_tablet_manager_v2
158  * @section page_iface_zwp_tablet_manager_v2_desc Description
159  *
160  * An object that provides access to the graphics tablets available on this
161  * system. All tablets are associated with a seat, to get access to the
162  * actual tablets, use wp_tablet_manager.get_tablet_seat.
163  * @section page_iface_zwp_tablet_manager_v2_api API
164  * See @ref iface_zwp_tablet_manager_v2.
165  */
166 /**
167  * @defgroup iface_zwp_tablet_manager_v2 The zwp_tablet_manager_v2 interface
168  *
169  * An object that provides access to the graphics tablets available on this
170  * system. All tablets are associated with a seat, to get access to the
171  * actual tablets, use wp_tablet_manager.get_tablet_seat.
172  */
173 extern const struct wl_interface zwp_tablet_manager_v2_interface;
174 #endif
175 #ifndef ZWP_TABLET_SEAT_V2_INTERFACE
176 #define ZWP_TABLET_SEAT_V2_INTERFACE
177 /**
178  * @page page_iface_zwp_tablet_seat_v2 zwp_tablet_seat_v2
179  * @section page_iface_zwp_tablet_seat_v2_desc Description
180  *
181  * An object that provides access to the graphics tablets available on this
182  * seat. After binding to this interface, the compositor sends a set of
183  * wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events.
184  * @section page_iface_zwp_tablet_seat_v2_api API
185  * See @ref iface_zwp_tablet_seat_v2.
186  */
187 /**
188  * @defgroup iface_zwp_tablet_seat_v2 The zwp_tablet_seat_v2 interface
189  *
190  * An object that provides access to the graphics tablets available on this
191  * seat. After binding to this interface, the compositor sends a set of
192  * wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events.
193  */
194 extern const struct wl_interface zwp_tablet_seat_v2_interface;
195 #endif
196 #ifndef ZWP_TABLET_TOOL_V2_INTERFACE
197 #define ZWP_TABLET_TOOL_V2_INTERFACE
198 /**
199  * @page page_iface_zwp_tablet_tool_v2 zwp_tablet_tool_v2
200  * @section page_iface_zwp_tablet_tool_v2_desc Description
201  *
202  * An object that represents a physical tool that has been, or is
203  * currently in use with a tablet in this seat. Each wp_tablet_tool
204  * object stays valid until the client destroys it; the compositor
205  * reuses the wp_tablet_tool object to indicate that the object's
206  * respective physical tool has come into proximity of a tablet again.
207  *
208  * A wp_tablet_tool object's relation to a physical tool depends on the
209  * tablet's ability to report serial numbers. If the tablet supports
210  * this capability, then the object represents a specific physical tool
211  * and can be identified even when used on multiple tablets.
212  *
213  * A tablet tool has a number of static characteristics, e.g. tool type,
214  * hardware_serial and capabilities. These capabilities are sent in an
215  * event sequence after the wp_tablet_seat.tool_added event before any
216  * actual events from this tool. This initial event sequence is
217  * terminated by a wp_tablet_tool.done event.
218  *
219  * Tablet tool events are grouped by wp_tablet_tool.frame events.
220  * Any events received before a wp_tablet_tool.frame event should be
221  * considered part of the same hardware state change.
222  * @section page_iface_zwp_tablet_tool_v2_api API
223  * See @ref iface_zwp_tablet_tool_v2.
224  */
225 /**
226  * @defgroup iface_zwp_tablet_tool_v2 The zwp_tablet_tool_v2 interface
227  *
228  * An object that represents a physical tool that has been, or is
229  * currently in use with a tablet in this seat. Each wp_tablet_tool
230  * object stays valid until the client destroys it; the compositor
231  * reuses the wp_tablet_tool object to indicate that the object's
232  * respective physical tool has come into proximity of a tablet again.
233  *
234  * A wp_tablet_tool object's relation to a physical tool depends on the
235  * tablet's ability to report serial numbers. If the tablet supports
236  * this capability, then the object represents a specific physical tool
237  * and can be identified even when used on multiple tablets.
238  *
239  * A tablet tool has a number of static characteristics, e.g. tool type,
240  * hardware_serial and capabilities. These capabilities are sent in an
241  * event sequence after the wp_tablet_seat.tool_added event before any
242  * actual events from this tool. This initial event sequence is
243  * terminated by a wp_tablet_tool.done event.
244  *
245  * Tablet tool events are grouped by wp_tablet_tool.frame events.
246  * Any events received before a wp_tablet_tool.frame event should be
247  * considered part of the same hardware state change.
248  */
249 extern const struct wl_interface zwp_tablet_tool_v2_interface;
250 #endif
251 #ifndef ZWP_TABLET_V2_INTERFACE
252 #define ZWP_TABLET_V2_INTERFACE
253 /**
254  * @page page_iface_zwp_tablet_v2 zwp_tablet_v2
255  * @section page_iface_zwp_tablet_v2_desc Description
256  *
257  * The wp_tablet interface represents one graphics tablet device. The
258  * tablet interface itself does not generate events; all events are
259  * generated by wp_tablet_tool objects when in proximity above a tablet.
260  *
261  * A tablet has a number of static characteristics, e.g. device name and
262  * pid/vid. These capabilities are sent in an event sequence after the
263  * wp_tablet_seat.tablet_added event. This initial event sequence is
264  * terminated by a wp_tablet.done event.
265  * @section page_iface_zwp_tablet_v2_api API
266  * See @ref iface_zwp_tablet_v2.
267  */
268 /**
269  * @defgroup iface_zwp_tablet_v2 The zwp_tablet_v2 interface
270  *
271  * The wp_tablet interface represents one graphics tablet device. The
272  * tablet interface itself does not generate events; all events are
273  * generated by wp_tablet_tool objects when in proximity above a tablet.
274  *
275  * A tablet has a number of static characteristics, e.g. device name and
276  * pid/vid. These capabilities are sent in an event sequence after the
277  * wp_tablet_seat.tablet_added event. This initial event sequence is
278  * terminated by a wp_tablet.done event.
279  */
280 extern const struct wl_interface zwp_tablet_v2_interface;
281 #endif
282 #ifndef ZWP_TABLET_PAD_RING_V2_INTERFACE
283 #define ZWP_TABLET_PAD_RING_V2_INTERFACE
284 /**
285  * @page page_iface_zwp_tablet_pad_ring_v2 zwp_tablet_pad_ring_v2
286  * @section page_iface_zwp_tablet_pad_ring_v2_desc Description
287  *
288  * A circular interaction area, such as the touch ring on the Wacom Intuos
289  * Pro series tablets.
290  *
291  * Events on a ring are logically grouped by the wl_tablet_pad_ring.frame
292  * event.
293  * @section page_iface_zwp_tablet_pad_ring_v2_api API
294  * See @ref iface_zwp_tablet_pad_ring_v2.
295  */
296 /**
297  * @defgroup iface_zwp_tablet_pad_ring_v2 The zwp_tablet_pad_ring_v2 interface
298  *
299  * A circular interaction area, such as the touch ring on the Wacom Intuos
300  * Pro series tablets.
301  *
302  * Events on a ring are logically grouped by the wl_tablet_pad_ring.frame
303  * event.
304  */
305 extern const struct wl_interface zwp_tablet_pad_ring_v2_interface;
306 #endif
307 #ifndef ZWP_TABLET_PAD_STRIP_V2_INTERFACE
308 #define ZWP_TABLET_PAD_STRIP_V2_INTERFACE
309 /**
310  * @page page_iface_zwp_tablet_pad_strip_v2 zwp_tablet_pad_strip_v2
311  * @section page_iface_zwp_tablet_pad_strip_v2_desc Description
312  *
313  * A linear interaction area, such as the strips found in Wacom Cintiq
314  * models.
315  *
316  * Events on a strip are logically grouped by the wl_tablet_pad_strip.frame
317  * event.
318  * @section page_iface_zwp_tablet_pad_strip_v2_api API
319  * See @ref iface_zwp_tablet_pad_strip_v2.
320  */
321 /**
322  * @defgroup iface_zwp_tablet_pad_strip_v2 The zwp_tablet_pad_strip_v2 interface
323  *
324  * A linear interaction area, such as the strips found in Wacom Cintiq
325  * models.
326  *
327  * Events on a strip are logically grouped by the wl_tablet_pad_strip.frame
328  * event.
329  */
330 extern const struct wl_interface zwp_tablet_pad_strip_v2_interface;
331 #endif
332 #ifndef ZWP_TABLET_PAD_GROUP_V2_INTERFACE
333 #define ZWP_TABLET_PAD_GROUP_V2_INTERFACE
334 /**
335  * @page page_iface_zwp_tablet_pad_group_v2 zwp_tablet_pad_group_v2
336  * @section page_iface_zwp_tablet_pad_group_v2_desc Description
337  *
338  * A pad group describes a distinct (sub)set of buttons, rings and strips
339  * present in the tablet. The criteria of this grouping is usually positional,
340  * eg. if a tablet has buttons on the left and right side, 2 groups will be
341  * presented. The physical arrangement of groups is undisclosed and may
342  * change on the fly.
343  *
344  * Pad groups will announce their features during pad initialization. Between
345  * the corresponding wp_tablet_pad.group event and wp_tablet_pad_group.done, the
346  * pad group will announce the buttons, rings and strips contained in it,
347  * plus the number of supported modes.
348  *
349  * Modes are a mechanism to allow multiple groups of actions for every element
350  * in the pad group. The number of groups and available modes in each is
351  * persistent across device plugs. The current mode is user-switchable, it
352  * will be announced through the wp_tablet_pad_group.mode_switch event both
353  * whenever it is switched, and after wp_tablet_pad.enter.
354  *
355  * The current mode logically applies to all elements in the pad group,
356  * although it is at clients' discretion whether to actually perform different
357  * actions, and/or issue the respective .set_feedback requests to notify the
358  * compositor. See the wp_tablet_pad_group.mode_switch event for more details.
359  * @section page_iface_zwp_tablet_pad_group_v2_api API
360  * See @ref iface_zwp_tablet_pad_group_v2.
361  */
362 /**
363  * @defgroup iface_zwp_tablet_pad_group_v2 The zwp_tablet_pad_group_v2 interface
364  *
365  * A pad group describes a distinct (sub)set of buttons, rings and strips
366  * present in the tablet. The criteria of this grouping is usually positional,
367  * eg. if a tablet has buttons on the left and right side, 2 groups will be
368  * presented. The physical arrangement of groups is undisclosed and may
369  * change on the fly.
370  *
371  * Pad groups will announce their features during pad initialization. Between
372  * the corresponding wp_tablet_pad.group event and wp_tablet_pad_group.done, the
373  * pad group will announce the buttons, rings and strips contained in it,
374  * plus the number of supported modes.
375  *
376  * Modes are a mechanism to allow multiple groups of actions for every element
377  * in the pad group. The number of groups and available modes in each is
378  * persistent across device plugs. The current mode is user-switchable, it
379  * will be announced through the wp_tablet_pad_group.mode_switch event both
380  * whenever it is switched, and after wp_tablet_pad.enter.
381  *
382  * The current mode logically applies to all elements in the pad group,
383  * although it is at clients' discretion whether to actually perform different
384  * actions, and/or issue the respective .set_feedback requests to notify the
385  * compositor. See the wp_tablet_pad_group.mode_switch event for more details.
386  */
387 extern const struct wl_interface zwp_tablet_pad_group_v2_interface;
388 #endif
389 #ifndef ZWP_TABLET_PAD_V2_INTERFACE
390 #define ZWP_TABLET_PAD_V2_INTERFACE
391 /**
392  * @page page_iface_zwp_tablet_pad_v2 zwp_tablet_pad_v2
393  * @section page_iface_zwp_tablet_pad_v2_desc Description
394  *
395  * A pad device is a set of buttons, rings and strips
396  * usually physically present on the tablet device itself. Some
397  * exceptions exist where the pad device is physically detached, e.g. the
398  * Wacom ExpressKey Remote.
399  *
400  * Pad devices have no axes that control the cursor and are generally
401  * auxiliary devices to the tool devices used on the tablet surface.
402  *
403  * A pad device has a number of static characteristics, e.g. the number
404  * of rings. These capabilities are sent in an event sequence after the
405  * wp_tablet_seat.pad_added event before any actual events from this pad.
406  * This initial event sequence is terminated by a wp_tablet_pad.done
407  * event.
408  *
409  * All pad features (buttons, rings and strips) are logically divided into
410  * groups and all pads have at least one group. The available groups are
411  * notified through the wp_tablet_pad.group event; the compositor will
412  * emit one event per group before emitting wp_tablet_pad.done.
413  *
414  * Groups may have multiple modes. Modes allow clients to map multiple
415  * actions to a single pad feature. Only one mode can be active per group,
416  * although different groups may have different active modes.
417  * @section page_iface_zwp_tablet_pad_v2_api API
418  * See @ref iface_zwp_tablet_pad_v2.
419  */
420 /**
421  * @defgroup iface_zwp_tablet_pad_v2 The zwp_tablet_pad_v2 interface
422  *
423  * A pad device is a set of buttons, rings and strips
424  * usually physically present on the tablet device itself. Some
425  * exceptions exist where the pad device is physically detached, e.g. the
426  * Wacom ExpressKey Remote.
427  *
428  * Pad devices have no axes that control the cursor and are generally
429  * auxiliary devices to the tool devices used on the tablet surface.
430  *
431  * A pad device has a number of static characteristics, e.g. the number
432  * of rings. These capabilities are sent in an event sequence after the
433  * wp_tablet_seat.pad_added event before any actual events from this pad.
434  * This initial event sequence is terminated by a wp_tablet_pad.done
435  * event.
436  *
437  * All pad features (buttons, rings and strips) are logically divided into
438  * groups and all pads have at least one group. The available groups are
439  * notified through the wp_tablet_pad.group event; the compositor will
440  * emit one event per group before emitting wp_tablet_pad.done.
441  *
442  * Groups may have multiple modes. Modes allow clients to map multiple
443  * actions to a single pad feature. Only one mode can be active per group,
444  * although different groups may have different active modes.
445  */
446 extern const struct wl_interface zwp_tablet_pad_v2_interface;
447 #endif
448 
449 #define ZWP_TABLET_MANAGER_V2_GET_TABLET_SEAT 0
450 #define ZWP_TABLET_MANAGER_V2_DESTROY 1
451 
452 
453 /**
454  * @ingroup iface_zwp_tablet_manager_v2
455  */
456 #define ZWP_TABLET_MANAGER_V2_GET_TABLET_SEAT_SINCE_VERSION 1
457 /**
458  * @ingroup iface_zwp_tablet_manager_v2
459  */
460 #define ZWP_TABLET_MANAGER_V2_DESTROY_SINCE_VERSION 1
461 
462 /** @ingroup iface_zwp_tablet_manager_v2 */
463 static inline void
zwp_tablet_manager_v2_set_user_data(struct zwp_tablet_manager_v2 * zwp_tablet_manager_v2,void * user_data)464 zwp_tablet_manager_v2_set_user_data(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2, void *user_data)
465 {
466 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_manager_v2, user_data);
467 }
468 
469 /** @ingroup iface_zwp_tablet_manager_v2 */
470 static inline void *
zwp_tablet_manager_v2_get_user_data(struct zwp_tablet_manager_v2 * zwp_tablet_manager_v2)471 zwp_tablet_manager_v2_get_user_data(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2)
472 {
473 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_manager_v2);
474 }
475 
476 static inline uint32_t
zwp_tablet_manager_v2_get_version(struct zwp_tablet_manager_v2 * zwp_tablet_manager_v2)477 zwp_tablet_manager_v2_get_version(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2)
478 {
479 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v2);
480 }
481 
482 /**
483  * @ingroup iface_zwp_tablet_manager_v2
484  *
485  * Get the wp_tablet_seat object for the given seat. This object
486  * provides access to all graphics tablets in this seat.
487  */
488 static inline struct zwp_tablet_seat_v2 *
zwp_tablet_manager_v2_get_tablet_seat(struct zwp_tablet_manager_v2 * zwp_tablet_manager_v2,struct wl_seat * seat)489 zwp_tablet_manager_v2_get_tablet_seat(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2, struct wl_seat *seat)
490 {
491 	struct wl_proxy *tablet_seat;
492 
493 	tablet_seat = wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_manager_v2,
494 			 ZWP_TABLET_MANAGER_V2_GET_TABLET_SEAT, &zwp_tablet_seat_v2_interface, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v2), 0, NULL, seat);
495 
496 	return (struct zwp_tablet_seat_v2 *) tablet_seat;
497 }
498 
499 /**
500  * @ingroup iface_zwp_tablet_manager_v2
501  *
502  * Destroy the wp_tablet_manager object. Objects created from this
503  * object are unaffected and should be destroyed separately.
504  */
505 static inline void
zwp_tablet_manager_v2_destroy(struct zwp_tablet_manager_v2 * zwp_tablet_manager_v2)506 zwp_tablet_manager_v2_destroy(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2)
507 {
508 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_manager_v2,
509 			 ZWP_TABLET_MANAGER_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v2), WL_MARSHAL_FLAG_DESTROY);
510 }
511 
512 /**
513  * @ingroup iface_zwp_tablet_seat_v2
514  * @struct zwp_tablet_seat_v2_listener
515  */
516 struct zwp_tablet_seat_v2_listener {
517 	/**
518 	 * new device notification
519 	 *
520 	 * This event is sent whenever a new tablet becomes available on
521 	 * this seat. This event only provides the object id of the tablet,
522 	 * any static information about the tablet (device name, vid/pid,
523 	 * etc.) is sent through the wp_tablet interface.
524 	 * @param id the newly added graphics tablet
525 	 */
526 	void (*tablet_added)(void *data,
527 			     struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,
528 			     struct zwp_tablet_v2 *id);
529 	/**
530 	 * a new tool has been used with a tablet
531 	 *
532 	 * This event is sent whenever a tool that has not previously
533 	 * been used with a tablet comes into use. This event only provides
534 	 * the object id of the tool; any static information about the tool
535 	 * (capabilities, type, etc.) is sent through the wp_tablet_tool
536 	 * interface.
537 	 * @param id the newly added tablet tool
538 	 */
539 	void (*tool_added)(void *data,
540 			   struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,
541 			   struct zwp_tablet_tool_v2 *id);
542 	/**
543 	 * new pad notification
544 	 *
545 	 * This event is sent whenever a new pad is known to the system.
546 	 * Typically, pads are physically attached to tablets and a
547 	 * pad_added event is sent immediately after the
548 	 * wp_tablet_seat.tablet_added. However, some standalone pad
549 	 * devices logically attach to tablets at runtime, and the client
550 	 * must wait for wp_tablet_pad.enter to know the tablet a pad is
551 	 * attached to.
552 	 *
553 	 * This event only provides the object id of the pad. All further
554 	 * features (buttons, strips, rings) are sent through the
555 	 * wp_tablet_pad interface.
556 	 * @param id the newly added pad
557 	 */
558 	void (*pad_added)(void *data,
559 			  struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,
560 			  struct zwp_tablet_pad_v2 *id);
561 };
562 
563 /**
564  * @ingroup iface_zwp_tablet_seat_v2
565  */
566 static inline int
zwp_tablet_seat_v2_add_listener(struct zwp_tablet_seat_v2 * zwp_tablet_seat_v2,const struct zwp_tablet_seat_v2_listener * listener,void * data)567 zwp_tablet_seat_v2_add_listener(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,
568 				const struct zwp_tablet_seat_v2_listener *listener, void *data)
569 {
570 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_seat_v2,
571 				     (void (**)(void)) listener, data);
572 }
573 
574 #define ZWP_TABLET_SEAT_V2_DESTROY 0
575 
576 /**
577  * @ingroup iface_zwp_tablet_seat_v2
578  */
579 #define ZWP_TABLET_SEAT_V2_TABLET_ADDED_SINCE_VERSION 1
580 /**
581  * @ingroup iface_zwp_tablet_seat_v2
582  */
583 #define ZWP_TABLET_SEAT_V2_TOOL_ADDED_SINCE_VERSION 1
584 /**
585  * @ingroup iface_zwp_tablet_seat_v2
586  */
587 #define ZWP_TABLET_SEAT_V2_PAD_ADDED_SINCE_VERSION 1
588 
589 /**
590  * @ingroup iface_zwp_tablet_seat_v2
591  */
592 #define ZWP_TABLET_SEAT_V2_DESTROY_SINCE_VERSION 1
593 
594 /** @ingroup iface_zwp_tablet_seat_v2 */
595 static inline void
zwp_tablet_seat_v2_set_user_data(struct zwp_tablet_seat_v2 * zwp_tablet_seat_v2,void * user_data)596 zwp_tablet_seat_v2_set_user_data(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2, void *user_data)
597 {
598 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_seat_v2, user_data);
599 }
600 
601 /** @ingroup iface_zwp_tablet_seat_v2 */
602 static inline void *
zwp_tablet_seat_v2_get_user_data(struct zwp_tablet_seat_v2 * zwp_tablet_seat_v2)603 zwp_tablet_seat_v2_get_user_data(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2)
604 {
605 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_seat_v2);
606 }
607 
608 static inline uint32_t
zwp_tablet_seat_v2_get_version(struct zwp_tablet_seat_v2 * zwp_tablet_seat_v2)609 zwp_tablet_seat_v2_get_version(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2)
610 {
611 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_seat_v2);
612 }
613 
614 /**
615  * @ingroup iface_zwp_tablet_seat_v2
616  *
617  * Destroy the wp_tablet_seat object. Objects created from this
618  * object are unaffected and should be destroyed separately.
619  */
620 static inline void
zwp_tablet_seat_v2_destroy(struct zwp_tablet_seat_v2 * zwp_tablet_seat_v2)621 zwp_tablet_seat_v2_destroy(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2)
622 {
623 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_seat_v2,
624 			 ZWP_TABLET_SEAT_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_seat_v2), WL_MARSHAL_FLAG_DESTROY);
625 }
626 
627 #ifndef ZWP_TABLET_TOOL_V2_TYPE_ENUM
628 #define ZWP_TABLET_TOOL_V2_TYPE_ENUM
629 /**
630  * @ingroup iface_zwp_tablet_tool_v2
631  * a physical tool type
632  *
633  * Describes the physical type of a tool. The physical type of a tool
634  * generally defines its base usage.
635  *
636  * The mouse tool represents a mouse-shaped tool that is not a relative
637  * device but bound to the tablet's surface, providing absolute
638  * coordinates.
639  *
640  * The lens tool is a mouse-shaped tool with an attached lens to
641  * provide precision focus.
642  */
643 enum zwp_tablet_tool_v2_type {
644 	/**
645 	 * Pen
646 	 */
647 	ZWP_TABLET_TOOL_V2_TYPE_PEN = 0x140,
648 	/**
649 	 * Eraser
650 	 */
651 	ZWP_TABLET_TOOL_V2_TYPE_ERASER = 0x141,
652 	/**
653 	 * Brush
654 	 */
655 	ZWP_TABLET_TOOL_V2_TYPE_BRUSH = 0x142,
656 	/**
657 	 * Pencil
658 	 */
659 	ZWP_TABLET_TOOL_V2_TYPE_PENCIL = 0x143,
660 	/**
661 	 * Airbrush
662 	 */
663 	ZWP_TABLET_TOOL_V2_TYPE_AIRBRUSH = 0x144,
664 	/**
665 	 * Finger
666 	 */
667 	ZWP_TABLET_TOOL_V2_TYPE_FINGER = 0x145,
668 	/**
669 	 * Mouse
670 	 */
671 	ZWP_TABLET_TOOL_V2_TYPE_MOUSE = 0x146,
672 	/**
673 	 * Lens
674 	 */
675 	ZWP_TABLET_TOOL_V2_TYPE_LENS = 0x147,
676 };
677 #endif /* ZWP_TABLET_TOOL_V2_TYPE_ENUM */
678 
679 #ifndef ZWP_TABLET_TOOL_V2_CAPABILITY_ENUM
680 #define ZWP_TABLET_TOOL_V2_CAPABILITY_ENUM
681 /**
682  * @ingroup iface_zwp_tablet_tool_v2
683  * capability flags for a tool
684  *
685  * Describes extra capabilities on a tablet.
686  *
687  * Any tool must provide x and y values, extra axes are
688  * device-specific.
689  */
690 enum zwp_tablet_tool_v2_capability {
691 	/**
692 	 * Tilt axes
693 	 */
694 	ZWP_TABLET_TOOL_V2_CAPABILITY_TILT = 1,
695 	/**
696 	 * Pressure axis
697 	 */
698 	ZWP_TABLET_TOOL_V2_CAPABILITY_PRESSURE = 2,
699 	/**
700 	 * Distance axis
701 	 */
702 	ZWP_TABLET_TOOL_V2_CAPABILITY_DISTANCE = 3,
703 	/**
704 	 * Z-rotation axis
705 	 */
706 	ZWP_TABLET_TOOL_V2_CAPABILITY_ROTATION = 4,
707 	/**
708 	 * Slider axis
709 	 */
710 	ZWP_TABLET_TOOL_V2_CAPABILITY_SLIDER = 5,
711 	/**
712 	 * Wheel axis
713 	 */
714 	ZWP_TABLET_TOOL_V2_CAPABILITY_WHEEL = 6,
715 };
716 #endif /* ZWP_TABLET_TOOL_V2_CAPABILITY_ENUM */
717 
718 #ifndef ZWP_TABLET_TOOL_V2_BUTTON_STATE_ENUM
719 #define ZWP_TABLET_TOOL_V2_BUTTON_STATE_ENUM
720 /**
721  * @ingroup iface_zwp_tablet_tool_v2
722  * physical button state
723  *
724  * Describes the physical state of a button that produced the button event.
725  */
726 enum zwp_tablet_tool_v2_button_state {
727 	/**
728 	 * button is not pressed
729 	 */
730 	ZWP_TABLET_TOOL_V2_BUTTON_STATE_RELEASED = 0,
731 	/**
732 	 * button is pressed
733 	 */
734 	ZWP_TABLET_TOOL_V2_BUTTON_STATE_PRESSED = 1,
735 };
736 #endif /* ZWP_TABLET_TOOL_V2_BUTTON_STATE_ENUM */
737 
738 #ifndef ZWP_TABLET_TOOL_V2_ERROR_ENUM
739 #define ZWP_TABLET_TOOL_V2_ERROR_ENUM
740 enum zwp_tablet_tool_v2_error {
741 	/**
742 	 * given wl_surface has another role
743 	 */
744 	ZWP_TABLET_TOOL_V2_ERROR_ROLE = 0,
745 };
746 #endif /* ZWP_TABLET_TOOL_V2_ERROR_ENUM */
747 
748 /**
749  * @ingroup iface_zwp_tablet_tool_v2
750  * @struct zwp_tablet_tool_v2_listener
751  */
752 struct zwp_tablet_tool_v2_listener {
753 	/**
754 	 * tool type
755 	 *
756 	 * The tool type is the high-level type of the tool and usually
757 	 * decides the interaction expected from this tool.
758 	 *
759 	 * This event is sent in the initial burst of events before the
760 	 * wp_tablet_tool.done event.
761 	 * @param tool_type the physical tool type
762 	 */
763 	void (*type)(void *data,
764 		     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
765 		     uint32_t tool_type);
766 	/**
767 	 * unique hardware serial number of the tool
768 	 *
769 	 * If the physical tool can be identified by a unique 64-bit
770 	 * serial number, this event notifies the client of this serial
771 	 * number.
772 	 *
773 	 * If multiple tablets are available in the same seat and the tool
774 	 * is uniquely identifiable by the serial number, that tool may
775 	 * move between tablets.
776 	 *
777 	 * Otherwise, if the tool has no serial number and this event is
778 	 * missing, the tool is tied to the tablet it first comes into
779 	 * proximity with. Even if the physical tool is used on multiple
780 	 * tablets, separate wp_tablet_tool objects will be created, one
781 	 * per tablet.
782 	 *
783 	 * This event is sent in the initial burst of events before the
784 	 * wp_tablet_tool.done event.
785 	 * @param hardware_serial_hi the unique serial number of the tool, most significant bits
786 	 * @param hardware_serial_lo the unique serial number of the tool, least significant bits
787 	 */
788 	void (*hardware_serial)(void *data,
789 				struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
790 				uint32_t hardware_serial_hi,
791 				uint32_t hardware_serial_lo);
792 	/**
793 	 * hardware id notification in Wacom's format
794 	 *
795 	 * This event notifies the client of a hardware id available on
796 	 * this tool.
797 	 *
798 	 * The hardware id is a device-specific 64-bit id that provides
799 	 * extra information about the tool in use, beyond the wl_tool.type
800 	 * enumeration. The format of the id is specific to tablets made by
801 	 * Wacom Inc. For example, the hardware id of a Wacom Grip Pen (a
802 	 * stylus) is 0x802.
803 	 *
804 	 * This event is sent in the initial burst of events before the
805 	 * wp_tablet_tool.done event.
806 	 * @param hardware_id_hi the hardware id, most significant bits
807 	 * @param hardware_id_lo the hardware id, least significant bits
808 	 */
809 	void (*hardware_id_wacom)(void *data,
810 				  struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
811 				  uint32_t hardware_id_hi,
812 				  uint32_t hardware_id_lo);
813 	/**
814 	 * tool capability notification
815 	 *
816 	 * This event notifies the client of any capabilities of this
817 	 * tool, beyond the main set of x/y axes and tip up/down detection.
818 	 *
819 	 * One event is sent for each extra capability available on this
820 	 * tool.
821 	 *
822 	 * This event is sent in the initial burst of events before the
823 	 * wp_tablet_tool.done event.
824 	 * @param capability the capability
825 	 */
826 	void (*capability)(void *data,
827 			   struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
828 			   uint32_t capability);
829 	/**
830 	 * tool description events sequence complete
831 	 *
832 	 * This event signals the end of the initial burst of descriptive
833 	 * events. A client may consider the static description of the tool
834 	 * to be complete and finalize initialization of the tool.
835 	 */
836 	void (*done)(void *data,
837 		     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);
838 	/**
839 	 * tool removed
840 	 *
841 	 * This event is sent when the tool is removed from the system
842 	 * and will send no further events. Should the physical tool come
843 	 * back into proximity later, a new wp_tablet_tool object will be
844 	 * created.
845 	 *
846 	 * It is compositor-dependent when a tool is removed. A compositor
847 	 * may remove a tool on proximity out, tablet removal or any other
848 	 * reason. A compositor may also keep a tool alive until shutdown.
849 	 *
850 	 * If the tool is currently in proximity, a proximity_out event
851 	 * will be sent before the removed event. See
852 	 * wp_tablet_tool.proximity_out for the handling of any buttons
853 	 * logically down.
854 	 *
855 	 * When this event is received, the client must
856 	 * wp_tablet_tool.destroy the object.
857 	 */
858 	void (*removed)(void *data,
859 			struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);
860 	/**
861 	 * proximity in event
862 	 *
863 	 * Notification that this tool is focused on a certain surface.
864 	 *
865 	 * This event can be received when the tool has moved from one
866 	 * surface to another, or when the tool has come back into
867 	 * proximity above the surface.
868 	 *
869 	 * If any button is logically down when the tool comes into
870 	 * proximity, the respective button event is sent after the
871 	 * proximity_in event but within the same frame as the proximity_in
872 	 * event.
873 	 * @param tablet The tablet the tool is in proximity of
874 	 * @param surface The current surface the tablet tool is over
875 	 */
876 	void (*proximity_in)(void *data,
877 			     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
878 			     uint32_t serial,
879 			     struct zwp_tablet_v2 *tablet,
880 			     struct wl_surface *surface);
881 	/**
882 	 * proximity out event
883 	 *
884 	 * Notification that this tool has either left proximity, or is
885 	 * no longer focused on a certain surface.
886 	 *
887 	 * When the tablet tool leaves proximity of the tablet, button
888 	 * release events are sent for each button that was held down at
889 	 * the time of leaving proximity. These events are sent before the
890 	 * proximity_out event but within the same wp_tablet.frame.
891 	 *
892 	 * If the tool stays within proximity of the tablet, but the focus
893 	 * changes from one surface to another, a button release event may
894 	 * not be sent until the button is actually released or the tool
895 	 * leaves the proximity of the tablet.
896 	 */
897 	void (*proximity_out)(void *data,
898 			      struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);
899 	/**
900 	 * tablet tool is making contact
901 	 *
902 	 * Sent whenever the tablet tool comes in contact with the
903 	 * surface of the tablet.
904 	 *
905 	 * If the tool is already in contact with the tablet when entering
906 	 * the input region, the client owning said region will receive a
907 	 * wp_tablet.proximity_in event, followed by a wp_tablet.down event
908 	 * and a wp_tablet.frame event.
909 	 *
910 	 * Note that this event describes logical contact, not physical
911 	 * contact. On some devices, a compositor may not consider a tool
912 	 * in logical contact until a minimum physical pressure threshold
913 	 * is exceeded.
914 	 */
915 	void (*down)(void *data,
916 		     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
917 		     uint32_t serial);
918 	/**
919 	 * tablet tool is no longer making contact
920 	 *
921 	 * Sent whenever the tablet tool stops making contact with the
922 	 * surface of the tablet, or when the tablet tool moves out of the
923 	 * input region and the compositor grab (if any) is dismissed.
924 	 *
925 	 * If the tablet tool moves out of the input region while in
926 	 * contact with the surface of the tablet and the compositor does
927 	 * not have an ongoing grab on the surface, the client owning said
928 	 * region will receive a wp_tablet.up event, followed by a
929 	 * wp_tablet.proximity_out event and a wp_tablet.frame event. If
930 	 * the compositor has an ongoing grab on this device, this event
931 	 * sequence is sent whenever the grab is dismissed in the future.
932 	 *
933 	 * Note that this event describes logical contact, not physical
934 	 * contact. On some devices, a compositor may not consider a tool
935 	 * out of logical contact until physical pressure falls below a
936 	 * specific threshold.
937 	 */
938 	void (*up)(void *data,
939 		   struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);
940 	/**
941 	 * motion event
942 	 *
943 	 * Sent whenever a tablet tool moves.
944 	 * @param x surface-local x coordinate
945 	 * @param y surface-local y coordinate
946 	 */
947 	void (*motion)(void *data,
948 		       struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
949 		       wl_fixed_t x,
950 		       wl_fixed_t y);
951 	/**
952 	 * pressure change event
953 	 *
954 	 * Sent whenever the pressure axis on a tool changes. The value
955 	 * of this event is normalized to a value between 0 and 65535.
956 	 *
957 	 * Note that pressure may be nonzero even when a tool is not in
958 	 * logical contact. See the down and up events for more details.
959 	 * @param pressure The current pressure value
960 	 */
961 	void (*pressure)(void *data,
962 			 struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
963 			 uint32_t pressure);
964 	/**
965 	 * distance change event
966 	 *
967 	 * Sent whenever the distance axis on a tool changes. The value
968 	 * of this event is normalized to a value between 0 and 65535.
969 	 *
970 	 * Note that distance may be nonzero even when a tool is not in
971 	 * logical contact. See the down and up events for more details.
972 	 * @param distance The current distance value
973 	 */
974 	void (*distance)(void *data,
975 			 struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
976 			 uint32_t distance);
977 	/**
978 	 * tilt change event
979 	 *
980 	 * Sent whenever one or both of the tilt axes on a tool change.
981 	 * Each tilt value is in degrees, relative to the z-axis of the
982 	 * tablet. The angle is positive when the top of a tool tilts along
983 	 * the positive x or y axis.
984 	 * @param tilt_x The current value of the X tilt axis
985 	 * @param tilt_y The current value of the Y tilt axis
986 	 */
987 	void (*tilt)(void *data,
988 		     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
989 		     wl_fixed_t tilt_x,
990 		     wl_fixed_t tilt_y);
991 	/**
992 	 * z-rotation change event
993 	 *
994 	 * Sent whenever the z-rotation axis on the tool changes. The
995 	 * rotation value is in degrees clockwise from the tool's logical
996 	 * neutral position.
997 	 * @param degrees The current rotation of the Z axis
998 	 */
999 	void (*rotation)(void *data,
1000 			 struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
1001 			 wl_fixed_t degrees);
1002 	/**
1003 	 * Slider position change event
1004 	 *
1005 	 * Sent whenever the slider position on the tool changes. The
1006 	 * value is normalized between -65535 and 65535, with 0 as the
1007 	 * logical neutral position of the slider.
1008 	 *
1009 	 * The slider is available on e.g. the Wacom Airbrush tool.
1010 	 * @param position The current position of slider
1011 	 */
1012 	void (*slider)(void *data,
1013 		       struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
1014 		       int32_t position);
1015 	/**
1016 	 * Wheel delta event
1017 	 *
1018 	 * Sent whenever the wheel on the tool emits an event. This event
1019 	 * contains two values for the same axis change. The degrees value
1020 	 * is in the same orientation as the wl_pointer.vertical_scroll
1021 	 * axis. The clicks value is in discrete logical clicks of the
1022 	 * mouse wheel. This value may be zero if the movement of the wheel
1023 	 * was less than one logical click.
1024 	 *
1025 	 * Clients should choose either value and avoid mixing degrees and
1026 	 * clicks. The compositor may accumulate values smaller than a
1027 	 * logical click and emulate click events when a certain threshold
1028 	 * is met. Thus, wl_tablet_tool.wheel events with non-zero clicks
1029 	 * values may have different degrees values.
1030 	 * @param degrees The wheel delta in degrees
1031 	 * @param clicks The wheel delta in discrete clicks
1032 	 */
1033 	void (*wheel)(void *data,
1034 		      struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
1035 		      wl_fixed_t degrees,
1036 		      int32_t clicks);
1037 	/**
1038 	 * button event
1039 	 *
1040 	 * Sent whenever a button on the tool is pressed or released.
1041 	 *
1042 	 * If a button is held down when the tool moves in or out of
1043 	 * proximity, button events are generated by the compositor. See
1044 	 * wp_tablet_tool.proximity_in and wp_tablet_tool.proximity_out for
1045 	 * details.
1046 	 * @param button The button whose state has changed
1047 	 * @param state Whether the button was pressed or released
1048 	 */
1049 	void (*button)(void *data,
1050 		       struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
1051 		       uint32_t serial,
1052 		       uint32_t button,
1053 		       uint32_t state);
1054 	/**
1055 	 * frame event
1056 	 *
1057 	 * Marks the end of a series of axis and/or button updates from
1058 	 * the tablet. The Wayland protocol requires axis updates to be
1059 	 * sent sequentially, however all events within a frame should be
1060 	 * considered one hardware event.
1061 	 * @param time The time of the event with millisecond granularity
1062 	 */
1063 	void (*frame)(void *data,
1064 		      struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
1065 		      uint32_t time);
1066 };
1067 
1068 /**
1069  * @ingroup iface_zwp_tablet_tool_v2
1070  */
1071 static inline int
zwp_tablet_tool_v2_add_listener(struct zwp_tablet_tool_v2 * zwp_tablet_tool_v2,const struct zwp_tablet_tool_v2_listener * listener,void * data)1072 zwp_tablet_tool_v2_add_listener(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,
1073 				const struct zwp_tablet_tool_v2_listener *listener, void *data)
1074 {
1075 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_tool_v2,
1076 				     (void (**)(void)) listener, data);
1077 }
1078 
1079 #define ZWP_TABLET_TOOL_V2_SET_CURSOR 0
1080 #define ZWP_TABLET_TOOL_V2_DESTROY 1
1081 
1082 /**
1083  * @ingroup iface_zwp_tablet_tool_v2
1084  */
1085 #define ZWP_TABLET_TOOL_V2_TYPE_SINCE_VERSION 1
1086 /**
1087  * @ingroup iface_zwp_tablet_tool_v2
1088  */
1089 #define ZWP_TABLET_TOOL_V2_HARDWARE_SERIAL_SINCE_VERSION 1
1090 /**
1091  * @ingroup iface_zwp_tablet_tool_v2
1092  */
1093 #define ZWP_TABLET_TOOL_V2_HARDWARE_ID_WACOM_SINCE_VERSION 1
1094 /**
1095  * @ingroup iface_zwp_tablet_tool_v2
1096  */
1097 #define ZWP_TABLET_TOOL_V2_CAPABILITY_SINCE_VERSION 1
1098 /**
1099  * @ingroup iface_zwp_tablet_tool_v2
1100  */
1101 #define ZWP_TABLET_TOOL_V2_DONE_SINCE_VERSION 1
1102 /**
1103  * @ingroup iface_zwp_tablet_tool_v2
1104  */
1105 #define ZWP_TABLET_TOOL_V2_REMOVED_SINCE_VERSION 1
1106 /**
1107  * @ingroup iface_zwp_tablet_tool_v2
1108  */
1109 #define ZWP_TABLET_TOOL_V2_PROXIMITY_IN_SINCE_VERSION 1
1110 /**
1111  * @ingroup iface_zwp_tablet_tool_v2
1112  */
1113 #define ZWP_TABLET_TOOL_V2_PROXIMITY_OUT_SINCE_VERSION 1
1114 /**
1115  * @ingroup iface_zwp_tablet_tool_v2
1116  */
1117 #define ZWP_TABLET_TOOL_V2_DOWN_SINCE_VERSION 1
1118 /**
1119  * @ingroup iface_zwp_tablet_tool_v2
1120  */
1121 #define ZWP_TABLET_TOOL_V2_UP_SINCE_VERSION 1
1122 /**
1123  * @ingroup iface_zwp_tablet_tool_v2
1124  */
1125 #define ZWP_TABLET_TOOL_V2_MOTION_SINCE_VERSION 1
1126 /**
1127  * @ingroup iface_zwp_tablet_tool_v2
1128  */
1129 #define ZWP_TABLET_TOOL_V2_PRESSURE_SINCE_VERSION 1
1130 /**
1131  * @ingroup iface_zwp_tablet_tool_v2
1132  */
1133 #define ZWP_TABLET_TOOL_V2_DISTANCE_SINCE_VERSION 1
1134 /**
1135  * @ingroup iface_zwp_tablet_tool_v2
1136  */
1137 #define ZWP_TABLET_TOOL_V2_TILT_SINCE_VERSION 1
1138 /**
1139  * @ingroup iface_zwp_tablet_tool_v2
1140  */
1141 #define ZWP_TABLET_TOOL_V2_ROTATION_SINCE_VERSION 1
1142 /**
1143  * @ingroup iface_zwp_tablet_tool_v2
1144  */
1145 #define ZWP_TABLET_TOOL_V2_SLIDER_SINCE_VERSION 1
1146 /**
1147  * @ingroup iface_zwp_tablet_tool_v2
1148  */
1149 #define ZWP_TABLET_TOOL_V2_WHEEL_SINCE_VERSION 1
1150 /**
1151  * @ingroup iface_zwp_tablet_tool_v2
1152  */
1153 #define ZWP_TABLET_TOOL_V2_BUTTON_SINCE_VERSION 1
1154 /**
1155  * @ingroup iface_zwp_tablet_tool_v2
1156  */
1157 #define ZWP_TABLET_TOOL_V2_FRAME_SINCE_VERSION 1
1158 
1159 /**
1160  * @ingroup iface_zwp_tablet_tool_v2
1161  */
1162 #define ZWP_TABLET_TOOL_V2_SET_CURSOR_SINCE_VERSION 1
1163 /**
1164  * @ingroup iface_zwp_tablet_tool_v2
1165  */
1166 #define ZWP_TABLET_TOOL_V2_DESTROY_SINCE_VERSION 1
1167 
1168 /** @ingroup iface_zwp_tablet_tool_v2 */
1169 static inline void
zwp_tablet_tool_v2_set_user_data(struct zwp_tablet_tool_v2 * zwp_tablet_tool_v2,void * user_data)1170 zwp_tablet_tool_v2_set_user_data(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2, void *user_data)
1171 {
1172 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_tool_v2, user_data);
1173 }
1174 
1175 /** @ingroup iface_zwp_tablet_tool_v2 */
1176 static inline void *
zwp_tablet_tool_v2_get_user_data(struct zwp_tablet_tool_v2 * zwp_tablet_tool_v2)1177 zwp_tablet_tool_v2_get_user_data(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2)
1178 {
1179 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_tool_v2);
1180 }
1181 
1182 static inline uint32_t
zwp_tablet_tool_v2_get_version(struct zwp_tablet_tool_v2 * zwp_tablet_tool_v2)1183 zwp_tablet_tool_v2_get_version(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2)
1184 {
1185 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v2);
1186 }
1187 
1188 /**
1189  * @ingroup iface_zwp_tablet_tool_v2
1190  *
1191  * Sets the surface of the cursor used for this tool on the given
1192  * tablet. This request only takes effect if the tool is in proximity
1193  * of one of the requesting client's surfaces or the surface parameter
1194  * is the current pointer surface. If there was a previous surface set
1195  * with this request it is replaced. If surface is NULL, the cursor
1196  * image is hidden.
1197  *
1198  * The parameters hotspot_x and hotspot_y define the position of the
1199  * pointer surface relative to the pointer location. Its top-left corner
1200  * is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the
1201  * coordinates of the pointer location, in surface-local coordinates.
1202  *
1203  * On surface.attach requests to the pointer surface, hotspot_x and
1204  * hotspot_y are decremented by the x and y parameters passed to the
1205  * request. Attach must be confirmed by wl_surface.commit as usual.
1206  *
1207  * The hotspot can also be updated by passing the currently set pointer
1208  * surface to this request with new values for hotspot_x and hotspot_y.
1209  *
1210  * The current and pending input regions of the wl_surface are cleared,
1211  * and wl_surface.set_input_region is ignored until the wl_surface is no
1212  * longer used as the cursor. When the use as a cursor ends, the current
1213  * and pending input regions become undefined, and the wl_surface is
1214  * unmapped.
1215  *
1216  * This request gives the surface the role of a wp_tablet_tool cursor. A
1217  * surface may only ever be used as the cursor surface for one
1218  * wp_tablet_tool. If the surface already has another role or has
1219  * previously been used as cursor surface for a different tool, a
1220  * protocol error is raised.
1221  */
1222 static inline void
zwp_tablet_tool_v2_set_cursor(struct zwp_tablet_tool_v2 * zwp_tablet_tool_v2,uint32_t serial,struct wl_surface * surface,int32_t hotspot_x,int32_t hotspot_y)1223 zwp_tablet_tool_v2_set_cursor(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)
1224 {
1225 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_tool_v2,
1226 			 ZWP_TABLET_TOOL_V2_SET_CURSOR, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v2), 0, serial, surface, hotspot_x, hotspot_y);
1227 }
1228 
1229 /**
1230  * @ingroup iface_zwp_tablet_tool_v2
1231  *
1232  * This destroys the client's resource for this tool object.
1233  */
1234 static inline void
zwp_tablet_tool_v2_destroy(struct zwp_tablet_tool_v2 * zwp_tablet_tool_v2)1235 zwp_tablet_tool_v2_destroy(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2)
1236 {
1237 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_tool_v2,
1238 			 ZWP_TABLET_TOOL_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v2), WL_MARSHAL_FLAG_DESTROY);
1239 }
1240 
1241 /**
1242  * @ingroup iface_zwp_tablet_v2
1243  * @struct zwp_tablet_v2_listener
1244  */
1245 struct zwp_tablet_v2_listener {
1246 	/**
1247 	 * tablet device name
1248 	 *
1249 	 * This event is sent in the initial burst of events before the
1250 	 * wp_tablet.done event.
1251 	 * @param name the device name
1252 	 */
1253 	void (*name)(void *data,
1254 		     struct zwp_tablet_v2 *zwp_tablet_v2,
1255 		     const char *name);
1256 	/**
1257 	 * tablet device USB vendor/product id
1258 	 *
1259 	 * This event is sent in the initial burst of events before the
1260 	 * wp_tablet.done event.
1261 	 * @param vid USB vendor id
1262 	 * @param pid USB product id
1263 	 */
1264 	void (*id)(void *data,
1265 		   struct zwp_tablet_v2 *zwp_tablet_v2,
1266 		   uint32_t vid,
1267 		   uint32_t pid);
1268 	/**
1269 	 * path to the device
1270 	 *
1271 	 * A system-specific device path that indicates which device is
1272 	 * behind this wp_tablet. This information may be used to gather
1273 	 * additional information about the device, e.g. through libwacom.
1274 	 *
1275 	 * A device may have more than one device path. If so, multiple
1276 	 * wp_tablet.path events are sent. A device may be emulated and not
1277 	 * have a device path, and in that case this event will not be
1278 	 * sent.
1279 	 *
1280 	 * The format of the path is unspecified, it may be a device node,
1281 	 * a sysfs path, or some other identifier. It is up to the client
1282 	 * to identify the string provided.
1283 	 *
1284 	 * This event is sent in the initial burst of events before the
1285 	 * wp_tablet.done event.
1286 	 * @param path path to local device
1287 	 */
1288 	void (*path)(void *data,
1289 		     struct zwp_tablet_v2 *zwp_tablet_v2,
1290 		     const char *path);
1291 	/**
1292 	 * tablet description events sequence complete
1293 	 *
1294 	 * This event is sent immediately to signal the end of the
1295 	 * initial burst of descriptive events. A client may consider the
1296 	 * static description of the tablet to be complete and finalize
1297 	 * initialization of the tablet.
1298 	 */
1299 	void (*done)(void *data,
1300 		     struct zwp_tablet_v2 *zwp_tablet_v2);
1301 	/**
1302 	 * tablet removed event
1303 	 *
1304 	 * Sent when the tablet has been removed from the system. When a
1305 	 * tablet is removed, some tools may be removed.
1306 	 *
1307 	 * When this event is received, the client must wp_tablet.destroy
1308 	 * the object.
1309 	 */
1310 	void (*removed)(void *data,
1311 			struct zwp_tablet_v2 *zwp_tablet_v2);
1312 };
1313 
1314 /**
1315  * @ingroup iface_zwp_tablet_v2
1316  */
1317 static inline int
zwp_tablet_v2_add_listener(struct zwp_tablet_v2 * zwp_tablet_v2,const struct zwp_tablet_v2_listener * listener,void * data)1318 zwp_tablet_v2_add_listener(struct zwp_tablet_v2 *zwp_tablet_v2,
1319 			   const struct zwp_tablet_v2_listener *listener, void *data)
1320 {
1321 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_v2,
1322 				     (void (**)(void)) listener, data);
1323 }
1324 
1325 #define ZWP_TABLET_V2_DESTROY 0
1326 
1327 /**
1328  * @ingroup iface_zwp_tablet_v2
1329  */
1330 #define ZWP_TABLET_V2_NAME_SINCE_VERSION 1
1331 /**
1332  * @ingroup iface_zwp_tablet_v2
1333  */
1334 #define ZWP_TABLET_V2_ID_SINCE_VERSION 1
1335 /**
1336  * @ingroup iface_zwp_tablet_v2
1337  */
1338 #define ZWP_TABLET_V2_PATH_SINCE_VERSION 1
1339 /**
1340  * @ingroup iface_zwp_tablet_v2
1341  */
1342 #define ZWP_TABLET_V2_DONE_SINCE_VERSION 1
1343 /**
1344  * @ingroup iface_zwp_tablet_v2
1345  */
1346 #define ZWP_TABLET_V2_REMOVED_SINCE_VERSION 1
1347 
1348 /**
1349  * @ingroup iface_zwp_tablet_v2
1350  */
1351 #define ZWP_TABLET_V2_DESTROY_SINCE_VERSION 1
1352 
1353 /** @ingroup iface_zwp_tablet_v2 */
1354 static inline void
zwp_tablet_v2_set_user_data(struct zwp_tablet_v2 * zwp_tablet_v2,void * user_data)1355 zwp_tablet_v2_set_user_data(struct zwp_tablet_v2 *zwp_tablet_v2, void *user_data)
1356 {
1357 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_v2, user_data);
1358 }
1359 
1360 /** @ingroup iface_zwp_tablet_v2 */
1361 static inline void *
zwp_tablet_v2_get_user_data(struct zwp_tablet_v2 * zwp_tablet_v2)1362 zwp_tablet_v2_get_user_data(struct zwp_tablet_v2 *zwp_tablet_v2)
1363 {
1364 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_v2);
1365 }
1366 
1367 static inline uint32_t
zwp_tablet_v2_get_version(struct zwp_tablet_v2 * zwp_tablet_v2)1368 zwp_tablet_v2_get_version(struct zwp_tablet_v2 *zwp_tablet_v2)
1369 {
1370 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_v2);
1371 }
1372 
1373 /**
1374  * @ingroup iface_zwp_tablet_v2
1375  *
1376  * This destroys the client's resource for this tablet object.
1377  */
1378 static inline void
zwp_tablet_v2_destroy(struct zwp_tablet_v2 * zwp_tablet_v2)1379 zwp_tablet_v2_destroy(struct zwp_tablet_v2 *zwp_tablet_v2)
1380 {
1381 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_v2,
1382 			 ZWP_TABLET_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_v2), WL_MARSHAL_FLAG_DESTROY);
1383 }
1384 
1385 #ifndef ZWP_TABLET_PAD_RING_V2_SOURCE_ENUM
1386 #define ZWP_TABLET_PAD_RING_V2_SOURCE_ENUM
1387 /**
1388  * @ingroup iface_zwp_tablet_pad_ring_v2
1389  * ring axis source
1390  *
1391  * Describes the source types for ring events. This indicates to the
1392  * client how a ring event was physically generated; a client may
1393  * adjust the user interface accordingly. For example, events
1394  * from a "finger" source may trigger kinetic scrolling.
1395  */
1396 enum zwp_tablet_pad_ring_v2_source {
1397 	/**
1398 	 * finger
1399 	 */
1400 	ZWP_TABLET_PAD_RING_V2_SOURCE_FINGER = 1,
1401 };
1402 #endif /* ZWP_TABLET_PAD_RING_V2_SOURCE_ENUM */
1403 
1404 /**
1405  * @ingroup iface_zwp_tablet_pad_ring_v2
1406  * @struct zwp_tablet_pad_ring_v2_listener
1407  */
1408 struct zwp_tablet_pad_ring_v2_listener {
1409 	/**
1410 	 * ring event source
1411 	 *
1412 	 * Source information for ring events.
1413 	 *
1414 	 * This event does not occur on its own. It is sent before a
1415 	 * wp_tablet_pad_ring.frame event and carries the source
1416 	 * information for all events within that frame.
1417 	 *
1418 	 * The source specifies how this event was generated. If the source
1419 	 * is wp_tablet_pad_ring.source.finger, a wp_tablet_pad_ring.stop
1420 	 * event will be sent when the user lifts the finger off the
1421 	 * device.
1422 	 *
1423 	 * This event is optional. If the source is unknown for an
1424 	 * interaction, no event is sent.
1425 	 * @param source the event source
1426 	 */
1427 	void (*source)(void *data,
1428 		       struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,
1429 		       uint32_t source);
1430 	/**
1431 	 * angle changed
1432 	 *
1433 	 * Sent whenever the angle on a ring changes.
1434 	 *
1435 	 * The angle is provided in degrees clockwise from the logical
1436 	 * north of the ring in the pad's current rotation.
1437 	 * @param degrees the current angle in degrees
1438 	 */
1439 	void (*angle)(void *data,
1440 		      struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,
1441 		      wl_fixed_t degrees);
1442 	/**
1443 	 * interaction stopped
1444 	 *
1445 	 * Stop notification for ring events.
1446 	 *
1447 	 * For some wp_tablet_pad_ring.source types, a
1448 	 * wp_tablet_pad_ring.stop event is sent to notify a client that
1449 	 * the interaction with the ring has terminated. This enables the
1450 	 * client to implement kinetic scrolling. See the
1451 	 * wp_tablet_pad_ring.source documentation for information on when
1452 	 * this event may be generated.
1453 	 *
1454 	 * Any wp_tablet_pad_ring.angle events with the same source after
1455 	 * this event should be considered as the start of a new
1456 	 * interaction.
1457 	 */
1458 	void (*stop)(void *data,
1459 		     struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2);
1460 	/**
1461 	 * end of a ring event sequence
1462 	 *
1463 	 * Indicates the end of a set of ring events that logically
1464 	 * belong together. A client is expected to accumulate the data in
1465 	 * all events within the frame before proceeding.
1466 	 *
1467 	 * All wp_tablet_pad_ring events before a wp_tablet_pad_ring.frame
1468 	 * event belong logically together. For example, on termination of
1469 	 * a finger interaction on a ring the compositor will send a
1470 	 * wp_tablet_pad_ring.source event, a wp_tablet_pad_ring.stop event
1471 	 * and a wp_tablet_pad_ring.frame event.
1472 	 *
1473 	 * A wp_tablet_pad_ring.frame event is sent for every logical event
1474 	 * group, even if the group only contains a single
1475 	 * wp_tablet_pad_ring event. Specifically, a client may get a
1476 	 * sequence: angle, frame, angle, frame, etc.
1477 	 * @param time timestamp with millisecond granularity
1478 	 */
1479 	void (*frame)(void *data,
1480 		      struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,
1481 		      uint32_t time);
1482 };
1483 
1484 /**
1485  * @ingroup iface_zwp_tablet_pad_ring_v2
1486  */
1487 static inline int
zwp_tablet_pad_ring_v2_add_listener(struct zwp_tablet_pad_ring_v2 * zwp_tablet_pad_ring_v2,const struct zwp_tablet_pad_ring_v2_listener * listener,void * data)1488 zwp_tablet_pad_ring_v2_add_listener(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,
1489 				    const struct zwp_tablet_pad_ring_v2_listener *listener, void *data)
1490 {
1491 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_ring_v2,
1492 				     (void (**)(void)) listener, data);
1493 }
1494 
1495 #define ZWP_TABLET_PAD_RING_V2_SET_FEEDBACK 0
1496 #define ZWP_TABLET_PAD_RING_V2_DESTROY 1
1497 
1498 /**
1499  * @ingroup iface_zwp_tablet_pad_ring_v2
1500  */
1501 #define ZWP_TABLET_PAD_RING_V2_SOURCE_SINCE_VERSION 1
1502 /**
1503  * @ingroup iface_zwp_tablet_pad_ring_v2
1504  */
1505 #define ZWP_TABLET_PAD_RING_V2_ANGLE_SINCE_VERSION 1
1506 /**
1507  * @ingroup iface_zwp_tablet_pad_ring_v2
1508  */
1509 #define ZWP_TABLET_PAD_RING_V2_STOP_SINCE_VERSION 1
1510 /**
1511  * @ingroup iface_zwp_tablet_pad_ring_v2
1512  */
1513 #define ZWP_TABLET_PAD_RING_V2_FRAME_SINCE_VERSION 1
1514 
1515 /**
1516  * @ingroup iface_zwp_tablet_pad_ring_v2
1517  */
1518 #define ZWP_TABLET_PAD_RING_V2_SET_FEEDBACK_SINCE_VERSION 1
1519 /**
1520  * @ingroup iface_zwp_tablet_pad_ring_v2
1521  */
1522 #define ZWP_TABLET_PAD_RING_V2_DESTROY_SINCE_VERSION 1
1523 
1524 /** @ingroup iface_zwp_tablet_pad_ring_v2 */
1525 static inline void
zwp_tablet_pad_ring_v2_set_user_data(struct zwp_tablet_pad_ring_v2 * zwp_tablet_pad_ring_v2,void * user_data)1526 zwp_tablet_pad_ring_v2_set_user_data(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2, void *user_data)
1527 {
1528 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_ring_v2, user_data);
1529 }
1530 
1531 /** @ingroup iface_zwp_tablet_pad_ring_v2 */
1532 static inline void *
zwp_tablet_pad_ring_v2_get_user_data(struct zwp_tablet_pad_ring_v2 * zwp_tablet_pad_ring_v2)1533 zwp_tablet_pad_ring_v2_get_user_data(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2)
1534 {
1535 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_ring_v2);
1536 }
1537 
1538 static inline uint32_t
zwp_tablet_pad_ring_v2_get_version(struct zwp_tablet_pad_ring_v2 * zwp_tablet_pad_ring_v2)1539 zwp_tablet_pad_ring_v2_get_version(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2)
1540 {
1541 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_ring_v2);
1542 }
1543 
1544 /**
1545  * @ingroup iface_zwp_tablet_pad_ring_v2
1546  *
1547  * Request that the compositor use the provided feedback string
1548  * associated with this ring. This request should be issued immediately
1549  * after a wp_tablet_pad_group.mode_switch event from the corresponding
1550  * group is received, or whenever the ring is mapped to a different
1551  * action. See wp_tablet_pad_group.mode_switch for more details.
1552  *
1553  * Clients are encouraged to provide context-aware descriptions for
1554  * the actions associated with the ring; compositors may use this
1555  * information to offer visual feedback about the button layout
1556  * (eg. on-screen displays).
1557  *
1558  * The provided string 'description' is a UTF-8 encoded string to be
1559  * associated with this ring, and is considered user-visible; general
1560  * internationalization rules apply.
1561  *
1562  * The serial argument will be that of the last
1563  * wp_tablet_pad_group.mode_switch event received for the group of this
1564  * ring. Requests providing other serials than the most recent one will be
1565  * ignored.
1566  */
1567 static inline void
zwp_tablet_pad_ring_v2_set_feedback(struct zwp_tablet_pad_ring_v2 * zwp_tablet_pad_ring_v2,const char * description,uint32_t serial)1568 zwp_tablet_pad_ring_v2_set_feedback(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2, const char *description, uint32_t serial)
1569 {
1570 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_ring_v2,
1571 			 ZWP_TABLET_PAD_RING_V2_SET_FEEDBACK, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_ring_v2), 0, description, serial);
1572 }
1573 
1574 /**
1575  * @ingroup iface_zwp_tablet_pad_ring_v2
1576  *
1577  * This destroys the client's resource for this ring object.
1578  */
1579 static inline void
zwp_tablet_pad_ring_v2_destroy(struct zwp_tablet_pad_ring_v2 * zwp_tablet_pad_ring_v2)1580 zwp_tablet_pad_ring_v2_destroy(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2)
1581 {
1582 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_ring_v2,
1583 			 ZWP_TABLET_PAD_RING_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_ring_v2), WL_MARSHAL_FLAG_DESTROY);
1584 }
1585 
1586 #ifndef ZWP_TABLET_PAD_STRIP_V2_SOURCE_ENUM
1587 #define ZWP_TABLET_PAD_STRIP_V2_SOURCE_ENUM
1588 /**
1589  * @ingroup iface_zwp_tablet_pad_strip_v2
1590  * strip axis source
1591  *
1592  * Describes the source types for strip events. This indicates to the
1593  * client how a strip event was physically generated; a client may
1594  * adjust the user interface accordingly. For example, events
1595  * from a "finger" source may trigger kinetic scrolling.
1596  */
1597 enum zwp_tablet_pad_strip_v2_source {
1598 	/**
1599 	 * finger
1600 	 */
1601 	ZWP_TABLET_PAD_STRIP_V2_SOURCE_FINGER = 1,
1602 };
1603 #endif /* ZWP_TABLET_PAD_STRIP_V2_SOURCE_ENUM */
1604 
1605 /**
1606  * @ingroup iface_zwp_tablet_pad_strip_v2
1607  * @struct zwp_tablet_pad_strip_v2_listener
1608  */
1609 struct zwp_tablet_pad_strip_v2_listener {
1610 	/**
1611 	 * strip event source
1612 	 *
1613 	 * Source information for strip events.
1614 	 *
1615 	 * This event does not occur on its own. It is sent before a
1616 	 * wp_tablet_pad_strip.frame event and carries the source
1617 	 * information for all events within that frame.
1618 	 *
1619 	 * The source specifies how this event was generated. If the source
1620 	 * is wp_tablet_pad_strip.source.finger, a wp_tablet_pad_strip.stop
1621 	 * event will be sent when the user lifts their finger off the
1622 	 * device.
1623 	 *
1624 	 * This event is optional. If the source is unknown for an
1625 	 * interaction, no event is sent.
1626 	 * @param source the event source
1627 	 */
1628 	void (*source)(void *data,
1629 		       struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,
1630 		       uint32_t source);
1631 	/**
1632 	 * position changed
1633 	 *
1634 	 * Sent whenever the position on a strip changes.
1635 	 *
1636 	 * The position is normalized to a range of [0, 65535], the 0-value
1637 	 * represents the top-most and/or left-most position of the strip
1638 	 * in the pad's current rotation.
1639 	 * @param position the current position
1640 	 */
1641 	void (*position)(void *data,
1642 			 struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,
1643 			 uint32_t position);
1644 	/**
1645 	 * interaction stopped
1646 	 *
1647 	 * Stop notification for strip events.
1648 	 *
1649 	 * For some wp_tablet_pad_strip.source types, a
1650 	 * wp_tablet_pad_strip.stop event is sent to notify a client that
1651 	 * the interaction with the strip has terminated. This enables the
1652 	 * client to implement kinetic scrolling. See the
1653 	 * wp_tablet_pad_strip.source documentation for information on when
1654 	 * this event may be generated.
1655 	 *
1656 	 * Any wp_tablet_pad_strip.position events with the same source
1657 	 * after this event should be considered as the start of a new
1658 	 * interaction.
1659 	 */
1660 	void (*stop)(void *data,
1661 		     struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2);
1662 	/**
1663 	 * end of a strip event sequence
1664 	 *
1665 	 * Indicates the end of a set of events that represent one
1666 	 * logical hardware strip event. A client is expected to accumulate
1667 	 * the data in all events within the frame before proceeding.
1668 	 *
1669 	 * All wp_tablet_pad_strip events before a
1670 	 * wp_tablet_pad_strip.frame event belong logically together. For
1671 	 * example, on termination of a finger interaction on a strip the
1672 	 * compositor will send a wp_tablet_pad_strip.source event, a
1673 	 * wp_tablet_pad_strip.stop event and a wp_tablet_pad_strip.frame
1674 	 * event.
1675 	 *
1676 	 * A wp_tablet_pad_strip.frame event is sent for every logical
1677 	 * event group, even if the group only contains a single
1678 	 * wp_tablet_pad_strip event. Specifically, a client may get a
1679 	 * sequence: position, frame, position, frame, etc.
1680 	 * @param time timestamp with millisecond granularity
1681 	 */
1682 	void (*frame)(void *data,
1683 		      struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,
1684 		      uint32_t time);
1685 };
1686 
1687 /**
1688  * @ingroup iface_zwp_tablet_pad_strip_v2
1689  */
1690 static inline int
zwp_tablet_pad_strip_v2_add_listener(struct zwp_tablet_pad_strip_v2 * zwp_tablet_pad_strip_v2,const struct zwp_tablet_pad_strip_v2_listener * listener,void * data)1691 zwp_tablet_pad_strip_v2_add_listener(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,
1692 				     const struct zwp_tablet_pad_strip_v2_listener *listener, void *data)
1693 {
1694 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_strip_v2,
1695 				     (void (**)(void)) listener, data);
1696 }
1697 
1698 #define ZWP_TABLET_PAD_STRIP_V2_SET_FEEDBACK 0
1699 #define ZWP_TABLET_PAD_STRIP_V2_DESTROY 1
1700 
1701 /**
1702  * @ingroup iface_zwp_tablet_pad_strip_v2
1703  */
1704 #define ZWP_TABLET_PAD_STRIP_V2_SOURCE_SINCE_VERSION 1
1705 /**
1706  * @ingroup iface_zwp_tablet_pad_strip_v2
1707  */
1708 #define ZWP_TABLET_PAD_STRIP_V2_POSITION_SINCE_VERSION 1
1709 /**
1710  * @ingroup iface_zwp_tablet_pad_strip_v2
1711  */
1712 #define ZWP_TABLET_PAD_STRIP_V2_STOP_SINCE_VERSION 1
1713 /**
1714  * @ingroup iface_zwp_tablet_pad_strip_v2
1715  */
1716 #define ZWP_TABLET_PAD_STRIP_V2_FRAME_SINCE_VERSION 1
1717 
1718 /**
1719  * @ingroup iface_zwp_tablet_pad_strip_v2
1720  */
1721 #define ZWP_TABLET_PAD_STRIP_V2_SET_FEEDBACK_SINCE_VERSION 1
1722 /**
1723  * @ingroup iface_zwp_tablet_pad_strip_v2
1724  */
1725 #define ZWP_TABLET_PAD_STRIP_V2_DESTROY_SINCE_VERSION 1
1726 
1727 /** @ingroup iface_zwp_tablet_pad_strip_v2 */
1728 static inline void
zwp_tablet_pad_strip_v2_set_user_data(struct zwp_tablet_pad_strip_v2 * zwp_tablet_pad_strip_v2,void * user_data)1729 zwp_tablet_pad_strip_v2_set_user_data(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2, void *user_data)
1730 {
1731 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_strip_v2, user_data);
1732 }
1733 
1734 /** @ingroup iface_zwp_tablet_pad_strip_v2 */
1735 static inline void *
zwp_tablet_pad_strip_v2_get_user_data(struct zwp_tablet_pad_strip_v2 * zwp_tablet_pad_strip_v2)1736 zwp_tablet_pad_strip_v2_get_user_data(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2)
1737 {
1738 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_strip_v2);
1739 }
1740 
1741 static inline uint32_t
zwp_tablet_pad_strip_v2_get_version(struct zwp_tablet_pad_strip_v2 * zwp_tablet_pad_strip_v2)1742 zwp_tablet_pad_strip_v2_get_version(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2)
1743 {
1744 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_strip_v2);
1745 }
1746 
1747 /**
1748  * @ingroup iface_zwp_tablet_pad_strip_v2
1749  *
1750  * Requests the compositor to use the provided feedback string
1751  * associated with this strip. This request should be issued immediately
1752  * after a wp_tablet_pad_group.mode_switch event from the corresponding
1753  * group is received, or whenever the strip is mapped to a different
1754  * action. See wp_tablet_pad_group.mode_switch for more details.
1755  *
1756  * Clients are encouraged to provide context-aware descriptions for
1757  * the actions associated with the strip, and compositors may use this
1758  * information to offer visual feedback about the button layout
1759  * (eg. on-screen displays).
1760  *
1761  * The provided string 'description' is a UTF-8 encoded string to be
1762  * associated with this ring, and is considered user-visible; general
1763  * internationalization rules apply.
1764  *
1765  * The serial argument will be that of the last
1766  * wp_tablet_pad_group.mode_switch event received for the group of this
1767  * strip. Requests providing other serials than the most recent one will be
1768  * ignored.
1769  */
1770 static inline void
zwp_tablet_pad_strip_v2_set_feedback(struct zwp_tablet_pad_strip_v2 * zwp_tablet_pad_strip_v2,const char * description,uint32_t serial)1771 zwp_tablet_pad_strip_v2_set_feedback(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2, const char *description, uint32_t serial)
1772 {
1773 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_strip_v2,
1774 			 ZWP_TABLET_PAD_STRIP_V2_SET_FEEDBACK, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_strip_v2), 0, description, serial);
1775 }
1776 
1777 /**
1778  * @ingroup iface_zwp_tablet_pad_strip_v2
1779  *
1780  * This destroys the client's resource for this strip object.
1781  */
1782 static inline void
zwp_tablet_pad_strip_v2_destroy(struct zwp_tablet_pad_strip_v2 * zwp_tablet_pad_strip_v2)1783 zwp_tablet_pad_strip_v2_destroy(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2)
1784 {
1785 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_strip_v2,
1786 			 ZWP_TABLET_PAD_STRIP_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_strip_v2), WL_MARSHAL_FLAG_DESTROY);
1787 }
1788 
1789 /**
1790  * @ingroup iface_zwp_tablet_pad_group_v2
1791  * @struct zwp_tablet_pad_group_v2_listener
1792  */
1793 struct zwp_tablet_pad_group_v2_listener {
1794 	/**
1795 	 * buttons announced
1796 	 *
1797 	 * Sent on wp_tablet_pad_group initialization to announce the
1798 	 * available buttons in the group. Button indices start at 0, a
1799 	 * button may only be in one group at a time.
1800 	 *
1801 	 * This event is first sent in the initial burst of events before
1802 	 * the wp_tablet_pad_group.done event.
1803 	 *
1804 	 * Some buttons are reserved by the compositor. These buttons may
1805 	 * not be assigned to any wp_tablet_pad_group. Compositors may
1806 	 * broadcast this event in the case of changes to the mapping of
1807 	 * these reserved buttons. If the compositor happens to reserve all
1808 	 * buttons in a group, this event will be sent with an empty array.
1809 	 * @param buttons buttons in this group
1810 	 */
1811 	void (*buttons)(void *data,
1812 			struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,
1813 			struct wl_array *buttons);
1814 	/**
1815 	 * ring announced
1816 	 *
1817 	 * Sent on wp_tablet_pad_group initialization to announce
1818 	 * available rings. One event is sent for each ring available on
1819 	 * this pad group.
1820 	 *
1821 	 * This event is sent in the initial burst of events before the
1822 	 * wp_tablet_pad_group.done event.
1823 	 */
1824 	void (*ring)(void *data,
1825 		     struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,
1826 		     struct zwp_tablet_pad_ring_v2 *ring);
1827 	/**
1828 	 * strip announced
1829 	 *
1830 	 * Sent on wp_tablet_pad initialization to announce available
1831 	 * strips. One event is sent for each strip available on this pad
1832 	 * group.
1833 	 *
1834 	 * This event is sent in the initial burst of events before the
1835 	 * wp_tablet_pad_group.done event.
1836 	 */
1837 	void (*strip)(void *data,
1838 		      struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,
1839 		      struct zwp_tablet_pad_strip_v2 *strip);
1840 	/**
1841 	 * mode-switch ability announced
1842 	 *
1843 	 * Sent on wp_tablet_pad_group initialization to announce that
1844 	 * the pad group may switch between modes. A client may use a mode
1845 	 * to store a specific configuration for buttons, rings and strips
1846 	 * and use the wl_tablet_pad_group.mode_switch event to toggle
1847 	 * between these configurations. Mode indices start at 0.
1848 	 *
1849 	 * Switching modes is compositor-dependent. See the
1850 	 * wp_tablet_pad_group.mode_switch event for more details.
1851 	 *
1852 	 * This event is sent in the initial burst of events before the
1853 	 * wp_tablet_pad_group.done event. This event is only sent when
1854 	 * more than more than one mode is available.
1855 	 * @param modes the number of modes
1856 	 */
1857 	void (*modes)(void *data,
1858 		      struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,
1859 		      uint32_t modes);
1860 	/**
1861 	 * tablet group description events sequence complete
1862 	 *
1863 	 * This event is sent immediately to signal the end of the
1864 	 * initial burst of descriptive events. A client may consider the
1865 	 * static description of the tablet to be complete and finalize
1866 	 * initialization of the tablet group.
1867 	 */
1868 	void (*done)(void *data,
1869 		     struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2);
1870 	/**
1871 	 * mode switch event
1872 	 *
1873 	 * Notification that the mode was switched.
1874 	 *
1875 	 * A mode applies to all buttons, rings and strips in a group
1876 	 * simultaneously, but a client is not required to assign different
1877 	 * actions for each mode. For example, a client may have
1878 	 * mode-specific button mappings but map the ring to vertical
1879 	 * scrolling in all modes. Mode indices start at 0.
1880 	 *
1881 	 * Switching modes is compositor-dependent. The compositor may
1882 	 * provide visual cues to the client about the mode, e.g. by
1883 	 * toggling LEDs on the tablet device. Mode-switching may be
1884 	 * software-controlled or controlled by one or more physical
1885 	 * buttons. For example, on a Wacom Intuos Pro, the button inside
1886 	 * the ring may be assigned to switch between modes.
1887 	 *
1888 	 * The compositor will also send this event after
1889 	 * wp_tablet_pad.enter on each group in order to notify of the
1890 	 * current mode. Groups that only feature one mode will use mode=0
1891 	 * when emitting this event.
1892 	 *
1893 	 * If a button action in the new mode differs from the action in
1894 	 * the previous mode, the client should immediately issue a
1895 	 * wp_tablet_pad.set_feedback request for each changed button.
1896 	 *
1897 	 * If a ring or strip action in the new mode differs from the
1898 	 * action in the previous mode, the client should immediately issue
1899 	 * a wp_tablet_ring.set_feedback or wp_tablet_strip.set_feedback
1900 	 * request for each changed ring or strip.
1901 	 * @param time the time of the event with millisecond granularity
1902 	 * @param mode the new mode of the pad
1903 	 */
1904 	void (*mode_switch)(void *data,
1905 			    struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,
1906 			    uint32_t time,
1907 			    uint32_t serial,
1908 			    uint32_t mode);
1909 };
1910 
1911 /**
1912  * @ingroup iface_zwp_tablet_pad_group_v2
1913  */
1914 static inline int
zwp_tablet_pad_group_v2_add_listener(struct zwp_tablet_pad_group_v2 * zwp_tablet_pad_group_v2,const struct zwp_tablet_pad_group_v2_listener * listener,void * data)1915 zwp_tablet_pad_group_v2_add_listener(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,
1916 				     const struct zwp_tablet_pad_group_v2_listener *listener, void *data)
1917 {
1918 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_group_v2,
1919 				     (void (**)(void)) listener, data);
1920 }
1921 
1922 #define ZWP_TABLET_PAD_GROUP_V2_DESTROY 0
1923 
1924 /**
1925  * @ingroup iface_zwp_tablet_pad_group_v2
1926  */
1927 #define ZWP_TABLET_PAD_GROUP_V2_BUTTONS_SINCE_VERSION 1
1928 /**
1929  * @ingroup iface_zwp_tablet_pad_group_v2
1930  */
1931 #define ZWP_TABLET_PAD_GROUP_V2_RING_SINCE_VERSION 1
1932 /**
1933  * @ingroup iface_zwp_tablet_pad_group_v2
1934  */
1935 #define ZWP_TABLET_PAD_GROUP_V2_STRIP_SINCE_VERSION 1
1936 /**
1937  * @ingroup iface_zwp_tablet_pad_group_v2
1938  */
1939 #define ZWP_TABLET_PAD_GROUP_V2_MODES_SINCE_VERSION 1
1940 /**
1941  * @ingroup iface_zwp_tablet_pad_group_v2
1942  */
1943 #define ZWP_TABLET_PAD_GROUP_V2_DONE_SINCE_VERSION 1
1944 /**
1945  * @ingroup iface_zwp_tablet_pad_group_v2
1946  */
1947 #define ZWP_TABLET_PAD_GROUP_V2_MODE_SWITCH_SINCE_VERSION 1
1948 
1949 /**
1950  * @ingroup iface_zwp_tablet_pad_group_v2
1951  */
1952 #define ZWP_TABLET_PAD_GROUP_V2_DESTROY_SINCE_VERSION 1
1953 
1954 /** @ingroup iface_zwp_tablet_pad_group_v2 */
1955 static inline void
zwp_tablet_pad_group_v2_set_user_data(struct zwp_tablet_pad_group_v2 * zwp_tablet_pad_group_v2,void * user_data)1956 zwp_tablet_pad_group_v2_set_user_data(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2, void *user_data)
1957 {
1958 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_group_v2, user_data);
1959 }
1960 
1961 /** @ingroup iface_zwp_tablet_pad_group_v2 */
1962 static inline void *
zwp_tablet_pad_group_v2_get_user_data(struct zwp_tablet_pad_group_v2 * zwp_tablet_pad_group_v2)1963 zwp_tablet_pad_group_v2_get_user_data(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2)
1964 {
1965 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_group_v2);
1966 }
1967 
1968 static inline uint32_t
zwp_tablet_pad_group_v2_get_version(struct zwp_tablet_pad_group_v2 * zwp_tablet_pad_group_v2)1969 zwp_tablet_pad_group_v2_get_version(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2)
1970 {
1971 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_group_v2);
1972 }
1973 
1974 /**
1975  * @ingroup iface_zwp_tablet_pad_group_v2
1976  *
1977  * Destroy the wp_tablet_pad_group object. Objects created from this object
1978  * are unaffected and should be destroyed separately.
1979  */
1980 static inline void
zwp_tablet_pad_group_v2_destroy(struct zwp_tablet_pad_group_v2 * zwp_tablet_pad_group_v2)1981 zwp_tablet_pad_group_v2_destroy(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2)
1982 {
1983 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_group_v2,
1984 			 ZWP_TABLET_PAD_GROUP_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_group_v2), WL_MARSHAL_FLAG_DESTROY);
1985 }
1986 
1987 #ifndef ZWP_TABLET_PAD_V2_BUTTON_STATE_ENUM
1988 #define ZWP_TABLET_PAD_V2_BUTTON_STATE_ENUM
1989 /**
1990  * @ingroup iface_zwp_tablet_pad_v2
1991  * physical button state
1992  *
1993  * Describes the physical state of a button that caused the button
1994  * event.
1995  */
1996 enum zwp_tablet_pad_v2_button_state {
1997 	/**
1998 	 * the button is not pressed
1999 	 */
2000 	ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED = 0,
2001 	/**
2002 	 * the button is pressed
2003 	 */
2004 	ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED = 1,
2005 };
2006 #endif /* ZWP_TABLET_PAD_V2_BUTTON_STATE_ENUM */
2007 
2008 /**
2009  * @ingroup iface_zwp_tablet_pad_v2
2010  * @struct zwp_tablet_pad_v2_listener
2011  */
2012 struct zwp_tablet_pad_v2_listener {
2013 	/**
2014 	 * group announced
2015 	 *
2016 	 * Sent on wp_tablet_pad initialization to announce available
2017 	 * groups. One event is sent for each pad group available.
2018 	 *
2019 	 * This event is sent in the initial burst of events before the
2020 	 * wp_tablet_pad.done event. At least one group will be announced.
2021 	 */
2022 	void (*group)(void *data,
2023 		      struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,
2024 		      struct zwp_tablet_pad_group_v2 *pad_group);
2025 	/**
2026 	 * path to the device
2027 	 *
2028 	 * A system-specific device path that indicates which device is
2029 	 * behind this wp_tablet_pad. This information may be used to
2030 	 * gather additional information about the device, e.g. through
2031 	 * libwacom.
2032 	 *
2033 	 * The format of the path is unspecified, it may be a device node,
2034 	 * a sysfs path, or some other identifier. It is up to the client
2035 	 * to identify the string provided.
2036 	 *
2037 	 * This event is sent in the initial burst of events before the
2038 	 * wp_tablet_pad.done event.
2039 	 * @param path path to local device
2040 	 */
2041 	void (*path)(void *data,
2042 		     struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,
2043 		     const char *path);
2044 	/**
2045 	 * buttons announced
2046 	 *
2047 	 * Sent on wp_tablet_pad initialization to announce the available
2048 	 * buttons.
2049 	 *
2050 	 * This event is sent in the initial burst of events before the
2051 	 * wp_tablet_pad.done event. This event is only sent when at least
2052 	 * one button is available.
2053 	 * @param buttons the number of buttons
2054 	 */
2055 	void (*buttons)(void *data,
2056 			struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,
2057 			uint32_t buttons);
2058 	/**
2059 	 * pad description event sequence complete
2060 	 *
2061 	 * This event signals the end of the initial burst of descriptive
2062 	 * events. A client may consider the static description of the pad
2063 	 * to be complete and finalize initialization of the pad.
2064 	 */
2065 	void (*done)(void *data,
2066 		     struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2);
2067 	/**
2068 	 * physical button state
2069 	 *
2070 	 * Sent whenever the physical state of a button changes.
2071 	 * @param time the time of the event with millisecond granularity
2072 	 * @param button the index of the button that changed state
2073 	 */
2074 	void (*button)(void *data,
2075 		       struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,
2076 		       uint32_t time,
2077 		       uint32_t button,
2078 		       uint32_t state);
2079 	/**
2080 	 * enter event
2081 	 *
2082 	 * Notification that this pad is focused on the specified
2083 	 * surface.
2084 	 * @param serial serial number of the enter event
2085 	 * @param tablet the tablet the pad is attached to
2086 	 * @param surface surface the pad is focused on
2087 	 */
2088 	void (*enter)(void *data,
2089 		      struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,
2090 		      uint32_t serial,
2091 		      struct zwp_tablet_v2 *tablet,
2092 		      struct wl_surface *surface);
2093 	/**
2094 	 * enter event
2095 	 *
2096 	 * Notification that this pad is no longer focused on the
2097 	 * specified surface.
2098 	 * @param serial serial number of the leave event
2099 	 * @param surface surface the pad is no longer focused on
2100 	 */
2101 	void (*leave)(void *data,
2102 		      struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,
2103 		      uint32_t serial,
2104 		      struct wl_surface *surface);
2105 	/**
2106 	 * pad removed event
2107 	 *
2108 	 * Sent when the pad has been removed from the system. When a
2109 	 * tablet is removed its pad(s) will be removed too.
2110 	 *
2111 	 * When this event is received, the client must destroy all rings,
2112 	 * strips and groups that were offered by this pad, and issue
2113 	 * wp_tablet_pad.destroy the pad itself.
2114 	 */
2115 	void (*removed)(void *data,
2116 			struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2);
2117 };
2118 
2119 /**
2120  * @ingroup iface_zwp_tablet_pad_v2
2121  */
2122 static inline int
zwp_tablet_pad_v2_add_listener(struct zwp_tablet_pad_v2 * zwp_tablet_pad_v2,const struct zwp_tablet_pad_v2_listener * listener,void * data)2123 zwp_tablet_pad_v2_add_listener(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,
2124 			       const struct zwp_tablet_pad_v2_listener *listener, void *data)
2125 {
2126 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_v2,
2127 				     (void (**)(void)) listener, data);
2128 }
2129 
2130 #define ZWP_TABLET_PAD_V2_SET_FEEDBACK 0
2131 #define ZWP_TABLET_PAD_V2_DESTROY 1
2132 
2133 /**
2134  * @ingroup iface_zwp_tablet_pad_v2
2135  */
2136 #define ZWP_TABLET_PAD_V2_GROUP_SINCE_VERSION 1
2137 /**
2138  * @ingroup iface_zwp_tablet_pad_v2
2139  */
2140 #define ZWP_TABLET_PAD_V2_PATH_SINCE_VERSION 1
2141 /**
2142  * @ingroup iface_zwp_tablet_pad_v2
2143  */
2144 #define ZWP_TABLET_PAD_V2_BUTTONS_SINCE_VERSION 1
2145 /**
2146  * @ingroup iface_zwp_tablet_pad_v2
2147  */
2148 #define ZWP_TABLET_PAD_V2_DONE_SINCE_VERSION 1
2149 /**
2150  * @ingroup iface_zwp_tablet_pad_v2
2151  */
2152 #define ZWP_TABLET_PAD_V2_BUTTON_SINCE_VERSION 1
2153 /**
2154  * @ingroup iface_zwp_tablet_pad_v2
2155  */
2156 #define ZWP_TABLET_PAD_V2_ENTER_SINCE_VERSION 1
2157 /**
2158  * @ingroup iface_zwp_tablet_pad_v2
2159  */
2160 #define ZWP_TABLET_PAD_V2_LEAVE_SINCE_VERSION 1
2161 /**
2162  * @ingroup iface_zwp_tablet_pad_v2
2163  */
2164 #define ZWP_TABLET_PAD_V2_REMOVED_SINCE_VERSION 1
2165 
2166 /**
2167  * @ingroup iface_zwp_tablet_pad_v2
2168  */
2169 #define ZWP_TABLET_PAD_V2_SET_FEEDBACK_SINCE_VERSION 1
2170 /**
2171  * @ingroup iface_zwp_tablet_pad_v2
2172  */
2173 #define ZWP_TABLET_PAD_V2_DESTROY_SINCE_VERSION 1
2174 
2175 /** @ingroup iface_zwp_tablet_pad_v2 */
2176 static inline void
zwp_tablet_pad_v2_set_user_data(struct zwp_tablet_pad_v2 * zwp_tablet_pad_v2,void * user_data)2177 zwp_tablet_pad_v2_set_user_data(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, void *user_data)
2178 {
2179 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_v2, user_data);
2180 }
2181 
2182 /** @ingroup iface_zwp_tablet_pad_v2 */
2183 static inline void *
zwp_tablet_pad_v2_get_user_data(struct zwp_tablet_pad_v2 * zwp_tablet_pad_v2)2184 zwp_tablet_pad_v2_get_user_data(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2)
2185 {
2186 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_v2);
2187 }
2188 
2189 static inline uint32_t
zwp_tablet_pad_v2_get_version(struct zwp_tablet_pad_v2 * zwp_tablet_pad_v2)2190 zwp_tablet_pad_v2_get_version(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2)
2191 {
2192 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_v2);
2193 }
2194 
2195 /**
2196  * @ingroup iface_zwp_tablet_pad_v2
2197  *
2198  * Requests the compositor to use the provided feedback string
2199  * associated with this button. This request should be issued immediately
2200  * after a wp_tablet_pad_group.mode_switch event from the corresponding
2201  * group is received, or whenever a button is mapped to a different
2202  * action. See wp_tablet_pad_group.mode_switch for more details.
2203  *
2204  * Clients are encouraged to provide context-aware descriptions for
2205  * the actions associated with each button, and compositors may use
2206  * this information to offer visual feedback on the button layout
2207  * (e.g. on-screen displays).
2208  *
2209  * Button indices start at 0. Setting the feedback string on a button
2210  * that is reserved by the compositor (i.e. not belonging to any
2211  * wp_tablet_pad_group) does not generate an error but the compositor
2212  * is free to ignore the request.
2213  *
2214  * The provided string 'description' is a UTF-8 encoded string to be
2215  * associated with this ring, and is considered user-visible; general
2216  * internationalization rules apply.
2217  *
2218  * The serial argument will be that of the last
2219  * wp_tablet_pad_group.mode_switch event received for the group of this
2220  * button. Requests providing other serials than the most recent one will
2221  * be ignored.
2222  */
2223 static inline void
zwp_tablet_pad_v2_set_feedback(struct zwp_tablet_pad_v2 * zwp_tablet_pad_v2,uint32_t button,const char * description,uint32_t serial)2224 zwp_tablet_pad_v2_set_feedback(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, uint32_t button, const char *description, uint32_t serial)
2225 {
2226 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_v2,
2227 			 ZWP_TABLET_PAD_V2_SET_FEEDBACK, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_v2), 0, button, description, serial);
2228 }
2229 
2230 /**
2231  * @ingroup iface_zwp_tablet_pad_v2
2232  *
2233  * Destroy the wp_tablet_pad object. Objects created from this object
2234  * are unaffected and should be destroyed separately.
2235  */
2236 static inline void
zwp_tablet_pad_v2_destroy(struct zwp_tablet_pad_v2 * zwp_tablet_pad_v2)2237 zwp_tablet_pad_v2_destroy(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2)
2238 {
2239 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_v2,
2240 			 ZWP_TABLET_PAD_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_v2), WL_MARSHAL_FLAG_DESTROY);
2241 }
2242 
2243 #ifdef  __cplusplus
2244 }
2245 #endif
2246 
2247 #endif
2248