1 /* Generated by wayland-scanner 1.22.0 */
2
3 #ifndef UI_CONTROLS_UNSTABLE_V1_CLIENT_PROTOCOL_H
4 #define UI_CONTROLS_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_ui_controls_unstable_v1 The ui_controls_unstable_v1 protocol
16 * @section page_ifaces_ui_controls_unstable_v1 Interfaces
17 * - @subpage page_iface_zcr_ui_controls_v1 - requests for input emulation
18 * @section page_copyright_ui_controls_unstable_v1 Copyright
19 * <pre>
20 *
21 * Copyright 2022 The Chromium Authors.
22 *
23 * Permission is hereby granted, free of charge, to any person obtaining a
24 * copy of this software and associated documentation files (the "Software"),
25 * to deal in the Software without restriction, including without limitation
26 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
27 * and/or sell copies of the Software, and to permit persons to whom the
28 * Software is furnished to do so, subject to the following conditions:
29 *
30 * The above copyright notice and this permission notice (including the next
31 * paragraph) shall be included in all copies or substantial portions of the
32 * Software.
33 *
34 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
37 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
40 * DEALINGS IN THE SOFTWARE.
41 * </pre>
42 */
43 struct xdg_surface;
44 struct zcr_ui_controls_v1;
45
46 #ifndef ZCR_UI_CONTROLS_V1_INTERFACE
47 #define ZCR_UI_CONTROLS_V1_INTERFACE
48 /**
49 * @page page_iface_zcr_ui_controls_v1 zcr_ui_controls_v1
50 * @section page_iface_zcr_ui_controls_v1_desc Description
51 *
52 * This global provides requests for different type of input emulation that
53 * mirror the semantics of Chrome's ui_controls functions.
54 * @section page_iface_zcr_ui_controls_v1_api API
55 * See @ref iface_zcr_ui_controls_v1.
56 */
57 /**
58 * @defgroup iface_zcr_ui_controls_v1 The zcr_ui_controls_v1 interface
59 *
60 * This global provides requests for different type of input emulation that
61 * mirror the semantics of Chrome's ui_controls functions.
62 */
63 extern const struct wl_interface zcr_ui_controls_v1_interface;
64 #endif
65
66 #ifndef ZCR_UI_CONTROLS_V1_KEY_STATE_ENUM
67 #define ZCR_UI_CONTROLS_V1_KEY_STATE_ENUM
68 /**
69 * @ingroup iface_zcr_ui_controls_v1
70 * whether to press, release, or press and release a key
71 *
72 * These flags signal which key events to emulate: press; release; or
73 * press, then release.
74 */
75 enum zcr_ui_controls_v1_key_state {
76 ZCR_UI_CONTROLS_V1_KEY_STATE_PRESS = 1,
77 ZCR_UI_CONTROLS_V1_KEY_STATE_RELEASE = 2,
78 };
79 #endif /* ZCR_UI_CONTROLS_V1_KEY_STATE_ENUM */
80
81 #ifndef ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_ENUM
82 #define ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_ENUM
83 /**
84 * @ingroup iface_zcr_ui_controls_v1
85 * which mouse button to emulate
86 *
87 * Which mouse button to emulate an event for.
88 */
89 enum zcr_ui_controls_v1_mouse_button {
90 ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_LEFT = 0,
91 ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_MIDDLE = 1,
92 ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_RIGHT = 2,
93 };
94 #endif /* ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_ENUM */
95
96 #ifndef ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_STATE_ENUM
97 #define ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_STATE_ENUM
98 /**
99 * @ingroup iface_zcr_ui_controls_v1
100 * whether to press, release, or click a mouse button
101 *
102 * These flags signal which mouse button events to emulate: press; release;
103 * or press, then release.
104 */
105 enum zcr_ui_controls_v1_mouse_button_state {
106 ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_STATE_UP = 1,
107 ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_STATE_DOWN = 2,
108 };
109 #endif /* ZCR_UI_CONTROLS_V1_MOUSE_BUTTON_STATE_ENUM */
110
111 #ifndef ZCR_UI_CONTROLS_V1_MODIFIER_ENUM
112 #define ZCR_UI_CONTROLS_V1_MODIFIER_ENUM
113 /**
114 * @ingroup iface_zcr_ui_controls_v1
115 * pressed modifiers
116 *
117 * These flags signal which modifiers should be pressed during an emulated
118 * input, if any.
119 */
120 enum zcr_ui_controls_v1_modifier {
121 ZCR_UI_CONTROLS_V1_MODIFIER_NONE = 0,
122 ZCR_UI_CONTROLS_V1_MODIFIER_SHIFT = 1,
123 ZCR_UI_CONTROLS_V1_MODIFIER_CONTROL = 2,
124 ZCR_UI_CONTROLS_V1_MODIFIER_ALT = 4,
125 };
126 #endif /* ZCR_UI_CONTROLS_V1_MODIFIER_ENUM */
127
128 #ifndef ZCR_UI_CONTROLS_V1_TOUCH_TYPE_ENUM
129 #define ZCR_UI_CONTROLS_V1_TOUCH_TYPE_ENUM
130 /**
131 * @ingroup iface_zcr_ui_controls_v1
132 * type of touch to be generated
133 *
134 * These flags signal whether to emulate a touch press, release, or move.
135 */
136 enum zcr_ui_controls_v1_touch_type {
137 ZCR_UI_CONTROLS_V1_TOUCH_TYPE_PRESS = 1,
138 ZCR_UI_CONTROLS_V1_TOUCH_TYPE_RELEASE = 2,
139 ZCR_UI_CONTROLS_V1_TOUCH_TYPE_MOVE = 4,
140 };
141 #endif /* ZCR_UI_CONTROLS_V1_TOUCH_TYPE_ENUM */
142
143 /**
144 * @ingroup iface_zcr_ui_controls_v1
145 * @struct zcr_ui_controls_v1_listener
146 */
147 struct zcr_ui_controls_v1_listener {
148 /**
149 * request has been processed
150 *
151 * The request with ID `id` has been fully processed.
152 * @param id ID of the processed request
153 */
154 void (*request_processed)(void *data,
155 struct zcr_ui_controls_v1 *zcr_ui_controls_v1,
156 uint32_t id);
157 };
158
159 /**
160 * @ingroup iface_zcr_ui_controls_v1
161 */
162 static inline int
zcr_ui_controls_v1_add_listener(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,const struct zcr_ui_controls_v1_listener * listener,void * data)163 zcr_ui_controls_v1_add_listener(struct zcr_ui_controls_v1 *zcr_ui_controls_v1,
164 const struct zcr_ui_controls_v1_listener *listener, void *data)
165 {
166 return wl_proxy_add_listener((struct wl_proxy *) zcr_ui_controls_v1,
167 (void (**)(void)) listener, data);
168 }
169
170 #define ZCR_UI_CONTROLS_V1_SEND_KEY_EVENTS 0
171 #define ZCR_UI_CONTROLS_V1_SEND_MOUSE_MOVE 1
172 #define ZCR_UI_CONTROLS_V1_SEND_MOUSE_BUTTON 2
173 #define ZCR_UI_CONTROLS_V1_SEND_TOUCH 3
174 #define ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_ID 4
175 #define ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_SIZE 5
176 #define ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_DEVICE_SCALE_FACTOR 6
177 #define ZCR_UI_CONTROLS_V1_DISPLAY_INFO_DONE 7
178 #define ZCR_UI_CONTROLS_V1_DISPLAY_INFO_LIST_DONE 8
179
180 /**
181 * @ingroup iface_zcr_ui_controls_v1
182 */
183 #define ZCR_UI_CONTROLS_V1_REQUEST_PROCESSED_SINCE_VERSION 1
184
185 /**
186 * @ingroup iface_zcr_ui_controls_v1
187 */
188 #define ZCR_UI_CONTROLS_V1_SEND_KEY_EVENTS_SINCE_VERSION 1
189 /**
190 * @ingroup iface_zcr_ui_controls_v1
191 */
192 #define ZCR_UI_CONTROLS_V1_SEND_MOUSE_MOVE_SINCE_VERSION 1
193 /**
194 * @ingroup iface_zcr_ui_controls_v1
195 */
196 #define ZCR_UI_CONTROLS_V1_SEND_MOUSE_BUTTON_SINCE_VERSION 1
197 /**
198 * @ingroup iface_zcr_ui_controls_v1
199 */
200 #define ZCR_UI_CONTROLS_V1_SEND_TOUCH_SINCE_VERSION 1
201 /**
202 * @ingroup iface_zcr_ui_controls_v1
203 */
204 #define ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_ID_SINCE_VERSION 3
205 /**
206 * @ingroup iface_zcr_ui_controls_v1
207 */
208 #define ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_SIZE_SINCE_VERSION 3
209 /**
210 * @ingroup iface_zcr_ui_controls_v1
211 */
212 #define ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_DEVICE_SCALE_FACTOR_SINCE_VERSION 3
213 /**
214 * @ingroup iface_zcr_ui_controls_v1
215 */
216 #define ZCR_UI_CONTROLS_V1_DISPLAY_INFO_DONE_SINCE_VERSION 3
217 /**
218 * @ingroup iface_zcr_ui_controls_v1
219 */
220 #define ZCR_UI_CONTROLS_V1_DISPLAY_INFO_LIST_DONE_SINCE_VERSION 3
221
222 /** @ingroup iface_zcr_ui_controls_v1 */
223 static inline void
zcr_ui_controls_v1_set_user_data(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,void * user_data)224 zcr_ui_controls_v1_set_user_data(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, void *user_data)
225 {
226 wl_proxy_set_user_data((struct wl_proxy *) zcr_ui_controls_v1, user_data);
227 }
228
229 /** @ingroup iface_zcr_ui_controls_v1 */
230 static inline void *
zcr_ui_controls_v1_get_user_data(struct zcr_ui_controls_v1 * zcr_ui_controls_v1)231 zcr_ui_controls_v1_get_user_data(struct zcr_ui_controls_v1 *zcr_ui_controls_v1)
232 {
233 return wl_proxy_get_user_data((struct wl_proxy *) zcr_ui_controls_v1);
234 }
235
236 static inline uint32_t
zcr_ui_controls_v1_get_version(struct zcr_ui_controls_v1 * zcr_ui_controls_v1)237 zcr_ui_controls_v1_get_version(struct zcr_ui_controls_v1 *zcr_ui_controls_v1)
238 {
239 return wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1);
240 }
241
242 /** @ingroup iface_zcr_ui_controls_v1 */
243 static inline void
zcr_ui_controls_v1_destroy(struct zcr_ui_controls_v1 * zcr_ui_controls_v1)244 zcr_ui_controls_v1_destroy(struct zcr_ui_controls_v1 *zcr_ui_controls_v1)
245 {
246 wl_proxy_destroy((struct wl_proxy *) zcr_ui_controls_v1);
247 }
248
249 /**
250 * @ingroup iface_zcr_ui_controls_v1
251 *
252 * Requests the compositor to emulate a key press, release, or press and
253 * release for the key corresponding to the given keycode, together with
254 * the specified modifiers. The compositor will decide which specific
255 * events to generate in response to this request. After the compositor has
256 * finished processing this request, a request_processed event with a
257 * matching `id` will be emitted.
258 */
259 static inline void
zcr_ui_controls_v1_send_key_events(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,uint32_t key,uint32_t key_state,uint32_t pressed_modifiers,uint32_t id)260 zcr_ui_controls_v1_send_key_events(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, uint32_t key, uint32_t key_state, uint32_t pressed_modifiers, uint32_t id)
261 {
262 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
263 ZCR_UI_CONTROLS_V1_SEND_KEY_EVENTS, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, key, key_state, pressed_modifiers, id);
264 }
265
266 /**
267 * @ingroup iface_zcr_ui_controls_v1
268 *
269 * Requests the compositor to emulate a mouse move to the given location.
270 * The compositor will decide which specific events to generate in response
271 * to this request. After the compositor has finished processing this
272 * request, a request_processed event with a matching `id` will be emitted.
273 *
274 * If `surface` is null, `x` and `y` are global screen coordinates; else,
275 * they are surface-local coordinates relative to `surface`.
276 */
277 static inline void
zcr_ui_controls_v1_send_mouse_move(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,int32_t x,int32_t y,struct xdg_surface * surface,uint32_t id)278 zcr_ui_controls_v1_send_mouse_move(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, int32_t x, int32_t y, struct xdg_surface *surface, uint32_t id)
279 {
280 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
281 ZCR_UI_CONTROLS_V1_SEND_MOUSE_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, x, y, surface, id);
282 }
283
284 /**
285 * @ingroup iface_zcr_ui_controls_v1
286 *
287 * Requests the compositor to emulate an up (if `state` is up) / down (if
288 * `state` is down) / click (i.e. down and up, if `state` is down|up) for
289 * the specified mouse button at the current mouse position, together with
290 * the specified modifiers. The compositor will decide which specific
291 * events to generate in response to this request. After the compositor has
292 * finished processing this request, a request_processed event with a
293 * matching `id` will be emitted.
294 */
295 static inline void
zcr_ui_controls_v1_send_mouse_button(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,uint32_t button,uint32_t button_state,uint32_t pressed_modifiers,uint32_t id)296 zcr_ui_controls_v1_send_mouse_button(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, uint32_t button, uint32_t button_state, uint32_t pressed_modifiers, uint32_t id)
297 {
298 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
299 ZCR_UI_CONTROLS_V1_SEND_MOUSE_BUTTON, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, button, button_state, pressed_modifiers, id);
300 }
301
302 /**
303 * @ingroup iface_zcr_ui_controls_v1
304 *
305 * Requests the compositor to emulate a touch down (if `action` is press) /
306 * touch up (if `action` is release) / move (if `action` is move) /
307 * combination of these (if `action` is a combination of these flags) for
308 * the touch point with the specified `id` (see wl_touch.down) at the
309 * specified location. The compositor will decide which specific events to
310 * generate in response to this request. After the compositor has finished
311 * processing this request, a request_processed event with a matching `id`
312 * will be emitted.
313 *
314 * If `surface` is null, `x` and `y` are global screen coordinates; else,
315 * they are surface-local coordinates relative to `surface`.
316 */
317 static inline void
zcr_ui_controls_v1_send_touch(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,uint32_t action,uint32_t touch_id,int32_t x,int32_t y,struct xdg_surface * surface,uint32_t id)318 zcr_ui_controls_v1_send_touch(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, uint32_t action, uint32_t touch_id, int32_t x, int32_t y, struct xdg_surface *surface, uint32_t id)
319 {
320 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
321 ZCR_UI_CONTROLS_V1_SEND_TOUCH, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, action, touch_id, x, y, surface, id);
322 }
323
324 /**
325 * @ingroup iface_zcr_ui_controls_v1
326 *
327 * Set the display id to be added. This is double buffered
328 * and the display will be created upon `display_info_done`
329 * request.
330 */
331 static inline void
zcr_ui_controls_v1_set_display_info_id(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,uint32_t display_id_hi,uint32_t display_id_low)332 zcr_ui_controls_v1_set_display_info_id(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, uint32_t display_id_hi, uint32_t display_id_low)
333 {
334 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
335 ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_ID, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, display_id_hi, display_id_low);
336 }
337
338 /**
339 * @ingroup iface_zcr_ui_controls_v1
340 *
341 * Set the display size to be added. The display will be
342 * created upon `display_info_done` request.
343 */
344 static inline void
zcr_ui_controls_v1_set_display_info_size(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,uint32_t width,uint32_t height)345 zcr_ui_controls_v1_set_display_info_size(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, uint32_t width, uint32_t height)
346 {
347 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
348 ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, width, height);
349 }
350
351 /**
352 * @ingroup iface_zcr_ui_controls_v1
353 *
354 * Set the display device scale factor to be added. The display
355 * will be created upon `display_info_done` request.
356 *
357 * The client has a 32-bit float scale factor that is associated with each
358 * display. This scale factor must be propagated exactly to exo. To do so
359 * we reinterpret_cast into a 32-bit uint and later cast back into a
360 * float. This is because wayland does not support native transport of
361 * floats. As different CPU architectures may use different endian
362 * representations for IEEE 754 floats, this protocol implicitly assumes
363 * that the caller and receiver are the same machine.
364 */
365 static inline void
zcr_ui_controls_v1_set_display_info_device_scale_factor(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,uint32_t device_scale_factor_as_uint)366 zcr_ui_controls_v1_set_display_info_device_scale_factor(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, uint32_t device_scale_factor_as_uint)
367 {
368 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
369 ZCR_UI_CONTROLS_V1_SET_DISPLAY_INFO_DEVICE_SCALE_FACTOR, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, device_scale_factor_as_uint);
370 }
371
372 /**
373 * @ingroup iface_zcr_ui_controls_v1
374 *
375 * Add pending display to pending display list. The value
376 * of display properties will use default value if they're
377 * not set by request.
378 */
379 static inline void
zcr_ui_controls_v1_display_info_done(struct zcr_ui_controls_v1 * zcr_ui_controls_v1)380 zcr_ui_controls_v1_display_info_done(struct zcr_ui_controls_v1 *zcr_ui_controls_v1)
381 {
382 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
383 ZCR_UI_CONTROLS_V1_DISPLAY_INFO_DONE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0);
384 }
385
386 /**
387 * @ingroup iface_zcr_ui_controls_v1
388 *
389 * Flush the display information to ash and update the displays.
390 */
391 static inline void
zcr_ui_controls_v1_display_info_list_done(struct zcr_ui_controls_v1 * zcr_ui_controls_v1,uint32_t id)392 zcr_ui_controls_v1_display_info_list_done(struct zcr_ui_controls_v1 *zcr_ui_controls_v1, uint32_t id)
393 {
394 wl_proxy_marshal_flags((struct wl_proxy *) zcr_ui_controls_v1,
395 ZCR_UI_CONTROLS_V1_DISPLAY_INFO_LIST_DONE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_ui_controls_v1), 0, id);
396 }
397
398 #ifdef __cplusplus
399 }
400 #endif
401
402 #endif
403