Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: third_party/wayland-protocols/include/protocol/gaming-input-unstable-v1-client-protocol.h

Issue 2093803002: wayland-protocols: Add gaming-input-unstable-v1 protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migration
Patch Set: fixed nit, regenerated Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 The Chromium Authors.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * 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
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * 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
19 * 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
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifndef GAMING_INPUT_UNSTABLE_V1_CLIENT_PROTOCOL_H
25 #define GAMING_INPUT_UNSTABLE_V1_CLIENT_PROTOCOL_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <stdint.h>
32 #include <stddef.h>
33 #include "wayland-client.h"
34
35 struct wl_client;
36 struct wl_resource;
37
38 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
44 #define ZWP_GAMING_INPUT_V1_GET_GAMEPAD 0
45
46 static inline void
47 zwp_gaming_input_v1_set_user_data(struct zwp_gaming_input_v1 *zwp_gaming_input_v 1, void *user_data)
48 {
49 wl_proxy_set_user_data((struct wl_proxy *) zwp_gaming_input_v1, user_dat a);
50 }
51
52 static inline void *
53 zwp_gaming_input_v1_get_user_data(struct zwp_gaming_input_v1 *zwp_gaming_input_v 1)
54 {
55 return wl_proxy_get_user_data((struct wl_proxy *) zwp_gaming_input_v1);
56 }
57
58 static inline void
59 zwp_gaming_input_v1_destroy(struct zwp_gaming_input_v1 *zwp_gaming_input_v1)
60 {
61 wl_proxy_destroy((struct wl_proxy *) zwp_gaming_input_v1);
62 }
63
64 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)
66 {
67 struct wl_proxy *id;
68
69 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);
71
72 return (struct zwp_gamepad_v1 *) id;
73 }
74
75 #ifndef ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM
76 #define ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM
77 /**
78 * zwp_gamepad_v1_gamepad_state - connection state
79 * @ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF: no gamepads are connected or on.
80 * @ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON: at least one gamepad is connected.
81 *
82 *
83 */
84 enum zwp_gamepad_v1_gamepad_state {
85 ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF = 0,
86 ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON = 1,
87 };
88 #endif /* ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM */
89
90 #ifndef ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM
91 #define ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM
92 /**
93 * zwp_gamepad_v1_button_state - physical button state
94 * @ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED: the button is not pressed
95 * @ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED: the button is pressed
96 *
97 * Describes the physical state of a button that produced the button
98 * event.
99 */
100 enum zwp_gamepad_v1_button_state {
101 ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED = 0,
102 ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED = 1,
103 };
104 #endif /* ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM */
105
106 /**
107 * zwp_gamepad_v1 - gamepad input device
108 * @state_change: state change event
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 */
118 struct zwp_gamepad_v1_listener {
119 /**
120 * state_change - state change event
121 * @state: new state
122 *
123 * Notification that this seat's connection state has changed.
124 */
125 void (*state_change)(void *data,
126 struct zwp_gamepad_v1 *zwp_gamepad_v1,
127 uint32_t state);
128 /**
129 * axis - axis change event
130 * @time: timestamp with millisecond granularity
131 * @axis: axis that produced this event
132 * @value: new value of axis
133 *
134 * Notification of axis change.
135 *
136 * The axis id specifies which axis has changed as defined by the
137 * W3C 'Standard Gamepad'.
138 *
139 * The value is calibrated and normalized to the -1 to 1 range.
140 */
141 void (*axis)(void *data,
142 struct zwp_gamepad_v1 *zwp_gamepad_v1,
143 uint32_t time,
144 uint32_t axis,
145 wl_fixed_t value);
146 /**
147 * button - 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 *
153 * Notification of button change.
154 *
155 * The button id specifies which button has changed as defined by
156 * the W3C 'Standard Gamepad'.
157 *
158 * 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
160 * provide an analog value, it will be derived from the digital
161 * state.
162 */
163 void (*button)(void *data,
164 struct zwp_gamepad_v1 *zwp_gamepad_v1,
165 uint32_t time,
166 uint32_t button,
167 uint32_t state,
168 wl_fixed_t analog);
169 /**
170 * frame - Notifies end of a series of gamepad changes.
171 * @time: timestamp with millisecond granularity
172 *
173 * Indicates the end of a set of events that logically belong
174 * together. A client is expected to accumulate the data in all
175 * events within the frame before proceeding.
176 */
177 void (*frame)(void *data,
178 struct zwp_gamepad_v1 *zwp_gamepad_v1,
179 uint32_t time);
180 };
181
182 static inline int
183 zwp_gamepad_v1_add_listener(struct zwp_gamepad_v1 *zwp_gamepad_v1,
184 const struct zwp_gamepad_v1_listener *listener, void *data)
185 {
186 return wl_proxy_add_listener((struct wl_proxy *) zwp_gamepad_v1,
187 (void (**)(void)) listener, data);
188 }
189
190 #define ZWP_GAMEPAD_V1_DESTROY 0
191
192 static inline void
193 zwp_gamepad_v1_set_user_data(struct zwp_gamepad_v1 *zwp_gamepad_v1, void *user_d ata)
194 {
195 wl_proxy_set_user_data((struct wl_proxy *) zwp_gamepad_v1, user_data);
196 }
197
198 static inline void *
199 zwp_gamepad_v1_get_user_data(struct zwp_gamepad_v1 *zwp_gamepad_v1)
200 {
201 return wl_proxy_get_user_data((struct wl_proxy *) zwp_gamepad_v1);
202 }
203
204 static inline void
205 zwp_gamepad_v1_destroy(struct zwp_gamepad_v1 *zwp_gamepad_v1)
206 {
207 wl_proxy_marshal((struct wl_proxy *) zwp_gamepad_v1,
208 ZWP_GAMEPAD_V1_DESTROY);
209
210 wl_proxy_destroy((struct wl_proxy *) zwp_gamepad_v1);
211 }
212
213 #ifdef __cplusplus
214 }
215 #endif
216
217 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698