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