1 /* Generated by wayland-scanner 1.22.0 */
2 
3 #ifndef TABLET_UNSTABLE_V1_CLIENT_PROTOCOL_H
4 #define TABLET_UNSTABLE_V1_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_v1 The tablet_unstable_v1 protocol
16  * Wayland protocol for graphics tablets
17  *
18  * @section page_desc_tablet_unstable_v1 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_v1 Interfaces
107  * - @subpage page_iface_zwp_tablet_manager_v1 - controller object for graphic tablet devices
108  * - @subpage page_iface_zwp_tablet_seat_v1 - controller object for graphic tablet devices of a seat
109  * - @subpage page_iface_zwp_tablet_tool_v1 - a physical tablet tool
110  * - @subpage page_iface_zwp_tablet_v1 - graphics tablet device
111  * @section page_copyright_tablet_unstable_v1 Copyright
112  * <pre>
113  *
114  * Copyright 2014 © Stephen "Lyude" Chandler Paul
115  * Copyright 2015-2016 © Red Hat, Inc.
116  *
117  * Permission is hereby granted, free of charge, to any person
118  * obtaining a copy of this software and associated documentation files
119  * (the "Software"), to deal in the Software without restriction,
120  * including without limitation the rights to use, copy, modify, merge,
121  * publish, distribute, sublicense, and/or sell copies of the Software,
122  * and to permit persons to whom the Software is furnished to do so,
123  * subject to the following conditions:
124  *
125  * The above copyright notice and this permission notice (including the
126  * next paragraph) shall be included in all copies or substantial
127  * portions of the Software.
128  *
129  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
130  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
131  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
132  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
133  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
134  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
135  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
136  * SOFTWARE.
137  * </pre>
138  */
139 struct wl_seat;
140 struct wl_surface;
141 struct zwp_tablet_manager_v1;
142 struct zwp_tablet_seat_v1;
143 struct zwp_tablet_tool_v1;
144 struct zwp_tablet_v1;
145 
146 #ifndef ZWP_TABLET_MANAGER_V1_INTERFACE
147 #define ZWP_TABLET_MANAGER_V1_INTERFACE
148 /**
149  * @page page_iface_zwp_tablet_manager_v1 zwp_tablet_manager_v1
150  * @section page_iface_zwp_tablet_manager_v1_desc Description
151  *
152  * An object that provides access to the graphics tablets available on this
153  * system. All tablets are associated with a seat, to get access to the
154  * actual tablets, use wp_tablet_manager.get_tablet_seat.
155  * @section page_iface_zwp_tablet_manager_v1_api API
156  * See @ref iface_zwp_tablet_manager_v1.
157  */
158 /**
159  * @defgroup iface_zwp_tablet_manager_v1 The zwp_tablet_manager_v1 interface
160  *
161  * An object that provides access to the graphics tablets available on this
162  * system. All tablets are associated with a seat, to get access to the
163  * actual tablets, use wp_tablet_manager.get_tablet_seat.
164  */
165 extern const struct wl_interface zwp_tablet_manager_v1_interface;
166 #endif
167 #ifndef ZWP_TABLET_SEAT_V1_INTERFACE
168 #define ZWP_TABLET_SEAT_V1_INTERFACE
169 /**
170  * @page page_iface_zwp_tablet_seat_v1 zwp_tablet_seat_v1
171  * @section page_iface_zwp_tablet_seat_v1_desc Description
172  *
173  * An object that provides access to the graphics tablets available on this
174  * seat. After binding to this interface, the compositor sends a set of
175  * wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events.
176  * @section page_iface_zwp_tablet_seat_v1_api API
177  * See @ref iface_zwp_tablet_seat_v1.
178  */
179 /**
180  * @defgroup iface_zwp_tablet_seat_v1 The zwp_tablet_seat_v1 interface
181  *
182  * An object that provides access to the graphics tablets available on this
183  * seat. After binding to this interface, the compositor sends a set of
184  * wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events.
185  */
186 extern const struct wl_interface zwp_tablet_seat_v1_interface;
187 #endif
188 #ifndef ZWP_TABLET_TOOL_V1_INTERFACE
189 #define ZWP_TABLET_TOOL_V1_INTERFACE
190 /**
191  * @page page_iface_zwp_tablet_tool_v1 zwp_tablet_tool_v1
192  * @section page_iface_zwp_tablet_tool_v1_desc Description
193  *
194  * An object that represents a physical tool that has been, or is
195  * currently in use with a tablet in this seat. Each wp_tablet_tool
196  * object stays valid until the client destroys it; the compositor
197  * reuses the wp_tablet_tool object to indicate that the object's
198  * respective physical tool has come into proximity of a tablet again.
199  *
200  * A wp_tablet_tool object's relation to a physical tool depends on the
201  * tablet's ability to report serial numbers. If the tablet supports
202  * this capability, then the object represents a specific physical tool
203  * and can be identified even when used on multiple tablets.
204  *
205  * A tablet tool has a number of static characteristics, e.g. tool type,
206  * hardware_serial and capabilities. These capabilities are sent in an
207  * event sequence after the wp_tablet_seat.tool_added event before any
208  * actual events from this tool. This initial event sequence is
209  * terminated by a wp_tablet_tool.done event.
210  *
211  * Tablet tool events are grouped by wp_tablet_tool.frame events.
212  * Any events received before a wp_tablet_tool.frame event should be
213  * considered part of the same hardware state change.
214  * @section page_iface_zwp_tablet_tool_v1_api API
215  * See @ref iface_zwp_tablet_tool_v1.
216  */
217 /**
218  * @defgroup iface_zwp_tablet_tool_v1 The zwp_tablet_tool_v1 interface
219  *
220  * An object that represents a physical tool that has been, or is
221  * currently in use with a tablet in this seat. Each wp_tablet_tool
222  * object stays valid until the client destroys it; the compositor
223  * reuses the wp_tablet_tool object to indicate that the object's
224  * respective physical tool has come into proximity of a tablet again.
225  *
226  * A wp_tablet_tool object's relation to a physical tool depends on the
227  * tablet's ability to report serial numbers. If the tablet supports
228  * this capability, then the object represents a specific physical tool
229  * and can be identified even when used on multiple tablets.
230  *
231  * A tablet tool has a number of static characteristics, e.g. tool type,
232  * hardware_serial and capabilities. These capabilities are sent in an
233  * event sequence after the wp_tablet_seat.tool_added event before any
234  * actual events from this tool. This initial event sequence is
235  * terminated by a wp_tablet_tool.done event.
236  *
237  * Tablet tool events are grouped by wp_tablet_tool.frame events.
238  * Any events received before a wp_tablet_tool.frame event should be
239  * considered part of the same hardware state change.
240  */
241 extern const struct wl_interface zwp_tablet_tool_v1_interface;
242 #endif
243 #ifndef ZWP_TABLET_V1_INTERFACE
244 #define ZWP_TABLET_V1_INTERFACE
245 /**
246  * @page page_iface_zwp_tablet_v1 zwp_tablet_v1
247  * @section page_iface_zwp_tablet_v1_desc Description
248  *
249  * The wp_tablet interface represents one graphics tablet device. The
250  * tablet interface itself does not generate events; all events are
251  * generated by wp_tablet_tool objects when in proximity above a tablet.
252  *
253  * A tablet has a number of static characteristics, e.g. device name and
254  * pid/vid. These capabilities are sent in an event sequence after the
255  * wp_tablet_seat.tablet_added event. This initial event sequence is
256  * terminated by a wp_tablet.done event.
257  * @section page_iface_zwp_tablet_v1_api API
258  * See @ref iface_zwp_tablet_v1.
259  */
260 /**
261  * @defgroup iface_zwp_tablet_v1 The zwp_tablet_v1 interface
262  *
263  * The wp_tablet interface represents one graphics tablet device. The
264  * tablet interface itself does not generate events; all events are
265  * generated by wp_tablet_tool objects when in proximity above a tablet.
266  *
267  * A tablet has a number of static characteristics, e.g. device name and
268  * pid/vid. These capabilities are sent in an event sequence after the
269  * wp_tablet_seat.tablet_added event. This initial event sequence is
270  * terminated by a wp_tablet.done event.
271  */
272 extern const struct wl_interface zwp_tablet_v1_interface;
273 #endif
274 
275 #define ZWP_TABLET_MANAGER_V1_GET_TABLET_SEAT 0
276 #define ZWP_TABLET_MANAGER_V1_DESTROY 1
277 
278 
279 /**
280  * @ingroup iface_zwp_tablet_manager_v1
281  */
282 #define ZWP_TABLET_MANAGER_V1_GET_TABLET_SEAT_SINCE_VERSION 1
283 /**
284  * @ingroup iface_zwp_tablet_manager_v1
285  */
286 #define ZWP_TABLET_MANAGER_V1_DESTROY_SINCE_VERSION 1
287 
288 /** @ingroup iface_zwp_tablet_manager_v1 */
289 static inline void
zwp_tablet_manager_v1_set_user_data(struct zwp_tablet_manager_v1 * zwp_tablet_manager_v1,void * user_data)290 zwp_tablet_manager_v1_set_user_data(struct zwp_tablet_manager_v1 *zwp_tablet_manager_v1, void *user_data)
291 {
292 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_manager_v1, user_data);
293 }
294 
295 /** @ingroup iface_zwp_tablet_manager_v1 */
296 static inline void *
zwp_tablet_manager_v1_get_user_data(struct zwp_tablet_manager_v1 * zwp_tablet_manager_v1)297 zwp_tablet_manager_v1_get_user_data(struct zwp_tablet_manager_v1 *zwp_tablet_manager_v1)
298 {
299 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_manager_v1);
300 }
301 
302 static inline uint32_t
zwp_tablet_manager_v1_get_version(struct zwp_tablet_manager_v1 * zwp_tablet_manager_v1)303 zwp_tablet_manager_v1_get_version(struct zwp_tablet_manager_v1 *zwp_tablet_manager_v1)
304 {
305 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v1);
306 }
307 
308 /**
309  * @ingroup iface_zwp_tablet_manager_v1
310  *
311  * Get the wp_tablet_seat object for the given seat. This object
312  * provides access to all graphics tablets in this seat.
313  */
314 static inline struct zwp_tablet_seat_v1 *
zwp_tablet_manager_v1_get_tablet_seat(struct zwp_tablet_manager_v1 * zwp_tablet_manager_v1,struct wl_seat * seat)315 zwp_tablet_manager_v1_get_tablet_seat(struct zwp_tablet_manager_v1 *zwp_tablet_manager_v1, struct wl_seat *seat)
316 {
317 	struct wl_proxy *tablet_seat;
318 
319 	tablet_seat = wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_manager_v1,
320 			 ZWP_TABLET_MANAGER_V1_GET_TABLET_SEAT, &zwp_tablet_seat_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v1), 0, NULL, seat);
321 
322 	return (struct zwp_tablet_seat_v1 *) tablet_seat;
323 }
324 
325 /**
326  * @ingroup iface_zwp_tablet_manager_v1
327  *
328  * Destroy the wp_tablet_manager object. Objects created from this
329  * object are unaffected and should be destroyed separately.
330  */
331 static inline void
zwp_tablet_manager_v1_destroy(struct zwp_tablet_manager_v1 * zwp_tablet_manager_v1)332 zwp_tablet_manager_v1_destroy(struct zwp_tablet_manager_v1 *zwp_tablet_manager_v1)
333 {
334 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_manager_v1,
335 			 ZWP_TABLET_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v1), WL_MARSHAL_FLAG_DESTROY);
336 }
337 
338 /**
339  * @ingroup iface_zwp_tablet_seat_v1
340  * @struct zwp_tablet_seat_v1_listener
341  */
342 struct zwp_tablet_seat_v1_listener {
343 	/**
344 	 * new device notification
345 	 *
346 	 * This event is sent whenever a new tablet becomes available on
347 	 * this seat. This event only provides the object id of the tablet,
348 	 * any static information about the tablet (device name, vid/pid,
349 	 * etc.) is sent through the wp_tablet interface.
350 	 * @param id the newly added graphics tablet
351 	 */
352 	void (*tablet_added)(void *data,
353 			     struct zwp_tablet_seat_v1 *zwp_tablet_seat_v1,
354 			     struct zwp_tablet_v1 *id);
355 	/**
356 	 * a new tool has been used with a tablet
357 	 *
358 	 * This event is sent whenever a tool that has not previously
359 	 * been used with a tablet comes into use. This event only provides
360 	 * the object id of the tool; any static information about the tool
361 	 * (capabilities, type, etc.) is sent through the wp_tablet_tool
362 	 * interface.
363 	 * @param id the newly added tablet tool
364 	 */
365 	void (*tool_added)(void *data,
366 			   struct zwp_tablet_seat_v1 *zwp_tablet_seat_v1,
367 			   struct zwp_tablet_tool_v1 *id);
368 };
369 
370 /**
371  * @ingroup iface_zwp_tablet_seat_v1
372  */
373 static inline int
zwp_tablet_seat_v1_add_listener(struct zwp_tablet_seat_v1 * zwp_tablet_seat_v1,const struct zwp_tablet_seat_v1_listener * listener,void * data)374 zwp_tablet_seat_v1_add_listener(struct zwp_tablet_seat_v1 *zwp_tablet_seat_v1,
375 				const struct zwp_tablet_seat_v1_listener *listener, void *data)
376 {
377 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_seat_v1,
378 				     (void (**)(void)) listener, data);
379 }
380 
381 #define ZWP_TABLET_SEAT_V1_DESTROY 0
382 
383 /**
384  * @ingroup iface_zwp_tablet_seat_v1
385  */
386 #define ZWP_TABLET_SEAT_V1_TABLET_ADDED_SINCE_VERSION 1
387 /**
388  * @ingroup iface_zwp_tablet_seat_v1
389  */
390 #define ZWP_TABLET_SEAT_V1_TOOL_ADDED_SINCE_VERSION 1
391 
392 /**
393  * @ingroup iface_zwp_tablet_seat_v1
394  */
395 #define ZWP_TABLET_SEAT_V1_DESTROY_SINCE_VERSION 1
396 
397 /** @ingroup iface_zwp_tablet_seat_v1 */
398 static inline void
zwp_tablet_seat_v1_set_user_data(struct zwp_tablet_seat_v1 * zwp_tablet_seat_v1,void * user_data)399 zwp_tablet_seat_v1_set_user_data(struct zwp_tablet_seat_v1 *zwp_tablet_seat_v1, void *user_data)
400 {
401 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_seat_v1, user_data);
402 }
403 
404 /** @ingroup iface_zwp_tablet_seat_v1 */
405 static inline void *
zwp_tablet_seat_v1_get_user_data(struct zwp_tablet_seat_v1 * zwp_tablet_seat_v1)406 zwp_tablet_seat_v1_get_user_data(struct zwp_tablet_seat_v1 *zwp_tablet_seat_v1)
407 {
408 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_seat_v1);
409 }
410 
411 static inline uint32_t
zwp_tablet_seat_v1_get_version(struct zwp_tablet_seat_v1 * zwp_tablet_seat_v1)412 zwp_tablet_seat_v1_get_version(struct zwp_tablet_seat_v1 *zwp_tablet_seat_v1)
413 {
414 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_seat_v1);
415 }
416 
417 /**
418  * @ingroup iface_zwp_tablet_seat_v1
419  *
420  * Destroy the wp_tablet_seat object. Objects created from this
421  * object are unaffected and should be destroyed separately.
422  */
423 static inline void
zwp_tablet_seat_v1_destroy(struct zwp_tablet_seat_v1 * zwp_tablet_seat_v1)424 zwp_tablet_seat_v1_destroy(struct zwp_tablet_seat_v1 *zwp_tablet_seat_v1)
425 {
426 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_seat_v1,
427 			 ZWP_TABLET_SEAT_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_seat_v1), WL_MARSHAL_FLAG_DESTROY);
428 }
429 
430 #ifndef ZWP_TABLET_TOOL_V1_TYPE_ENUM
431 #define ZWP_TABLET_TOOL_V1_TYPE_ENUM
432 /**
433  * @ingroup iface_zwp_tablet_tool_v1
434  * a physical tool type
435  *
436  * Describes the physical type of a tool. The physical type of a tool
437  * generally defines its base usage.
438  *
439  * The mouse tool represents a mouse-shaped tool that is not a relative
440  * device but bound to the tablet's surface, providing absolute
441  * coordinates.
442  *
443  * The lens tool is a mouse-shaped tool with an attached lens to
444  * provide precision focus.
445  */
446 enum zwp_tablet_tool_v1_type {
447 	/**
448 	 * Pen
449 	 */
450 	ZWP_TABLET_TOOL_V1_TYPE_PEN = 0x140,
451 	/**
452 	 * Eraser
453 	 */
454 	ZWP_TABLET_TOOL_V1_TYPE_ERASER = 0x141,
455 	/**
456 	 * Brush
457 	 */
458 	ZWP_TABLET_TOOL_V1_TYPE_BRUSH = 0x142,
459 	/**
460 	 * Pencil
461 	 */
462 	ZWP_TABLET_TOOL_V1_TYPE_PENCIL = 0x143,
463 	/**
464 	 * Airbrush
465 	 */
466 	ZWP_TABLET_TOOL_V1_TYPE_AIRBRUSH = 0x144,
467 	/**
468 	 * Finger
469 	 */
470 	ZWP_TABLET_TOOL_V1_TYPE_FINGER = 0x145,
471 	/**
472 	 * Mouse
473 	 */
474 	ZWP_TABLET_TOOL_V1_TYPE_MOUSE = 0x146,
475 	/**
476 	 * Lens
477 	 */
478 	ZWP_TABLET_TOOL_V1_TYPE_LENS = 0x147,
479 };
480 #endif /* ZWP_TABLET_TOOL_V1_TYPE_ENUM */
481 
482 #ifndef ZWP_TABLET_TOOL_V1_CAPABILITY_ENUM
483 #define ZWP_TABLET_TOOL_V1_CAPABILITY_ENUM
484 /**
485  * @ingroup iface_zwp_tablet_tool_v1
486  * capability flags for a tool
487  *
488  * Describes extra capabilities on a tablet.
489  *
490  * Any tool must provide x and y values, extra axes are
491  * device-specific.
492  */
493 enum zwp_tablet_tool_v1_capability {
494 	/**
495 	 * Tilt axes
496 	 */
497 	ZWP_TABLET_TOOL_V1_CAPABILITY_TILT = 1,
498 	/**
499 	 * Pressure axis
500 	 */
501 	ZWP_TABLET_TOOL_V1_CAPABILITY_PRESSURE = 2,
502 	/**
503 	 * Distance axis
504 	 */
505 	ZWP_TABLET_TOOL_V1_CAPABILITY_DISTANCE = 3,
506 	/**
507 	 * Z-rotation axis
508 	 */
509 	ZWP_TABLET_TOOL_V1_CAPABILITY_ROTATION = 4,
510 	/**
511 	 * Slider axis
512 	 */
513 	ZWP_TABLET_TOOL_V1_CAPABILITY_SLIDER = 5,
514 	/**
515 	 * Wheel axis
516 	 */
517 	ZWP_TABLET_TOOL_V1_CAPABILITY_WHEEL = 6,
518 };
519 #endif /* ZWP_TABLET_TOOL_V1_CAPABILITY_ENUM */
520 
521 #ifndef ZWP_TABLET_TOOL_V1_BUTTON_STATE_ENUM
522 #define ZWP_TABLET_TOOL_V1_BUTTON_STATE_ENUM
523 /**
524  * @ingroup iface_zwp_tablet_tool_v1
525  * physical button state
526  *
527  * Describes the physical state of a button that produced the button event.
528  */
529 enum zwp_tablet_tool_v1_button_state {
530 	/**
531 	 * button is not pressed
532 	 */
533 	ZWP_TABLET_TOOL_V1_BUTTON_STATE_RELEASED = 0,
534 	/**
535 	 * button is pressed
536 	 */
537 	ZWP_TABLET_TOOL_V1_BUTTON_STATE_PRESSED = 1,
538 };
539 #endif /* ZWP_TABLET_TOOL_V1_BUTTON_STATE_ENUM */
540 
541 #ifndef ZWP_TABLET_TOOL_V1_ERROR_ENUM
542 #define ZWP_TABLET_TOOL_V1_ERROR_ENUM
543 enum zwp_tablet_tool_v1_error {
544 	/**
545 	 * given wl_surface has another role
546 	 */
547 	ZWP_TABLET_TOOL_V1_ERROR_ROLE = 0,
548 };
549 #endif /* ZWP_TABLET_TOOL_V1_ERROR_ENUM */
550 
551 /**
552  * @ingroup iface_zwp_tablet_tool_v1
553  * @struct zwp_tablet_tool_v1_listener
554  */
555 struct zwp_tablet_tool_v1_listener {
556 	/**
557 	 * tool type
558 	 *
559 	 * The tool type is the high-level type of the tool and usually
560 	 * decides the interaction expected from this tool.
561 	 *
562 	 * This event is sent in the initial burst of events before the
563 	 * wp_tablet_tool.done event.
564 	 * @param tool_type the physical tool type
565 	 */
566 	void (*type)(void *data,
567 		     struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
568 		     uint32_t tool_type);
569 	/**
570 	 * unique hardware serial number of the tool
571 	 *
572 	 * If the physical tool can be identified by a unique 64-bit
573 	 * serial number, this event notifies the client of this serial
574 	 * number.
575 	 *
576 	 * If multiple tablets are available in the same seat and the tool
577 	 * is uniquely identifiable by the serial number, that tool may
578 	 * move between tablets.
579 	 *
580 	 * Otherwise, if the tool has no serial number and this event is
581 	 * missing, the tool is tied to the tablet it first comes into
582 	 * proximity with. Even if the physical tool is used on multiple
583 	 * tablets, separate wp_tablet_tool objects will be created, one
584 	 * per tablet.
585 	 *
586 	 * This event is sent in the initial burst of events before the
587 	 * wp_tablet_tool.done event.
588 	 * @param hardware_serial_hi the unique serial number of the tool, most significant bits
589 	 * @param hardware_serial_lo the unique serial number of the tool, least significant bits
590 	 */
591 	void (*hardware_serial)(void *data,
592 				struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
593 				uint32_t hardware_serial_hi,
594 				uint32_t hardware_serial_lo);
595 	/**
596 	 * hardware id notification in Wacom's format
597 	 *
598 	 * This event notifies the client of a hardware id available on
599 	 * this tool.
600 	 *
601 	 * The hardware id is a device-specific 64-bit id that provides
602 	 * extra information about the tool in use, beyond the wl_tool.type
603 	 * enumeration. The format of the id is specific to tablets made by
604 	 * Wacom Inc. For example, the hardware id of a Wacom Grip Pen (a
605 	 * stylus) is 0x802.
606 	 *
607 	 * This event is sent in the initial burst of events before the
608 	 * wp_tablet_tool.done event.
609 	 * @param hardware_id_hi the hardware id, most significant bits
610 	 * @param hardware_id_lo the hardware id, least significant bits
611 	 */
612 	void (*hardware_id_wacom)(void *data,
613 				  struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
614 				  uint32_t hardware_id_hi,
615 				  uint32_t hardware_id_lo);
616 	/**
617 	 * tool capability notification
618 	 *
619 	 * This event notifies the client of any capabilities of this
620 	 * tool, beyond the main set of x/y axes and tip up/down detection.
621 	 *
622 	 * One event is sent for each extra capability available on this
623 	 * tool.
624 	 *
625 	 * This event is sent in the initial burst of events before the
626 	 * wp_tablet_tool.done event.
627 	 * @param capability the capability
628 	 */
629 	void (*capability)(void *data,
630 			   struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
631 			   uint32_t capability);
632 	/**
633 	 * tool description events sequence complete
634 	 *
635 	 * This event signals the end of the initial burst of descriptive
636 	 * events. A client may consider the static description of the tool
637 	 * to be complete and finalize initialization of the tool.
638 	 */
639 	void (*done)(void *data,
640 		     struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1);
641 	/**
642 	 * tool removed
643 	 *
644 	 * This event is sent when the tool is removed from the system
645 	 * and will send no further events. Should the physical tool come
646 	 * back into proximity later, a new wp_tablet_tool object will be
647 	 * created.
648 	 *
649 	 * It is compositor-dependent when a tool is removed. A compositor
650 	 * may remove a tool on proximity out, tablet removal or any other
651 	 * reason. A compositor may also keep a tool alive until shutdown.
652 	 *
653 	 * If the tool is currently in proximity, a proximity_out event
654 	 * will be sent before the removed event. See
655 	 * wp_tablet_tool.proximity_out for the handling of any buttons
656 	 * logically down.
657 	 *
658 	 * When this event is received, the client must
659 	 * wp_tablet_tool.destroy the object.
660 	 */
661 	void (*removed)(void *data,
662 			struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1);
663 	/**
664 	 * proximity in event
665 	 *
666 	 * Notification that this tool is focused on a certain surface.
667 	 *
668 	 * This event can be received when the tool has moved from one
669 	 * surface to another, or when the tool has come back into
670 	 * proximity above the surface.
671 	 *
672 	 * If any button is logically down when the tool comes into
673 	 * proximity, the respective button event is sent after the
674 	 * proximity_in event but within the same frame as the proximity_in
675 	 * event.
676 	 * @param tablet The tablet the tool is in proximity of
677 	 * @param surface The current surface the tablet tool is over
678 	 */
679 	void (*proximity_in)(void *data,
680 			     struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
681 			     uint32_t serial,
682 			     struct zwp_tablet_v1 *tablet,
683 			     struct wl_surface *surface);
684 	/**
685 	 * proximity out event
686 	 *
687 	 * Notification that this tool has either left proximity, or is
688 	 * no longer focused on a certain surface.
689 	 *
690 	 * When the tablet tool leaves proximity of the tablet, button
691 	 * release events are sent for each button that was held down at
692 	 * the time of leaving proximity. These events are sent before the
693 	 * proximity_out event but within the same wp_tablet.frame.
694 	 *
695 	 * If the tool stays within proximity of the tablet, but the focus
696 	 * changes from one surface to another, a button release event may
697 	 * not be sent until the button is actually released or the tool
698 	 * leaves the proximity of the tablet.
699 	 */
700 	void (*proximity_out)(void *data,
701 			      struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1);
702 	/**
703 	 * tablet tool is making contact
704 	 *
705 	 * Sent whenever the tablet tool comes in contact with the
706 	 * surface of the tablet.
707 	 *
708 	 * If the tool is already in contact with the tablet when entering
709 	 * the input region, the client owning said region will receive a
710 	 * wp_tablet.proximity_in event, followed by a wp_tablet.down event
711 	 * and a wp_tablet.frame event.
712 	 *
713 	 * Note that this event describes logical contact, not physical
714 	 * contact. On some devices, a compositor may not consider a tool
715 	 * in logical contact until a minimum physical pressure threshold
716 	 * is exceeded.
717 	 */
718 	void (*down)(void *data,
719 		     struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
720 		     uint32_t serial);
721 	/**
722 	 * tablet tool is no longer making contact
723 	 *
724 	 * Sent whenever the tablet tool stops making contact with the
725 	 * surface of the tablet, or when the tablet tool moves out of the
726 	 * input region and the compositor grab (if any) is dismissed.
727 	 *
728 	 * If the tablet tool moves out of the input region while in
729 	 * contact with the surface of the tablet and the compositor does
730 	 * not have an ongoing grab on the surface, the client owning said
731 	 * region will receive a wp_tablet.up event, followed by a
732 	 * wp_tablet.proximity_out event and a wp_tablet.frame event. If
733 	 * the compositor has an ongoing grab on this device, this event
734 	 * sequence is sent whenever the grab is dismissed in the future.
735 	 *
736 	 * Note that this event describes logical contact, not physical
737 	 * contact. On some devices, a compositor may not consider a tool
738 	 * out of logical contact until physical pressure falls below a
739 	 * specific threshold.
740 	 */
741 	void (*up)(void *data,
742 		   struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1);
743 	/**
744 	 * motion event
745 	 *
746 	 * Sent whenever a tablet tool moves.
747 	 * @param x surface-local x coordinate
748 	 * @param y surface-local y coordinate
749 	 */
750 	void (*motion)(void *data,
751 		       struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
752 		       wl_fixed_t x,
753 		       wl_fixed_t y);
754 	/**
755 	 * pressure change event
756 	 *
757 	 * Sent whenever the pressure axis on a tool changes. The value
758 	 * of this event is normalized to a value between 0 and 65535.
759 	 *
760 	 * Note that pressure may be nonzero even when a tool is not in
761 	 * logical contact. See the down and up events for more details.
762 	 * @param pressure The current pressure value
763 	 */
764 	void (*pressure)(void *data,
765 			 struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
766 			 uint32_t pressure);
767 	/**
768 	 * distance change event
769 	 *
770 	 * Sent whenever the distance axis on a tool changes. The value
771 	 * of this event is normalized to a value between 0 and 65535.
772 	 *
773 	 * Note that distance may be nonzero even when a tool is not in
774 	 * logical contact. See the down and up events for more details.
775 	 * @param distance The current distance value
776 	 */
777 	void (*distance)(void *data,
778 			 struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
779 			 uint32_t distance);
780 	/**
781 	 * tilt change event
782 	 *
783 	 * Sent whenever one or both of the tilt axes on a tool change.
784 	 * Each tilt value is in 0.01 of a degree, relative to the z-axis
785 	 * of the tablet. The angle is positive when the top of a tool
786 	 * tilts along the positive x or y axis.
787 	 * @param tilt_x The current value of the X tilt axis
788 	 * @param tilt_y The current value of the Y tilt axis
789 	 */
790 	void (*tilt)(void *data,
791 		     struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
792 		     int32_t tilt_x,
793 		     int32_t tilt_y);
794 	/**
795 	 * z-rotation change event
796 	 *
797 	 * Sent whenever the z-rotation axis on the tool changes. The
798 	 * rotation value is in 0.01 of a degree clockwise from the tool's
799 	 * logical neutral position.
800 	 * @param degrees The current rotation of the Z axis
801 	 */
802 	void (*rotation)(void *data,
803 			 struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
804 			 int32_t degrees);
805 	/**
806 	 * Slider position change event
807 	 *
808 	 * Sent whenever the slider position on the tool changes. The
809 	 * value is normalized between -65535 and 65535, with 0 as the
810 	 * logical neutral position of the slider.
811 	 *
812 	 * The slider is available on e.g. the Wacom Airbrush tool.
813 	 * @param position The current position of slider
814 	 */
815 	void (*slider)(void *data,
816 		       struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
817 		       int32_t position);
818 	/**
819 	 * Wheel delta event
820 	 *
821 	 * Sent whenever the wheel on the tool emits an event. This event
822 	 * contains two values for the same axis change. The degrees value
823 	 * is in 0.01 of a degree in the same orientation as the
824 	 * wl_pointer.vertical_scroll axis. The clicks value is in discrete
825 	 * logical clicks of the mouse wheel. This value may be zero if the
826 	 * movement of the wheel was less than one logical click.
827 	 *
828 	 * Clients should choose either value and avoid mixing degrees and
829 	 * clicks. The compositor may accumulate values smaller than a
830 	 * logical click and emulate click events when a certain threshold
831 	 * is met. Thus, wl_tablet_tool.wheel events with non-zero clicks
832 	 * values may have different degrees values.
833 	 * @param degrees The wheel delta in 0.01 of a degree
834 	 * @param clicks The wheel delta in discrete clicks
835 	 */
836 	void (*wheel)(void *data,
837 		      struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
838 		      int32_t degrees,
839 		      int32_t clicks);
840 	/**
841 	 * button event
842 	 *
843 	 * Sent whenever a button on the tool is pressed or released.
844 	 *
845 	 * If a button is held down when the tool moves in or out of
846 	 * proximity, button events are generated by the compositor. See
847 	 * wp_tablet_tool.proximity_in and wp_tablet_tool.proximity_out for
848 	 * details.
849 	 * @param button The button whose state has changed
850 	 * @param state Whether the button was pressed or released
851 	 */
852 	void (*button)(void *data,
853 		       struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
854 		       uint32_t serial,
855 		       uint32_t button,
856 		       uint32_t state);
857 	/**
858 	 * frame event
859 	 *
860 	 * Marks the end of a series of axis and/or button updates from
861 	 * the tablet. The Wayland protocol requires axis updates to be
862 	 * sent sequentially, however all events within a frame should be
863 	 * considered one hardware event.
864 	 * @param time The time of the event with millisecond granularity
865 	 */
866 	void (*frame)(void *data,
867 		      struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
868 		      uint32_t time);
869 };
870 
871 /**
872  * @ingroup iface_zwp_tablet_tool_v1
873  */
874 static inline int
zwp_tablet_tool_v1_add_listener(struct zwp_tablet_tool_v1 * zwp_tablet_tool_v1,const struct zwp_tablet_tool_v1_listener * listener,void * data)875 zwp_tablet_tool_v1_add_listener(struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1,
876 				const struct zwp_tablet_tool_v1_listener *listener, void *data)
877 {
878 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_tool_v1,
879 				     (void (**)(void)) listener, data);
880 }
881 
882 #define ZWP_TABLET_TOOL_V1_SET_CURSOR 0
883 #define ZWP_TABLET_TOOL_V1_DESTROY 1
884 
885 /**
886  * @ingroup iface_zwp_tablet_tool_v1
887  */
888 #define ZWP_TABLET_TOOL_V1_TYPE_SINCE_VERSION 1
889 /**
890  * @ingroup iface_zwp_tablet_tool_v1
891  */
892 #define ZWP_TABLET_TOOL_V1_HARDWARE_SERIAL_SINCE_VERSION 1
893 /**
894  * @ingroup iface_zwp_tablet_tool_v1
895  */
896 #define ZWP_TABLET_TOOL_V1_HARDWARE_ID_WACOM_SINCE_VERSION 1
897 /**
898  * @ingroup iface_zwp_tablet_tool_v1
899  */
900 #define ZWP_TABLET_TOOL_V1_CAPABILITY_SINCE_VERSION 1
901 /**
902  * @ingroup iface_zwp_tablet_tool_v1
903  */
904 #define ZWP_TABLET_TOOL_V1_DONE_SINCE_VERSION 1
905 /**
906  * @ingroup iface_zwp_tablet_tool_v1
907  */
908 #define ZWP_TABLET_TOOL_V1_REMOVED_SINCE_VERSION 1
909 /**
910  * @ingroup iface_zwp_tablet_tool_v1
911  */
912 #define ZWP_TABLET_TOOL_V1_PROXIMITY_IN_SINCE_VERSION 1
913 /**
914  * @ingroup iface_zwp_tablet_tool_v1
915  */
916 #define ZWP_TABLET_TOOL_V1_PROXIMITY_OUT_SINCE_VERSION 1
917 /**
918  * @ingroup iface_zwp_tablet_tool_v1
919  */
920 #define ZWP_TABLET_TOOL_V1_DOWN_SINCE_VERSION 1
921 /**
922  * @ingroup iface_zwp_tablet_tool_v1
923  */
924 #define ZWP_TABLET_TOOL_V1_UP_SINCE_VERSION 1
925 /**
926  * @ingroup iface_zwp_tablet_tool_v1
927  */
928 #define ZWP_TABLET_TOOL_V1_MOTION_SINCE_VERSION 1
929 /**
930  * @ingroup iface_zwp_tablet_tool_v1
931  */
932 #define ZWP_TABLET_TOOL_V1_PRESSURE_SINCE_VERSION 1
933 /**
934  * @ingroup iface_zwp_tablet_tool_v1
935  */
936 #define ZWP_TABLET_TOOL_V1_DISTANCE_SINCE_VERSION 1
937 /**
938  * @ingroup iface_zwp_tablet_tool_v1
939  */
940 #define ZWP_TABLET_TOOL_V1_TILT_SINCE_VERSION 1
941 /**
942  * @ingroup iface_zwp_tablet_tool_v1
943  */
944 #define ZWP_TABLET_TOOL_V1_ROTATION_SINCE_VERSION 1
945 /**
946  * @ingroup iface_zwp_tablet_tool_v1
947  */
948 #define ZWP_TABLET_TOOL_V1_SLIDER_SINCE_VERSION 1
949 /**
950  * @ingroup iface_zwp_tablet_tool_v1
951  */
952 #define ZWP_TABLET_TOOL_V1_WHEEL_SINCE_VERSION 1
953 /**
954  * @ingroup iface_zwp_tablet_tool_v1
955  */
956 #define ZWP_TABLET_TOOL_V1_BUTTON_SINCE_VERSION 1
957 /**
958  * @ingroup iface_zwp_tablet_tool_v1
959  */
960 #define ZWP_TABLET_TOOL_V1_FRAME_SINCE_VERSION 1
961 
962 /**
963  * @ingroup iface_zwp_tablet_tool_v1
964  */
965 #define ZWP_TABLET_TOOL_V1_SET_CURSOR_SINCE_VERSION 1
966 /**
967  * @ingroup iface_zwp_tablet_tool_v1
968  */
969 #define ZWP_TABLET_TOOL_V1_DESTROY_SINCE_VERSION 1
970 
971 /** @ingroup iface_zwp_tablet_tool_v1 */
972 static inline void
zwp_tablet_tool_v1_set_user_data(struct zwp_tablet_tool_v1 * zwp_tablet_tool_v1,void * user_data)973 zwp_tablet_tool_v1_set_user_data(struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1, void *user_data)
974 {
975 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_tool_v1, user_data);
976 }
977 
978 /** @ingroup iface_zwp_tablet_tool_v1 */
979 static inline void *
zwp_tablet_tool_v1_get_user_data(struct zwp_tablet_tool_v1 * zwp_tablet_tool_v1)980 zwp_tablet_tool_v1_get_user_data(struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1)
981 {
982 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_tool_v1);
983 }
984 
985 static inline uint32_t
zwp_tablet_tool_v1_get_version(struct zwp_tablet_tool_v1 * zwp_tablet_tool_v1)986 zwp_tablet_tool_v1_get_version(struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1)
987 {
988 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v1);
989 }
990 
991 /**
992  * @ingroup iface_zwp_tablet_tool_v1
993  *
994  * Sets the surface of the cursor used for this tool on the given
995  * tablet. This request only takes effect if the tool is in proximity
996  * of one of the requesting client's surfaces or the surface parameter
997  * is the current pointer surface. If there was a previous surface set
998  * with this request it is replaced. If surface is NULL, the cursor
999  * image is hidden.
1000  *
1001  * The parameters hotspot_x and hotspot_y define the position of the
1002  * pointer surface relative to the pointer location. Its top-left corner
1003  * is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the
1004  * coordinates of the pointer location, in surface-local coordinates.
1005  *
1006  * On surface.attach requests to the pointer surface, hotspot_x and
1007  * hotspot_y are decremented by the x and y parameters passed to the
1008  * request. Attach must be confirmed by wl_surface.commit as usual.
1009  *
1010  * The hotspot can also be updated by passing the currently set pointer
1011  * surface to this request with new values for hotspot_x and hotspot_y.
1012  *
1013  * The current and pending input regions of the wl_surface are cleared,
1014  * and wl_surface.set_input_region is ignored until the wl_surface is no
1015  * longer used as the cursor. When the use as a cursor ends, the current
1016  * and pending input regions become undefined, and the wl_surface is
1017  * unmapped.
1018  *
1019  * This request gives the surface the role of a cursor. The role
1020  * assigned by this request is the same as assigned by
1021  * wl_pointer.set_cursor meaning the same surface can be
1022  * used both as a wl_pointer cursor and a wp_tablet cursor. If the
1023  * surface already has another role, it raises a protocol error.
1024  * The surface may be used on multiple tablets and across multiple
1025  * seats.
1026  */
1027 static inline void
zwp_tablet_tool_v1_set_cursor(struct zwp_tablet_tool_v1 * zwp_tablet_tool_v1,uint32_t serial,struct wl_surface * surface,int32_t hotspot_x,int32_t hotspot_y)1028 zwp_tablet_tool_v1_set_cursor(struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)
1029 {
1030 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_tool_v1,
1031 			 ZWP_TABLET_TOOL_V1_SET_CURSOR, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v1), 0, serial, surface, hotspot_x, hotspot_y);
1032 }
1033 
1034 /**
1035  * @ingroup iface_zwp_tablet_tool_v1
1036  *
1037  * This destroys the client's resource for this tool object.
1038  */
1039 static inline void
zwp_tablet_tool_v1_destroy(struct zwp_tablet_tool_v1 * zwp_tablet_tool_v1)1040 zwp_tablet_tool_v1_destroy(struct zwp_tablet_tool_v1 *zwp_tablet_tool_v1)
1041 {
1042 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_tool_v1,
1043 			 ZWP_TABLET_TOOL_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v1), WL_MARSHAL_FLAG_DESTROY);
1044 }
1045 
1046 /**
1047  * @ingroup iface_zwp_tablet_v1
1048  * @struct zwp_tablet_v1_listener
1049  */
1050 struct zwp_tablet_v1_listener {
1051 	/**
1052 	 * tablet device name
1053 	 *
1054 	 * This event is sent in the initial burst of events before the
1055 	 * wp_tablet.done event.
1056 	 * @param name the device name
1057 	 */
1058 	void (*name)(void *data,
1059 		     struct zwp_tablet_v1 *zwp_tablet_v1,
1060 		     const char *name);
1061 	/**
1062 	 * tablet device USB vendor/product id
1063 	 *
1064 	 * This event is sent in the initial burst of events before the
1065 	 * wp_tablet.done event.
1066 	 * @param vid USB vendor id
1067 	 * @param pid USB product id
1068 	 */
1069 	void (*id)(void *data,
1070 		   struct zwp_tablet_v1 *zwp_tablet_v1,
1071 		   uint32_t vid,
1072 		   uint32_t pid);
1073 	/**
1074 	 * path to the device
1075 	 *
1076 	 * A system-specific device path that indicates which device is
1077 	 * behind this wp_tablet. This information may be used to gather
1078 	 * additional information about the device, e.g. through libwacom.
1079 	 *
1080 	 * A device may have more than one device path. If so, multiple
1081 	 * wp_tablet.path events are sent. A device may be emulated and not
1082 	 * have a device path, and in that case this event will not be
1083 	 * sent.
1084 	 *
1085 	 * The format of the path is unspecified, it may be a device node,
1086 	 * a sysfs path, or some other identifier. It is up to the client
1087 	 * to identify the string provided.
1088 	 *
1089 	 * This event is sent in the initial burst of events before the
1090 	 * wp_tablet.done event.
1091 	 * @param path path to local device
1092 	 */
1093 	void (*path)(void *data,
1094 		     struct zwp_tablet_v1 *zwp_tablet_v1,
1095 		     const char *path);
1096 	/**
1097 	 * tablet description events sequence complete
1098 	 *
1099 	 * This event is sent immediately to signal the end of the
1100 	 * initial burst of descriptive events. A client may consider the
1101 	 * static description of the tablet to be complete and finalize
1102 	 * initialization of the tablet.
1103 	 */
1104 	void (*done)(void *data,
1105 		     struct zwp_tablet_v1 *zwp_tablet_v1);
1106 	/**
1107 	 * tablet removed event
1108 	 *
1109 	 * Sent when the tablet has been removed from the system. When a
1110 	 * tablet is removed, some tools may be removed.
1111 	 *
1112 	 * When this event is received, the client must wp_tablet.destroy
1113 	 * the object.
1114 	 */
1115 	void (*removed)(void *data,
1116 			struct zwp_tablet_v1 *zwp_tablet_v1);
1117 };
1118 
1119 /**
1120  * @ingroup iface_zwp_tablet_v1
1121  */
1122 static inline int
zwp_tablet_v1_add_listener(struct zwp_tablet_v1 * zwp_tablet_v1,const struct zwp_tablet_v1_listener * listener,void * data)1123 zwp_tablet_v1_add_listener(struct zwp_tablet_v1 *zwp_tablet_v1,
1124 			   const struct zwp_tablet_v1_listener *listener, void *data)
1125 {
1126 	return wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_v1,
1127 				     (void (**)(void)) listener, data);
1128 }
1129 
1130 #define ZWP_TABLET_V1_DESTROY 0
1131 
1132 /**
1133  * @ingroup iface_zwp_tablet_v1
1134  */
1135 #define ZWP_TABLET_V1_NAME_SINCE_VERSION 1
1136 /**
1137  * @ingroup iface_zwp_tablet_v1
1138  */
1139 #define ZWP_TABLET_V1_ID_SINCE_VERSION 1
1140 /**
1141  * @ingroup iface_zwp_tablet_v1
1142  */
1143 #define ZWP_TABLET_V1_PATH_SINCE_VERSION 1
1144 /**
1145  * @ingroup iface_zwp_tablet_v1
1146  */
1147 #define ZWP_TABLET_V1_DONE_SINCE_VERSION 1
1148 /**
1149  * @ingroup iface_zwp_tablet_v1
1150  */
1151 #define ZWP_TABLET_V1_REMOVED_SINCE_VERSION 1
1152 
1153 /**
1154  * @ingroup iface_zwp_tablet_v1
1155  */
1156 #define ZWP_TABLET_V1_DESTROY_SINCE_VERSION 1
1157 
1158 /** @ingroup iface_zwp_tablet_v1 */
1159 static inline void
zwp_tablet_v1_set_user_data(struct zwp_tablet_v1 * zwp_tablet_v1,void * user_data)1160 zwp_tablet_v1_set_user_data(struct zwp_tablet_v1 *zwp_tablet_v1, void *user_data)
1161 {
1162 	wl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_v1, user_data);
1163 }
1164 
1165 /** @ingroup iface_zwp_tablet_v1 */
1166 static inline void *
zwp_tablet_v1_get_user_data(struct zwp_tablet_v1 * zwp_tablet_v1)1167 zwp_tablet_v1_get_user_data(struct zwp_tablet_v1 *zwp_tablet_v1)
1168 {
1169 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_v1);
1170 }
1171 
1172 static inline uint32_t
zwp_tablet_v1_get_version(struct zwp_tablet_v1 * zwp_tablet_v1)1173 zwp_tablet_v1_get_version(struct zwp_tablet_v1 *zwp_tablet_v1)
1174 {
1175 	return wl_proxy_get_version((struct wl_proxy *) zwp_tablet_v1);
1176 }
1177 
1178 /**
1179  * @ingroup iface_zwp_tablet_v1
1180  *
1181  * This destroys the client's resource for this tablet object.
1182  */
1183 static inline void
zwp_tablet_v1_destroy(struct zwp_tablet_v1 * zwp_tablet_v1)1184 zwp_tablet_v1_destroy(struct zwp_tablet_v1 *zwp_tablet_v1)
1185 {
1186 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_v1,
1187 			 ZWP_TABLET_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_v1), WL_MARSHAL_FLAG_DESTROY);
1188 }
1189 
1190 #ifdef  __cplusplus
1191 }
1192 #endif
1193 
1194 #endif
1195