1 /* Generated by wayland-scanner 1.22.0 */
2
3 #ifndef GAMING_INPUT_UNSTABLE_V2_CLIENT_PROTOCOL_H
4 #define GAMING_INPUT_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_gaming_input_unstable_v2 The gaming_input_unstable_v2 protocol
16 * @section page_ifaces_gaming_input_unstable_v2 Interfaces
17 * - @subpage page_iface_zcr_gaming_input_v2 - extends wl_seat with gaming input devices
18 * - @subpage page_iface_zcr_gaming_seat_v2 - controller object for all gaming devices of a seat
19 * - @subpage page_iface_zcr_gamepad_v2 - gamepad input device
20 * - @subpage page_iface_zcr_gamepad_vibrator_v2 - vibrator interface for a gamepad
21 * @section page_copyright_gaming_input_unstable_v2 Copyright
22 * <pre>
23 *
24 * Copyright 2016 The Chromium Authors
25 *
26 * Permission is hereby granted, free of charge, to any person obtaining a
27 * copy of this software and associated documentation files (the "Software"),
28 * to deal in the Software without restriction, including without limitation
29 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
30 * and/or sell copies of the Software, and to permit persons to whom the
31 * Software is furnished to do so, subject to the following conditions:
32 *
33 * The above copyright notice and this permission notice (including the next
34 * paragraph) shall be included in all copies or substantial portions of the
35 * Software.
36 *
37 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
40 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
43 * DEALINGS IN THE SOFTWARE.
44 * </pre>
45 */
46 struct wl_seat;
47 struct zcr_gamepad_v2;
48 struct zcr_gamepad_vibrator_v2;
49 struct zcr_gaming_input_v2;
50 struct zcr_gaming_seat_v2;
51
52 #ifndef ZCR_GAMING_INPUT_V2_INTERFACE
53 #define ZCR_GAMING_INPUT_V2_INTERFACE
54 /**
55 * @page page_iface_zcr_gaming_input_v2 zcr_gaming_input_v2
56 * @section page_iface_zcr_gaming_input_v2_desc Description
57 *
58 * A global interface to provide gaming input devices for a given seat.
59 *
60 * Currently only gamepad devices are supported.
61 *
62 * Warning! The protocol described in this file is experimental and
63 * backward incompatible changes may be made. Backward compatible changes
64 * may be added together with the corresponding uinterface version bump.
65 * Backward incompatible changes are done by bumping the version number in
66 * the protocol and uinterface names and resetting the interface version.
67 * Once the protocol is to be declared stable, the 'z' prefix and the
68 * version number in the protocol and interface names are removed and the
69 * interface version number is reset.
70 * @section page_iface_zcr_gaming_input_v2_api API
71 * See @ref iface_zcr_gaming_input_v2.
72 */
73 /**
74 * @defgroup iface_zcr_gaming_input_v2 The zcr_gaming_input_v2 interface
75 *
76 * A global interface to provide gaming input devices for a given seat.
77 *
78 * Currently only gamepad devices are supported.
79 *
80 * Warning! The protocol described in this file is experimental and
81 * backward incompatible changes may be made. Backward compatible changes
82 * may be added together with the corresponding uinterface version bump.
83 * Backward incompatible changes are done by bumping the version number in
84 * the protocol and uinterface names and resetting the interface version.
85 * Once the protocol is to be declared stable, the 'z' prefix and the
86 * version number in the protocol and interface names are removed and the
87 * interface version number is reset.
88 */
89 extern const struct wl_interface zcr_gaming_input_v2_interface;
90 #endif
91 #ifndef ZCR_GAMING_SEAT_V2_INTERFACE
92 #define ZCR_GAMING_SEAT_V2_INTERFACE
93 /**
94 * @page page_iface_zcr_gaming_seat_v2 zcr_gaming_seat_v2
95 * @section page_iface_zcr_gaming_seat_v2_desc Description
96 *
97 * An object that provides access to all the gaming devices of a seat.
98 * When a gamepad is connected, the compositor will send gamepad_added event.
99 * @section page_iface_zcr_gaming_seat_v2_api API
100 * See @ref iface_zcr_gaming_seat_v2.
101 */
102 /**
103 * @defgroup iface_zcr_gaming_seat_v2 The zcr_gaming_seat_v2 interface
104 *
105 * An object that provides access to all the gaming devices of a seat.
106 * When a gamepad is connected, the compositor will send gamepad_added event.
107 */
108 extern const struct wl_interface zcr_gaming_seat_v2_interface;
109 #endif
110 #ifndef ZCR_GAMEPAD_V2_INTERFACE
111 #define ZCR_GAMEPAD_V2_INTERFACE
112 /**
113 * @page page_iface_zcr_gamepad_v2 zcr_gamepad_v2
114 * @section page_iface_zcr_gamepad_v2_desc Description
115 *
116 * The zcr_gamepad_v2 interface represents one or more gamepad input devices,
117 * which are reported as a normalized 'Standard Gamepad' as it is specified
118 * by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping
119 * @section page_iface_zcr_gamepad_v2_api API
120 * See @ref iface_zcr_gamepad_v2.
121 */
122 /**
123 * @defgroup iface_zcr_gamepad_v2 The zcr_gamepad_v2 interface
124 *
125 * The zcr_gamepad_v2 interface represents one or more gamepad input devices,
126 * which are reported as a normalized 'Standard Gamepad' as it is specified
127 * by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping
128 */
129 extern const struct wl_interface zcr_gamepad_v2_interface;
130 #endif
131 #ifndef ZCR_GAMEPAD_VIBRATOR_V2_INTERFACE
132 #define ZCR_GAMEPAD_VIBRATOR_V2_INTERFACE
133 /**
134 * @page page_iface_zcr_gamepad_vibrator_v2 zcr_gamepad_vibrator_v2
135 * @section page_iface_zcr_gamepad_vibrator_v2_desc Description
136 *
137 * An interface that provides access to the vibrator of a gamepad. Requests can be
138 * sent to make the gamepad vibrate and to stop an ongoing vibration.
139 * @section page_iface_zcr_gamepad_vibrator_v2_api API
140 * See @ref iface_zcr_gamepad_vibrator_v2.
141 */
142 /**
143 * @defgroup iface_zcr_gamepad_vibrator_v2 The zcr_gamepad_vibrator_v2 interface
144 *
145 * An interface that provides access to the vibrator of a gamepad. Requests can be
146 * sent to make the gamepad vibrate and to stop an ongoing vibration.
147 */
148 extern const struct wl_interface zcr_gamepad_vibrator_v2_interface;
149 #endif
150
151 #define ZCR_GAMING_INPUT_V2_GET_GAMING_SEAT 0
152 #define ZCR_GAMING_INPUT_V2_DESTROY 1
153
154
155 /**
156 * @ingroup iface_zcr_gaming_input_v2
157 */
158 #define ZCR_GAMING_INPUT_V2_GET_GAMING_SEAT_SINCE_VERSION 1
159 /**
160 * @ingroup iface_zcr_gaming_input_v2
161 */
162 #define ZCR_GAMING_INPUT_V2_DESTROY_SINCE_VERSION 1
163
164 /** @ingroup iface_zcr_gaming_input_v2 */
165 static inline void
zcr_gaming_input_v2_set_user_data(struct zcr_gaming_input_v2 * zcr_gaming_input_v2,void * user_data)166 zcr_gaming_input_v2_set_user_data(struct zcr_gaming_input_v2 *zcr_gaming_input_v2, void *user_data)
167 {
168 wl_proxy_set_user_data((struct wl_proxy *) zcr_gaming_input_v2, user_data);
169 }
170
171 /** @ingroup iface_zcr_gaming_input_v2 */
172 static inline void *
zcr_gaming_input_v2_get_user_data(struct zcr_gaming_input_v2 * zcr_gaming_input_v2)173 zcr_gaming_input_v2_get_user_data(struct zcr_gaming_input_v2 *zcr_gaming_input_v2)
174 {
175 return wl_proxy_get_user_data((struct wl_proxy *) zcr_gaming_input_v2);
176 }
177
178 static inline uint32_t
zcr_gaming_input_v2_get_version(struct zcr_gaming_input_v2 * zcr_gaming_input_v2)179 zcr_gaming_input_v2_get_version(struct zcr_gaming_input_v2 *zcr_gaming_input_v2)
180 {
181 return wl_proxy_get_version((struct wl_proxy *) zcr_gaming_input_v2);
182 }
183
184 /**
185 * @ingroup iface_zcr_gaming_input_v2
186 *
187 * Get a gaming seat object for a given seat. Gaming seat provides access
188 * to gaming devices
189 */
190 static inline struct zcr_gaming_seat_v2 *
zcr_gaming_input_v2_get_gaming_seat(struct zcr_gaming_input_v2 * zcr_gaming_input_v2,struct wl_seat * seat)191 zcr_gaming_input_v2_get_gaming_seat(struct zcr_gaming_input_v2 *zcr_gaming_input_v2, struct wl_seat *seat)
192 {
193 struct wl_proxy *gaming_seat;
194
195 gaming_seat = wl_proxy_marshal_flags((struct wl_proxy *) zcr_gaming_input_v2,
196 ZCR_GAMING_INPUT_V2_GET_GAMING_SEAT, &zcr_gaming_seat_v2_interface, wl_proxy_get_version((struct wl_proxy *) zcr_gaming_input_v2), 0, NULL, seat);
197
198 return (struct zcr_gaming_seat_v2 *) gaming_seat;
199 }
200
201 /**
202 * @ingroup iface_zcr_gaming_input_v2
203 *
204 * Destroy gaming_input object. Objects created from this object are
205 * unaffected and should be destroyed separately.
206 */
207 static inline void
zcr_gaming_input_v2_destroy(struct zcr_gaming_input_v2 * zcr_gaming_input_v2)208 zcr_gaming_input_v2_destroy(struct zcr_gaming_input_v2 *zcr_gaming_input_v2)
209 {
210 wl_proxy_marshal_flags((struct wl_proxy *) zcr_gaming_input_v2,
211 ZCR_GAMING_INPUT_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_gaming_input_v2), WL_MARSHAL_FLAG_DESTROY);
212 }
213
214 #ifndef ZCR_GAMING_SEAT_V2_BUS_TYPE_ENUM
215 #define ZCR_GAMING_SEAT_V2_BUS_TYPE_ENUM
216 /**
217 * @ingroup iface_zcr_gaming_seat_v2
218 * gamepad device bus type
219 *
220 * Device connection type e.g. Bluetooth
221 */
222 enum zcr_gaming_seat_v2_bus_type {
223 /**
224 * Universal Serial Bus
225 */
226 ZCR_GAMING_SEAT_V2_BUS_TYPE_USB = 0,
227 /**
228 * Bluetooth
229 */
230 ZCR_GAMING_SEAT_V2_BUS_TYPE_BLUETOOTH = 1,
231 };
232 #endif /* ZCR_GAMING_SEAT_V2_BUS_TYPE_ENUM */
233
234 /**
235 * @ingroup iface_zcr_gaming_seat_v2
236 * @struct zcr_gaming_seat_v2_listener
237 */
238 struct zcr_gaming_seat_v2_listener {
239 /**
240 * gamepad added event
241 *
242 * Notification that there is gamepad connected at this seat.
243 * @param gamepad new connected gamepad
244 */
245 void (*gamepad_added)(void *data,
246 struct zcr_gaming_seat_v2 *zcr_gaming_seat_v2,
247 struct zcr_gamepad_v2 *gamepad);
248 /**
249 * gamepad added event
250 *
251 * Notification that there is gamepad connected at this seat.
252 * @param gamepad new connected gamepad
253 * @param name name of the gamepad device
254 * @param bus type of the device connection e.g. Bluetooth
255 * @param vendor_id vendor ID of the gamepad device
256 * @param product_id product ID of the gamepad device
257 * @param version product version of the gamepad device
258 */
259 void (*gamepad_added_with_device_info)(void *data,
260 struct zcr_gaming_seat_v2 *zcr_gaming_seat_v2,
261 struct zcr_gamepad_v2 *gamepad,
262 const char *name,
263 uint32_t bus,
264 uint32_t vendor_id,
265 uint32_t product_id,
266 uint32_t version);
267 };
268
269 /**
270 * @ingroup iface_zcr_gaming_seat_v2
271 */
272 static inline int
zcr_gaming_seat_v2_add_listener(struct zcr_gaming_seat_v2 * zcr_gaming_seat_v2,const struct zcr_gaming_seat_v2_listener * listener,void * data)273 zcr_gaming_seat_v2_add_listener(struct zcr_gaming_seat_v2 *zcr_gaming_seat_v2,
274 const struct zcr_gaming_seat_v2_listener *listener, void *data)
275 {
276 return wl_proxy_add_listener((struct wl_proxy *) zcr_gaming_seat_v2,
277 (void (**)(void)) listener, data);
278 }
279
280 #define ZCR_GAMING_SEAT_V2_DESTROY 0
281
282 /**
283 * @ingroup iface_zcr_gaming_seat_v2
284 */
285 #define ZCR_GAMING_SEAT_V2_GAMEPAD_ADDED_SINCE_VERSION 1
286 /**
287 * @ingroup iface_zcr_gaming_seat_v2
288 */
289 #define ZCR_GAMING_SEAT_V2_GAMEPAD_ADDED_WITH_DEVICE_INFO_SINCE_VERSION 1
290
291 /**
292 * @ingroup iface_zcr_gaming_seat_v2
293 */
294 #define ZCR_GAMING_SEAT_V2_DESTROY_SINCE_VERSION 1
295
296 /** @ingroup iface_zcr_gaming_seat_v2 */
297 static inline void
zcr_gaming_seat_v2_set_user_data(struct zcr_gaming_seat_v2 * zcr_gaming_seat_v2,void * user_data)298 zcr_gaming_seat_v2_set_user_data(struct zcr_gaming_seat_v2 *zcr_gaming_seat_v2, void *user_data)
299 {
300 wl_proxy_set_user_data((struct wl_proxy *) zcr_gaming_seat_v2, user_data);
301 }
302
303 /** @ingroup iface_zcr_gaming_seat_v2 */
304 static inline void *
zcr_gaming_seat_v2_get_user_data(struct zcr_gaming_seat_v2 * zcr_gaming_seat_v2)305 zcr_gaming_seat_v2_get_user_data(struct zcr_gaming_seat_v2 *zcr_gaming_seat_v2)
306 {
307 return wl_proxy_get_user_data((struct wl_proxy *) zcr_gaming_seat_v2);
308 }
309
310 static inline uint32_t
zcr_gaming_seat_v2_get_version(struct zcr_gaming_seat_v2 * zcr_gaming_seat_v2)311 zcr_gaming_seat_v2_get_version(struct zcr_gaming_seat_v2 *zcr_gaming_seat_v2)
312 {
313 return wl_proxy_get_version((struct wl_proxy *) zcr_gaming_seat_v2);
314 }
315
316 /**
317 * @ingroup iface_zcr_gaming_seat_v2
318 *
319 * Destroy gaming_seat object. Objects created from this object are
320 * unaffected and should be destroyed separately.
321 */
322 static inline void
zcr_gaming_seat_v2_destroy(struct zcr_gaming_seat_v2 * zcr_gaming_seat_v2)323 zcr_gaming_seat_v2_destroy(struct zcr_gaming_seat_v2 *zcr_gaming_seat_v2)
324 {
325 wl_proxy_marshal_flags((struct wl_proxy *) zcr_gaming_seat_v2,
326 ZCR_GAMING_SEAT_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_gaming_seat_v2), WL_MARSHAL_FLAG_DESTROY);
327 }
328
329 #ifndef ZCR_GAMEPAD_V2_BUTTON_STATE_ENUM
330 #define ZCR_GAMEPAD_V2_BUTTON_STATE_ENUM
331 /**
332 * @ingroup iface_zcr_gamepad_v2
333 * physical button state
334 *
335 * Describes the physical state of a button that produced the button
336 * event.
337 */
338 enum zcr_gamepad_v2_button_state {
339 /**
340 * the button is not pressed
341 */
342 ZCR_GAMEPAD_V2_BUTTON_STATE_RELEASED = 0,
343 /**
344 * the button is pressed
345 */
346 ZCR_GAMEPAD_V2_BUTTON_STATE_PRESSED = 1,
347 };
348 #endif /* ZCR_GAMEPAD_V2_BUTTON_STATE_ENUM */
349
350 /**
351 * @ingroup iface_zcr_gamepad_v2
352 * @struct zcr_gamepad_v2_listener
353 */
354 struct zcr_gamepad_v2_listener {
355 /**
356 * gamepad removed
357 *
358 * Removed event is send when the gamepad is disconnected. The
359 * client should expect no more event and call destroy.
360 *
361 * This event cannot be used as destructor as requests (e.g.
362 * vibration) might be added to this interface.
363 */
364 void (*removed)(void *data,
365 struct zcr_gamepad_v2 *zcr_gamepad_v2);
366 /**
367 * axis change event
368 *
369 * Notification of axis change.
370 *
371 * The axis id specifies which axis has changed as defined by the
372 * W3C 'Standard Gamepad'.
373 *
374 * The value is calibrated and normalized to the -1 to 1 range.
375 * @param time timestamp with millisecond granularity
376 * @param axis axis that produced this event
377 * @param value new value of axis
378 */
379 void (*axis)(void *data,
380 struct zcr_gamepad_v2 *zcr_gamepad_v2,
381 uint32_t time,
382 uint32_t axis,
383 wl_fixed_t value);
384 /**
385 * Gamepad button changed
386 *
387 * Notification of button change.
388 *
389 * The button id specifies which button has changed as defined by
390 * the W3C 'Standard Gamepad'.
391 *
392 * A button can have a digital and an analog value. The analog
393 * value is normalized to a 0 to 1 range. If a button does not
394 * provide an analog value, it will be derived from the digital
395 * state.
396 * @param time timestamp with millisecond granularity
397 * @param button id of button
398 * @param state digital state of the button
399 * @param analog analog value of the button
400 */
401 void (*button)(void *data,
402 struct zcr_gamepad_v2 *zcr_gamepad_v2,
403 uint32_t time,
404 uint32_t button,
405 uint32_t state,
406 wl_fixed_t analog);
407 /**
408 * Notifies end of a series of gamepad changes.
409 *
410 * Indicates the end of a set of events that logically belong
411 * together. A client is expected to accumulate the data in all
412 * events within the frame before proceeding.
413 * @param time timestamp with millisecond granularity
414 */
415 void (*frame)(void *data,
416 struct zcr_gamepad_v2 *zcr_gamepad_v2,
417 uint32_t time);
418 /**
419 * an axis is added
420 *
421 * Adds an axis to the gamepad. Only called when the gamepad was
422 * created by gamepad_added_with_device_info. The values are
423 * compatible with input_absinfo.
424 * @param index An index of the axis
425 * @param min_value minimum value of the axis
426 * @param max_value maximum value of the axis
427 * @param flat input within this value are ignored
428 * @param fuzz used to filter noise
429 * @param resolution resolution of input in units per millimeter, or units per radian for rotational axes.
430 */
431 void (*axis_added)(void *data,
432 struct zcr_gamepad_v2 *zcr_gamepad_v2,
433 uint32_t index,
434 int32_t min_value,
435 int32_t max_value,
436 int32_t flat,
437 int32_t fuzz,
438 int32_t resolution);
439 /**
440 * Gamepad activated
441 *
442 * Activates the gamepad i.e. the gamepad will be visible to
443 * applications after this event is fired. All axis_added events
444 * should be sent before this event. Only called when the gamepad
445 * was created by gamepad_added_with_device_info.
446 */
447 void (*activated)(void *data,
448 struct zcr_gamepad_v2 *zcr_gamepad_v2);
449 /**
450 * a vibrator is added
451 *
452 * Adds a vibrator to the gamepad. Only called if server has
453 * verified that gamepad has a vibrator. The vibrator(s) for a
454 * gamepad are expected to be added before the "activated" event is
455 * called.
456 * @param vibrator the gamepad vibrator
457 * @since 2
458 */
459 void (*vibrator_added)(void *data,
460 struct zcr_gamepad_v2 *zcr_gamepad_v2,
461 struct zcr_gamepad_vibrator_v2 *vibrator);
462 /**
463 * supported key bits
464 *
465 * Supported scan code key bits of the gamepad device.
466 * @param key_bits Uint64 key bits
467 * @since 3
468 */
469 void (*supported_key_bits)(void *data,
470 struct zcr_gamepad_v2 *zcr_gamepad_v2,
471 struct wl_array *key_bits);
472 };
473
474 /**
475 * @ingroup iface_zcr_gamepad_v2
476 */
477 static inline int
zcr_gamepad_v2_add_listener(struct zcr_gamepad_v2 * zcr_gamepad_v2,const struct zcr_gamepad_v2_listener * listener,void * data)478 zcr_gamepad_v2_add_listener(struct zcr_gamepad_v2 *zcr_gamepad_v2,
479 const struct zcr_gamepad_v2_listener *listener, void *data)
480 {
481 return wl_proxy_add_listener((struct wl_proxy *) zcr_gamepad_v2,
482 (void (**)(void)) listener, data);
483 }
484
485 #define ZCR_GAMEPAD_V2_DESTROY 0
486
487 /**
488 * @ingroup iface_zcr_gamepad_v2
489 */
490 #define ZCR_GAMEPAD_V2_REMOVED_SINCE_VERSION 1
491 /**
492 * @ingroup iface_zcr_gamepad_v2
493 */
494 #define ZCR_GAMEPAD_V2_AXIS_SINCE_VERSION 1
495 /**
496 * @ingroup iface_zcr_gamepad_v2
497 */
498 #define ZCR_GAMEPAD_V2_BUTTON_SINCE_VERSION 1
499 /**
500 * @ingroup iface_zcr_gamepad_v2
501 */
502 #define ZCR_GAMEPAD_V2_FRAME_SINCE_VERSION 1
503 /**
504 * @ingroup iface_zcr_gamepad_v2
505 */
506 #define ZCR_GAMEPAD_V2_AXIS_ADDED_SINCE_VERSION 1
507 /**
508 * @ingroup iface_zcr_gamepad_v2
509 */
510 #define ZCR_GAMEPAD_V2_ACTIVATED_SINCE_VERSION 1
511 /**
512 * @ingroup iface_zcr_gamepad_v2
513 */
514 #define ZCR_GAMEPAD_V2_VIBRATOR_ADDED_SINCE_VERSION 2
515 /**
516 * @ingroup iface_zcr_gamepad_v2
517 */
518 #define ZCR_GAMEPAD_V2_SUPPORTED_KEY_BITS_SINCE_VERSION 3
519
520 /**
521 * @ingroup iface_zcr_gamepad_v2
522 */
523 #define ZCR_GAMEPAD_V2_DESTROY_SINCE_VERSION 1
524
525 /** @ingroup iface_zcr_gamepad_v2 */
526 static inline void
zcr_gamepad_v2_set_user_data(struct zcr_gamepad_v2 * zcr_gamepad_v2,void * user_data)527 zcr_gamepad_v2_set_user_data(struct zcr_gamepad_v2 *zcr_gamepad_v2, void *user_data)
528 {
529 wl_proxy_set_user_data((struct wl_proxy *) zcr_gamepad_v2, user_data);
530 }
531
532 /** @ingroup iface_zcr_gamepad_v2 */
533 static inline void *
zcr_gamepad_v2_get_user_data(struct zcr_gamepad_v2 * zcr_gamepad_v2)534 zcr_gamepad_v2_get_user_data(struct zcr_gamepad_v2 *zcr_gamepad_v2)
535 {
536 return wl_proxy_get_user_data((struct wl_proxy *) zcr_gamepad_v2);
537 }
538
539 static inline uint32_t
zcr_gamepad_v2_get_version(struct zcr_gamepad_v2 * zcr_gamepad_v2)540 zcr_gamepad_v2_get_version(struct zcr_gamepad_v2 *zcr_gamepad_v2)
541 {
542 return wl_proxy_get_version((struct wl_proxy *) zcr_gamepad_v2);
543 }
544
545 /**
546 * @ingroup iface_zcr_gamepad_v2
547 *
548 * Destroy gamepad. Instances created from this gamepad are unaffected
549 * and should be destroyed separately.
550 */
551 static inline void
zcr_gamepad_v2_destroy(struct zcr_gamepad_v2 * zcr_gamepad_v2)552 zcr_gamepad_v2_destroy(struct zcr_gamepad_v2 *zcr_gamepad_v2)
553 {
554 wl_proxy_marshal_flags((struct wl_proxy *) zcr_gamepad_v2,
555 ZCR_GAMEPAD_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_gamepad_v2), WL_MARSHAL_FLAG_DESTROY);
556 }
557
558 #define ZCR_GAMEPAD_VIBRATOR_V2_VIBRATE 0
559 #define ZCR_GAMEPAD_VIBRATOR_V2_CANCEL_VIBRATION 1
560 #define ZCR_GAMEPAD_VIBRATOR_V2_DESTROY 2
561
562
563 /**
564 * @ingroup iface_zcr_gamepad_vibrator_v2
565 */
566 #define ZCR_GAMEPAD_VIBRATOR_V2_VIBRATE_SINCE_VERSION 2
567 /**
568 * @ingroup iface_zcr_gamepad_vibrator_v2
569 */
570 #define ZCR_GAMEPAD_VIBRATOR_V2_CANCEL_VIBRATION_SINCE_VERSION 2
571 /**
572 * @ingroup iface_zcr_gamepad_vibrator_v2
573 */
574 #define ZCR_GAMEPAD_VIBRATOR_V2_DESTROY_SINCE_VERSION 2
575
576 /** @ingroup iface_zcr_gamepad_vibrator_v2 */
577 static inline void
zcr_gamepad_vibrator_v2_set_user_data(struct zcr_gamepad_vibrator_v2 * zcr_gamepad_vibrator_v2,void * user_data)578 zcr_gamepad_vibrator_v2_set_user_data(struct zcr_gamepad_vibrator_v2 *zcr_gamepad_vibrator_v2, void *user_data)
579 {
580 wl_proxy_set_user_data((struct wl_proxy *) zcr_gamepad_vibrator_v2, user_data);
581 }
582
583 /** @ingroup iface_zcr_gamepad_vibrator_v2 */
584 static inline void *
zcr_gamepad_vibrator_v2_get_user_data(struct zcr_gamepad_vibrator_v2 * zcr_gamepad_vibrator_v2)585 zcr_gamepad_vibrator_v2_get_user_data(struct zcr_gamepad_vibrator_v2 *zcr_gamepad_vibrator_v2)
586 {
587 return wl_proxy_get_user_data((struct wl_proxy *) zcr_gamepad_vibrator_v2);
588 }
589
590 static inline uint32_t
zcr_gamepad_vibrator_v2_get_version(struct zcr_gamepad_vibrator_v2 * zcr_gamepad_vibrator_v2)591 zcr_gamepad_vibrator_v2_get_version(struct zcr_gamepad_vibrator_v2 *zcr_gamepad_vibrator_v2)
592 {
593 return wl_proxy_get_version((struct wl_proxy *) zcr_gamepad_vibrator_v2);
594 }
595
596 /**
597 * @ingroup iface_zcr_gamepad_vibrator_v2
598 *
599 * Triggers the vibration event on the gamepad vibrator. The gamepad is only allowed to
600 * vibrate while the window is in focus. The values in the timings array are 64-bit integers
601 * and the values in the amplitudes array are unsigned 8-bit integers.
602 * The timings array and the amplitudes array are of the same length.
603 * For each timing/amplitude pair, the amplitude determines the strength of
604 * the vibration and the timing determines the length of the vibration in milliseconds.
605 * Amplitude values must be between 0 and 255. An amplitude of 0 implies no vibration
606 * and any timing/amplitude pair with a timing value of 0 is ignored.
607 * The repeat argument determines the index at which the vibration pattern to repeat begins.
608 * A repeat value of -1 disables repetition. If repetition is enabled, the vibration
609 * pattern will repeat indefinitely until stopped, or when focus is lost.
610 */
611 static inline void
zcr_gamepad_vibrator_v2_vibrate(struct zcr_gamepad_vibrator_v2 * zcr_gamepad_vibrator_v2,struct wl_array * timings,struct wl_array * amplitudes,int32_t repeat)612 zcr_gamepad_vibrator_v2_vibrate(struct zcr_gamepad_vibrator_v2 *zcr_gamepad_vibrator_v2, struct wl_array *timings, struct wl_array *amplitudes, int32_t repeat)
613 {
614 wl_proxy_marshal_flags((struct wl_proxy *) zcr_gamepad_vibrator_v2,
615 ZCR_GAMEPAD_VIBRATOR_V2_VIBRATE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_gamepad_vibrator_v2), 0, timings, amplitudes, repeat);
616 }
617
618 /**
619 * @ingroup iface_zcr_gamepad_vibrator_v2
620 *
621 * Cancels the currently ongoing vibration event on the gamepad vibrator.
622 */
623 static inline void
zcr_gamepad_vibrator_v2_cancel_vibration(struct zcr_gamepad_vibrator_v2 * zcr_gamepad_vibrator_v2)624 zcr_gamepad_vibrator_v2_cancel_vibration(struct zcr_gamepad_vibrator_v2 *zcr_gamepad_vibrator_v2)
625 {
626 wl_proxy_marshal_flags((struct wl_proxy *) zcr_gamepad_vibrator_v2,
627 ZCR_GAMEPAD_VIBRATOR_V2_CANCEL_VIBRATION, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_gamepad_vibrator_v2), 0);
628 }
629
630 /**
631 * @ingroup iface_zcr_gamepad_vibrator_v2
632 */
633 static inline void
zcr_gamepad_vibrator_v2_destroy(struct zcr_gamepad_vibrator_v2 * zcr_gamepad_vibrator_v2)634 zcr_gamepad_vibrator_v2_destroy(struct zcr_gamepad_vibrator_v2 *zcr_gamepad_vibrator_v2)
635 {
636 wl_proxy_marshal_flags((struct wl_proxy *) zcr_gamepad_vibrator_v2,
637 ZCR_GAMEPAD_VIBRATOR_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_gamepad_vibrator_v2), WL_MARSHAL_FLAG_DESTROY);
638 }
639
640 #ifdef __cplusplus
641 }
642 #endif
643
644 #endif
645