Rob Buis | 979e6a1 | 2017-10-02 17:39:48 +0000 | [diff] [blame] | 1 | /* Generated by wayland-scanner 1.13.0 */ |
| 2 | |
| 3 | #ifndef GAMING_INPUT_UNSTABLE_V1_CLIENT_PROTOCOL_H |
| 4 | #define GAMING_INPUT_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_gaming_input_unstable_v1 The gaming_input_unstable_v1 protocol |
| 16 | * @section page_ifaces_gaming_input_unstable_v1 Interfaces |
| 17 | * - @subpage page_iface_zcr_gaming_input_v1 - extends wl_seat with gaming input devices |
| 18 | * - @subpage page_iface_zcr_gamepad_v1 - gamepad input device |
| 19 | * @section page_copyright_gaming_input_unstable_v1 Copyright |
| 20 | * <pre> |
| 21 | * |
| 22 | * Copyright 2016 The Chromium Authors. |
| 23 | * |
| 24 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 25 | * copy of this software and associated documentation files (the "Software"), |
| 26 | * to deal in the Software without restriction, including without limitation |
| 27 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 28 | * and/or sell copies of the Software, and to permit persons to whom the |
| 29 | * Software is furnished to do so, subject to the following conditions: |
| 30 | * |
| 31 | * The above copyright notice and this permission notice (including the next |
| 32 | * paragraph) shall be included in all copies or substantial portions of the |
| 33 | * Software. |
| 34 | * |
| 35 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 36 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 37 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 38 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 39 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 40 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 41 | * DEALINGS IN THE SOFTWARE. |
| 42 | * </pre> |
| 43 | */ |
| 44 | struct wl_seat; |
| 45 | struct zcr_gamepad_v1; |
| 46 | struct zcr_gaming_input_v1; |
| 47 | |
| 48 | /** |
| 49 | * @page page_iface_zcr_gaming_input_v1 zcr_gaming_input_v1 |
| 50 | * @section page_iface_zcr_gaming_input_v1_desc Description |
| 51 | * |
| 52 | * A global interface to provide gaming input devices for a given seat. |
| 53 | * |
| 54 | * Currently only gamepad devices are supported. |
| 55 | * |
| 56 | * Warning! The protocol described in this file is experimental and |
| 57 | * backward incompatible changes may be made. Backward compatible changes |
| 58 | * may be added together with the corresponding uinterface version bump. |
| 59 | * Backward incompatible changes are done by bumping the version number in |
| 60 | * the protocol and uinterface names and resetting the interface version. |
| 61 | * Once the protocol is to be declared stable, the 'z' prefix and the |
| 62 | * version number in the protocol and interface names are removed and the |
| 63 | * interface version number is reset. |
| 64 | * @section page_iface_zcr_gaming_input_v1_api API |
| 65 | * See @ref iface_zcr_gaming_input_v1. |
| 66 | */ |
| 67 | /** |
| 68 | * @defgroup iface_zcr_gaming_input_v1 The zcr_gaming_input_v1 interface |
| 69 | * |
| 70 | * A global interface to provide gaming input devices for a given seat. |
| 71 | * |
| 72 | * Currently only gamepad devices are supported. |
| 73 | * |
| 74 | * Warning! The protocol described in this file is experimental and |
| 75 | * backward incompatible changes may be made. Backward compatible changes |
| 76 | * may be added together with the corresponding uinterface version bump. |
| 77 | * Backward incompatible changes are done by bumping the version number in |
| 78 | * the protocol and uinterface names and resetting the interface version. |
| 79 | * Once the protocol is to be declared stable, the 'z' prefix and the |
| 80 | * version number in the protocol and interface names are removed and the |
| 81 | * interface version number is reset. |
| 82 | */ |
| 83 | extern const struct wl_interface zcr_gaming_input_v1_interface; |
| 84 | /** |
| 85 | * @page page_iface_zcr_gamepad_v1 zcr_gamepad_v1 |
| 86 | * @section page_iface_zcr_gamepad_v1_desc Description |
| 87 | * |
| 88 | * The zcr_gamepad_v1 interface represents one or more gamepad input devices, |
| 89 | * which are reported as a normalized 'Standard Gamepad' as it is specified |
| 90 | * by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping |
| 91 | * @section page_iface_zcr_gamepad_v1_api API |
| 92 | * See @ref iface_zcr_gamepad_v1. |
| 93 | */ |
| 94 | /** |
| 95 | * @defgroup iface_zcr_gamepad_v1 The zcr_gamepad_v1 interface |
| 96 | * |
| 97 | * The zcr_gamepad_v1 interface represents one or more gamepad input devices, |
| 98 | * which are reported as a normalized 'Standard Gamepad' as it is specified |
| 99 | * by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping |
| 100 | */ |
| 101 | extern const struct wl_interface zcr_gamepad_v1_interface; |
| 102 | |
| 103 | #define ZCR_GAMING_INPUT_V1_GET_GAMEPAD 0 |
| 104 | |
| 105 | |
| 106 | /** |
| 107 | * @ingroup iface_zcr_gaming_input_v1 |
| 108 | */ |
| 109 | #define ZCR_GAMING_INPUT_V1_GET_GAMEPAD_SINCE_VERSION 1 |
| 110 | |
| 111 | /** @ingroup iface_zcr_gaming_input_v1 */ |
| 112 | static inline void |
| 113 | zcr_gaming_input_v1_set_user_data(struct zcr_gaming_input_v1 *zcr_gaming_input_v1, void *user_data) |
| 114 | { |
| 115 | wl_proxy_set_user_data((struct wl_proxy *) zcr_gaming_input_v1, user_data); |
| 116 | } |
| 117 | |
| 118 | /** @ingroup iface_zcr_gaming_input_v1 */ |
| 119 | static inline void * |
| 120 | zcr_gaming_input_v1_get_user_data(struct zcr_gaming_input_v1 *zcr_gaming_input_v1) |
| 121 | { |
| 122 | return wl_proxy_get_user_data((struct wl_proxy *) zcr_gaming_input_v1); |
| 123 | } |
| 124 | |
| 125 | static inline uint32_t |
| 126 | zcr_gaming_input_v1_get_version(struct zcr_gaming_input_v1 *zcr_gaming_input_v1) |
| 127 | { |
| 128 | return wl_proxy_get_version((struct wl_proxy *) zcr_gaming_input_v1); |
| 129 | } |
| 130 | |
| 131 | /** @ingroup iface_zcr_gaming_input_v1 */ |
| 132 | static inline void |
| 133 | zcr_gaming_input_v1_destroy(struct zcr_gaming_input_v1 *zcr_gaming_input_v1) |
| 134 | { |
| 135 | wl_proxy_destroy((struct wl_proxy *) zcr_gaming_input_v1); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * @ingroup iface_zcr_gaming_input_v1 |
| 140 | * |
| 141 | * Create gamepad object. See zcr_gamepad_v1 interface for details. |
| 142 | */ |
| 143 | static inline struct zcr_gamepad_v1 * |
| 144 | zcr_gaming_input_v1_get_gamepad(struct zcr_gaming_input_v1 *zcr_gaming_input_v1, struct wl_seat *seat) |
| 145 | { |
| 146 | struct wl_proxy *id; |
| 147 | |
| 148 | id = wl_proxy_marshal_constructor((struct wl_proxy *) zcr_gaming_input_v1, |
| 149 | ZCR_GAMING_INPUT_V1_GET_GAMEPAD, &zcr_gamepad_v1_interface, NULL, seat); |
| 150 | |
| 151 | return (struct zcr_gamepad_v1 *) id; |
| 152 | } |
| 153 | |
| 154 | #ifndef ZCR_GAMEPAD_V1_GAMEPAD_STATE_ENUM |
| 155 | #define ZCR_GAMEPAD_V1_GAMEPAD_STATE_ENUM |
| 156 | /** |
| 157 | * @ingroup iface_zcr_gamepad_v1 |
| 158 | * connection state |
| 159 | */ |
| 160 | enum zcr_gamepad_v1_gamepad_state { |
| 161 | /** |
| 162 | * no gamepads are connected or on. |
| 163 | */ |
| 164 | ZCR_GAMEPAD_V1_GAMEPAD_STATE_OFF = 0, |
| 165 | /** |
| 166 | * at least one gamepad is connected. |
| 167 | */ |
| 168 | ZCR_GAMEPAD_V1_GAMEPAD_STATE_ON = 1, |
| 169 | }; |
| 170 | #endif /* ZCR_GAMEPAD_V1_GAMEPAD_STATE_ENUM */ |
| 171 | |
| 172 | #ifndef ZCR_GAMEPAD_V1_BUTTON_STATE_ENUM |
| 173 | #define ZCR_GAMEPAD_V1_BUTTON_STATE_ENUM |
| 174 | /** |
| 175 | * @ingroup iface_zcr_gamepad_v1 |
| 176 | * physical button state |
| 177 | * |
| 178 | * Describes the physical state of a button that produced the button |
| 179 | * event. |
| 180 | */ |
| 181 | enum zcr_gamepad_v1_button_state { |
| 182 | /** |
| 183 | * the button is not pressed |
| 184 | */ |
| 185 | ZCR_GAMEPAD_V1_BUTTON_STATE_RELEASED = 0, |
| 186 | /** |
| 187 | * the button is pressed |
| 188 | */ |
| 189 | ZCR_GAMEPAD_V1_BUTTON_STATE_PRESSED = 1, |
| 190 | }; |
| 191 | #endif /* ZCR_GAMEPAD_V1_BUTTON_STATE_ENUM */ |
| 192 | |
| 193 | /** |
| 194 | * @ingroup iface_zcr_gamepad_v1 |
| 195 | * @struct zcr_gamepad_v1_listener |
| 196 | */ |
| 197 | struct zcr_gamepad_v1_listener { |
| 198 | /** |
| 199 | * state change event |
| 200 | * |
| 201 | * Notification that this seat's connection state has changed. |
| 202 | * @param state new state |
| 203 | */ |
| 204 | void (*state_change)(void *data, |
| 205 | struct zcr_gamepad_v1 *zcr_gamepad_v1, |
| 206 | uint32_t state); |
| 207 | /** |
| 208 | * axis change event |
| 209 | * |
| 210 | * Notification of axis change. |
| 211 | * |
| 212 | * The axis id specifies which axis has changed as defined by the |
| 213 | * W3C 'Standard Gamepad'. |
| 214 | * |
| 215 | * The value is calibrated and normalized to the -1 to 1 range. |
| 216 | * @param time timestamp with millisecond granularity |
| 217 | * @param axis axis that produced this event |
| 218 | * @param value new value of axis |
| 219 | */ |
| 220 | void (*axis)(void *data, |
| 221 | struct zcr_gamepad_v1 *zcr_gamepad_v1, |
| 222 | uint32_t time, |
| 223 | uint32_t axis, |
| 224 | wl_fixed_t value); |
| 225 | /** |
| 226 | * Gamepad button changed |
| 227 | * |
| 228 | * Notification of button change. |
| 229 | * |
| 230 | * The button id specifies which button has changed as defined by |
| 231 | * the W3C 'Standard Gamepad'. |
| 232 | * |
| 233 | * A button can have a digital and an analog value. The analog |
| 234 | * value is normalized to a 0 to 1 range. If a button does not |
| 235 | * provide an analog value, it will be derived from the digital |
| 236 | * state. |
| 237 | * @param time timestamp with millisecond granularity |
| 238 | * @param button id of button |
| 239 | * @param state digital state of the button |
| 240 | * @param analog analog value of the button |
| 241 | */ |
| 242 | void (*button)(void *data, |
| 243 | struct zcr_gamepad_v1 *zcr_gamepad_v1, |
| 244 | uint32_t time, |
| 245 | uint32_t button, |
| 246 | uint32_t state, |
| 247 | wl_fixed_t analog); |
| 248 | /** |
| 249 | * Notifies end of a series of gamepad changes. |
| 250 | * |
| 251 | * Indicates the end of a set of events that logically belong |
| 252 | * together. A client is expected to accumulate the data in all |
| 253 | * events within the frame before proceeding. |
| 254 | * @param time timestamp with millisecond granularity |
| 255 | */ |
| 256 | void (*frame)(void *data, |
| 257 | struct zcr_gamepad_v1 *zcr_gamepad_v1, |
| 258 | uint32_t time); |
| 259 | }; |
| 260 | |
| 261 | /** |
| 262 | * @ingroup iface_zcr_gamepad_v1 |
| 263 | */ |
| 264 | static inline int |
| 265 | zcr_gamepad_v1_add_listener(struct zcr_gamepad_v1 *zcr_gamepad_v1, |
| 266 | const struct zcr_gamepad_v1_listener *listener, void *data) |
| 267 | { |
| 268 | return wl_proxy_add_listener((struct wl_proxy *) zcr_gamepad_v1, |
| 269 | (void (**)(void)) listener, data); |
| 270 | } |
| 271 | |
| 272 | #define ZCR_GAMEPAD_V1_DESTROY 0 |
| 273 | |
| 274 | /** |
| 275 | * @ingroup iface_zcr_gamepad_v1 |
| 276 | */ |
| 277 | #define ZCR_GAMEPAD_V1_STATE_CHANGE_SINCE_VERSION 1 |
| 278 | /** |
| 279 | * @ingroup iface_zcr_gamepad_v1 |
| 280 | */ |
| 281 | #define ZCR_GAMEPAD_V1_AXIS_SINCE_VERSION 1 |
| 282 | /** |
| 283 | * @ingroup iface_zcr_gamepad_v1 |
| 284 | */ |
| 285 | #define ZCR_GAMEPAD_V1_BUTTON_SINCE_VERSION 1 |
| 286 | /** |
| 287 | * @ingroup iface_zcr_gamepad_v1 |
| 288 | */ |
| 289 | #define ZCR_GAMEPAD_V1_FRAME_SINCE_VERSION 1 |
| 290 | |
| 291 | /** |
| 292 | * @ingroup iface_zcr_gamepad_v1 |
| 293 | */ |
| 294 | #define ZCR_GAMEPAD_V1_DESTROY_SINCE_VERSION 1 |
| 295 | |
| 296 | /** @ingroup iface_zcr_gamepad_v1 */ |
| 297 | static inline void |
| 298 | zcr_gamepad_v1_set_user_data(struct zcr_gamepad_v1 *zcr_gamepad_v1, void *user_data) |
| 299 | { |
| 300 | wl_proxy_set_user_data((struct wl_proxy *) zcr_gamepad_v1, user_data); |
| 301 | } |
| 302 | |
| 303 | /** @ingroup iface_zcr_gamepad_v1 */ |
| 304 | static inline void * |
| 305 | zcr_gamepad_v1_get_user_data(struct zcr_gamepad_v1 *zcr_gamepad_v1) |
| 306 | { |
| 307 | return wl_proxy_get_user_data((struct wl_proxy *) zcr_gamepad_v1); |
| 308 | } |
| 309 | |
| 310 | static inline uint32_t |
| 311 | zcr_gamepad_v1_get_version(struct zcr_gamepad_v1 *zcr_gamepad_v1) |
| 312 | { |
| 313 | return wl_proxy_get_version((struct wl_proxy *) zcr_gamepad_v1); |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * @ingroup iface_zcr_gamepad_v1 |
| 318 | */ |
| 319 | static inline void |
| 320 | zcr_gamepad_v1_destroy(struct zcr_gamepad_v1 *zcr_gamepad_v1) |
| 321 | { |
| 322 | wl_proxy_marshal((struct wl_proxy *) zcr_gamepad_v1, |
| 323 | ZCR_GAMEPAD_V1_DESTROY); |
| 324 | |
| 325 | wl_proxy_destroy((struct wl_proxy *) zcr_gamepad_v1); |
| 326 | } |
| 327 | |
| 328 | #ifdef __cplusplus |
| 329 | } |
| 330 | #endif |
| 331 | |
| 332 | #endif |