OLD | NEW |
1 /* | 1 /* Generated by wayland-scanner 1.11.0 */ |
| 2 |
| 3 #ifndef GAMING_INPUT_UNSTABLE_V1_SERVER_PROTOCOL_H |
| 4 #define GAMING_INPUT_UNSTABLE_V1_SERVER_PROTOCOL_H |
| 5 |
| 6 #include <stdint.h> |
| 7 #include <stddef.h> |
| 8 #include "wayland-server.h" |
| 9 |
| 10 #ifdef __cplusplus |
| 11 extern "C" { |
| 12 #endif |
| 13 |
| 14 struct wl_client; |
| 15 struct wl_resource; |
| 16 |
| 17 /** |
| 18 * @page page_gaming_input_unstable_v1 The gaming_input_unstable_v1 protocol |
| 19 * @section page_ifaces_gaming_input_unstable_v1 Interfaces |
| 20 * - @subpage page_iface_zwp_gaming_input_v1 - extends wl_seat with gaming input
devices |
| 21 * - @subpage page_iface_zwp_gamepad_v1 - gamepad input device |
| 22 * @section page_copyright_gaming_input_unstable_v1 Copyright |
| 23 * <pre> |
| 24 * |
2 * Copyright 2016 The Chromium Authors. | 25 * Copyright 2016 The Chromium Authors. |
3 * | 26 * |
4 * Permission is hereby granted, free of charge, to any person obtaining a | 27 * Permission is hereby granted, free of charge, to any person obtaining a |
5 * copy of this software and associated documentation files (the "Software"), | 28 * copy of this software and associated documentation files (the "Software"), |
6 * to deal in the Software without restriction, including without limitation | 29 * to deal in the Software without restriction, including without limitation |
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 30 * 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 | 31 * 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: | 32 * Software is furnished to do so, subject to the following conditions: |
10 * | 33 * |
11 * The above copyright notice and this permission notice (including the next | 34 * The above copyright notice and this permission notice (including the next |
12 * paragraph) shall be included in all copies or substantial portions of the | 35 * paragraph) shall be included in all copies or substantial portions of the |
13 * Software. | 36 * Software. |
14 * | 37 * |
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 39 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 40 * 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 | 41 * 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 | 42 * 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 | 43 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 * DEALINGS IN THE SOFTWARE. | 44 * DEALINGS IN THE SOFTWARE. |
| 45 * </pre> |
22 */ | 46 */ |
23 | 47 struct wl_seat; |
24 #ifndef GAMING_INPUT_UNSTABLE_V1_SERVER_PROTOCOL_H | 48 struct zwp_gamepad_v1; |
25 #define GAMING_INPUT_UNSTABLE_V1_SERVER_PROTOCOL_H | |
26 | |
27 #ifdef __cplusplus | |
28 extern "C" { | |
29 #endif | |
30 | |
31 #include <stdint.h> | |
32 #include <stddef.h> | |
33 #include "wayland-util.h" | |
34 | |
35 struct wl_client; | |
36 struct wl_resource; | |
37 | |
38 struct zwp_gaming_input_v1; | 49 struct zwp_gaming_input_v1; |
39 struct zwp_gamepad_v1; | |
40 | |
41 extern const struct wl_interface zwp_gaming_input_v1_interface; | |
42 extern const struct wl_interface zwp_gamepad_v1_interface; | |
43 | 50 |
44 /** | 51 /** |
45 * zwp_gaming_input_v1 - extends wl_seat with gaming input devices | 52 * @page page_iface_zwp_gaming_input_v1 zwp_gaming_input_v1 |
46 * @get_gamepad: get gamepad device assigned to seat | 53 * @section page_iface_zwp_gaming_input_v1_desc Description |
47 * | 54 * |
48 * A global interface to provide gaming input devices for a given seat. | 55 * A global interface to provide gaming input devices for a given seat. |
49 * | 56 * |
| 57 * Currently only gamepad devices are supported. |
| 58 * |
| 59 * Warning! The protocol described in this file is experimental and |
| 60 * backward incompatible changes may be made. Backward compatible changes |
| 61 * may be added together with the corresponding uinterface version bump. |
| 62 * Backward incompatible changes are done by bumping the version number in |
| 63 * the protocol and uinterface names and resetting the interface version. |
| 64 * Once the protocol is to be declared stable, the 'z' prefix and the |
| 65 * version number in the protocol and interface names are removed and the |
| 66 * interface version number is reset. |
| 67 * @section page_iface_zwp_gaming_input_v1_api API |
| 68 * See @ref iface_zwp_gaming_input_v1. |
| 69 */ |
| 70 /** |
| 71 * @defgroup iface_zwp_gaming_input_v1 The zwp_gaming_input_v1 interface |
| 72 * |
| 73 * A global interface to provide gaming input devices for a given seat. |
| 74 * |
50 * Currently only gamepad devices are supported. | 75 * Currently only gamepad devices are supported. |
51 * | 76 * |
52 * Warning! The protocol described in this file is experimental and | 77 * Warning! The protocol described in this file is experimental and |
53 * backward incompatible changes may be made. Backward compatible changes | 78 * backward incompatible changes may be made. Backward compatible changes |
54 * may be added together with the corresponding uinterface version bump. | 79 * may be added together with the corresponding uinterface version bump. |
55 * Backward incompatible changes are done by bumping the version number in | 80 * Backward incompatible changes are done by bumping the version number in |
56 * the protocol and uinterface names and resetting the interface version. | 81 * the protocol and uinterface names and resetting the interface version. |
57 * Once the protocol is to be declared stable, the 'z' prefix and the | 82 * Once the protocol is to be declared stable, the 'z' prefix and the |
58 * version number in the protocol and interface names are removed and the | 83 * version number in the protocol and interface names are removed and the |
59 * interface version number is reset. | 84 * interface version number is reset. |
60 */ | 85 */ |
| 86 extern const struct wl_interface zwp_gaming_input_v1_interface; |
| 87 /** |
| 88 * @page page_iface_zwp_gamepad_v1 zwp_gamepad_v1 |
| 89 * @section page_iface_zwp_gamepad_v1_desc Description |
| 90 * |
| 91 * The zwp_gamepad_v1 interface represents one or more gamepad input devices, |
| 92 * which are reported as a normalized 'Standard Gamepad' as it is specified |
| 93 * by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping |
| 94 * @section page_iface_zwp_gamepad_v1_api API |
| 95 * See @ref iface_zwp_gamepad_v1. |
| 96 */ |
| 97 /** |
| 98 * @defgroup iface_zwp_gamepad_v1 The zwp_gamepad_v1 interface |
| 99 * |
| 100 * The zwp_gamepad_v1 interface represents one or more gamepad input devices, |
| 101 * which are reported as a normalized 'Standard Gamepad' as it is specified |
| 102 * by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping |
| 103 */ |
| 104 extern const struct wl_interface zwp_gamepad_v1_interface; |
| 105 |
| 106 /** |
| 107 * @ingroup iface_zwp_gaming_input_v1 |
| 108 * @struct zwp_gaming_input_v1_interface |
| 109 */ |
61 struct zwp_gaming_input_v1_interface { | 110 struct zwp_gaming_input_v1_interface { |
62 /** | 111 /** |
63 » * get_gamepad - get gamepad device assigned to seat | 112 » * get gamepad device assigned to seat |
64 » * @id: (none) | |
65 » * @seat: (none) | |
66 * | 113 * |
67 * Create gamepad object. See zwp_gamepad_v1 interface for | 114 * Create gamepad object. See zwp_gamepad_v1 interface for |
68 * details. | 115 * details. |
69 */ | 116 */ |
70 void (*get_gamepad)(struct wl_client *client, | 117 void (*get_gamepad)(struct wl_client *client, |
71 struct wl_resource *resource, | 118 struct wl_resource *resource, |
72 uint32_t id, | 119 uint32_t id, |
73 struct wl_resource *seat); | 120 struct wl_resource *seat); |
74 }; | 121 }; |
75 | 122 |
| 123 |
76 #ifndef ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM | 124 #ifndef ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM |
77 #define ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM | 125 #define ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM |
78 /** | 126 /** |
79 * zwp_gamepad_v1_gamepad_state - connection state | 127 * @ingroup iface_zwp_gamepad_v1 |
80 * @ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF: no gamepads are connected or on. | 128 * connection state |
81 * @ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON: at least one gamepad is connected. | |
82 * | |
83 * | |
84 */ | 129 */ |
85 enum zwp_gamepad_v1_gamepad_state { | 130 enum zwp_gamepad_v1_gamepad_state { |
| 131 /** |
| 132 * no gamepads are connected or on. |
| 133 */ |
86 ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF = 0, | 134 ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF = 0, |
| 135 /** |
| 136 * at least one gamepad is connected. |
| 137 */ |
87 ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON = 1, | 138 ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON = 1, |
88 }; | 139 }; |
89 #endif /* ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM */ | 140 #endif /* ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM */ |
90 | 141 |
91 #ifndef ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM | 142 #ifndef ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM |
92 #define ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM | 143 #define ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM |
93 /** | 144 /** |
94 * zwp_gamepad_v1_button_state - physical button state | 145 * @ingroup iface_zwp_gamepad_v1 |
95 * @ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED: the button is not pressed | 146 * physical button state |
96 * @ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED: the button is pressed | |
97 * | 147 * |
98 * Describes the physical state of a button that produced the button | 148 * Describes the physical state of a button that produced the button |
99 * event. | 149 * event. |
100 */ | 150 */ |
101 enum zwp_gamepad_v1_button_state { | 151 enum zwp_gamepad_v1_button_state { |
| 152 /** |
| 153 * the button is not pressed |
| 154 */ |
102 ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED = 0, | 155 ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED = 0, |
| 156 /** |
| 157 * the button is pressed |
| 158 */ |
103 ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED = 1, | 159 ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED = 1, |
104 }; | 160 }; |
105 #endif /* ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM */ | 161 #endif /* ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM */ |
106 | 162 |
107 /** | 163 /** |
108 * zwp_gamepad_v1 - gamepad input device | 164 * @ingroup iface_zwp_gamepad_v1 |
109 * @destroy: destroy gamepad object | 165 * @struct zwp_gamepad_v1_interface |
110 * | |
111 * The zwp_gamepad_v1 interface represents one or more gamepad input | |
112 * devices, which are reported as a normalized 'Standard Gamepad' as it is | |
113 * specified by the W3C Gamepad API at: | |
114 * https://w3c.github.io/gamepad/#remapping | |
115 */ | 166 */ |
116 struct zwp_gamepad_v1_interface { | 167 struct zwp_gamepad_v1_interface { |
117 /** | 168 /** |
118 » * destroy - destroy gamepad object | 169 » * destroy gamepad object |
119 * | 170 * |
120 * | 171 * |
121 */ | 172 */ |
122 void (*destroy)(struct wl_client *client, | 173 void (*destroy)(struct wl_client *client, |
123 struct wl_resource *resource); | 174 struct wl_resource *resource); |
124 }; | 175 }; |
125 | 176 |
126 #define ZWP_GAMEPAD_V1_STATE_CHANGE 0 | 177 #define ZWP_GAMEPAD_V1_STATE_CHANGE 0 |
127 #define ZWP_GAMEPAD_V1_AXIS 1 | 178 #define ZWP_GAMEPAD_V1_AXIS 1 |
128 #define ZWP_GAMEPAD_V1_BUTTON 2 | 179 #define ZWP_GAMEPAD_V1_BUTTON 2 |
129 #define ZWP_GAMEPAD_V1_FRAME 3 | 180 #define ZWP_GAMEPAD_V1_FRAME 3 |
130 | 181 |
| 182 /** |
| 183 * @ingroup iface_zwp_gamepad_v1 |
| 184 */ |
| 185 #define ZWP_GAMEPAD_V1_STATE_CHANGE_SINCE_VERSION 1 |
| 186 /** |
| 187 * @ingroup iface_zwp_gamepad_v1 |
| 188 */ |
| 189 #define ZWP_GAMEPAD_V1_AXIS_SINCE_VERSION 1 |
| 190 /** |
| 191 * @ingroup iface_zwp_gamepad_v1 |
| 192 */ |
| 193 #define ZWP_GAMEPAD_V1_BUTTON_SINCE_VERSION 1 |
| 194 /** |
| 195 * @ingroup iface_zwp_gamepad_v1 |
| 196 */ |
| 197 #define ZWP_GAMEPAD_V1_FRAME_SINCE_VERSION 1 |
| 198 |
| 199 /** |
| 200 * @ingroup iface_zwp_gamepad_v1 |
| 201 * Sends an state_change event to the client owning the resource. |
| 202 * @param resource_ The client's resource |
| 203 * @param state new state |
| 204 */ |
131 static inline void | 205 static inline void |
132 zwp_gamepad_v1_send_state_change(struct wl_resource *resource_, uint32_t state) | 206 zwp_gamepad_v1_send_state_change(struct wl_resource *resource_, uint32_t state) |
133 { | 207 { |
134 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_STATE_CHANGE, state); | 208 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_STATE_CHANGE, state); |
135 } | 209 } |
136 | 210 |
| 211 /** |
| 212 * @ingroup iface_zwp_gamepad_v1 |
| 213 * Sends an axis event to the client owning the resource. |
| 214 * @param resource_ The client's resource |
| 215 * @param time timestamp with millisecond granularity |
| 216 * @param axis axis that produced this event |
| 217 * @param value new value of axis |
| 218 */ |
137 static inline void | 219 static inline void |
138 zwp_gamepad_v1_send_axis(struct wl_resource *resource_, uint32_t time, uint32_t
axis, wl_fixed_t value) | 220 zwp_gamepad_v1_send_axis(struct wl_resource *resource_, uint32_t time, uint32_t
axis, wl_fixed_t value) |
139 { | 221 { |
140 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_AXIS, time, axis, value
); | 222 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_AXIS, time, axis, value
); |
141 } | 223 } |
142 | 224 |
| 225 /** |
| 226 * @ingroup iface_zwp_gamepad_v1 |
| 227 * Sends an button event to the client owning the resource. |
| 228 * @param resource_ The client's resource |
| 229 * @param time timestamp with millisecond granularity |
| 230 * @param button id of button |
| 231 * @param state digital state of the button |
| 232 * @param analog analog value of the button |
| 233 */ |
143 static inline void | 234 static inline void |
144 zwp_gamepad_v1_send_button(struct wl_resource *resource_, uint32_t time, uint32_
t button, uint32_t state, wl_fixed_t analog) | 235 zwp_gamepad_v1_send_button(struct wl_resource *resource_, uint32_t time, uint32_
t button, uint32_t state, wl_fixed_t analog) |
145 { | 236 { |
146 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_BUTTON, time, button, s
tate, analog); | 237 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_BUTTON, time, button, s
tate, analog); |
147 } | 238 } |
148 | 239 |
| 240 /** |
| 241 * @ingroup iface_zwp_gamepad_v1 |
| 242 * Sends an frame event to the client owning the resource. |
| 243 * @param resource_ The client's resource |
| 244 * @param time timestamp with millisecond granularity |
| 245 */ |
149 static inline void | 246 static inline void |
150 zwp_gamepad_v1_send_frame(struct wl_resource *resource_, uint32_t time) | 247 zwp_gamepad_v1_send_frame(struct wl_resource *resource_, uint32_t time) |
151 { | 248 { |
152 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_FRAME, time); | 249 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_FRAME, time); |
153 } | 250 } |
154 | 251 |
155 #ifdef __cplusplus | 252 #ifdef __cplusplus |
156 } | 253 } |
157 #endif | 254 #endif |
158 | 255 |
159 #endif | 256 #endif |
OLD | NEW |