1 /* Generated by wayland-scanner 1.22.0 */
2 
3 #ifndef TEXT_INPUT_EXTENSION_UNSTABLE_V1_CLIENT_PROTOCOL_H
4 #define TEXT_INPUT_EXTENSION_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_text_input_extension_unstable_v1 The text_input_extension_unstable_v1 protocol
16  * @section page_ifaces_text_input_extension_unstable_v1 Interfaces
17  * - @subpage page_iface_zcr_text_input_extension_v1 - extends text_input to support richer operations
18  * - @subpage page_iface_zcr_extended_text_input_v1 - extension of text_input protocol
19  * @section page_copyright_text_input_extension_unstable_v1 Copyright
20  * <pre>
21  *
22  * Copyright 2021 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 zcr_extended_text_input_v1;
45 struct zcr_text_input_extension_v1;
46 struct zwp_text_input_v1;
47 
48 #ifndef ZCR_TEXT_INPUT_EXTENSION_V1_INTERFACE
49 #define ZCR_TEXT_INPUT_EXTENSION_V1_INTERFACE
50 /**
51  * @page page_iface_zcr_text_input_extension_v1 zcr_text_input_extension_v1
52  * @section page_iface_zcr_text_input_extension_v1_desc Description
53  *
54  * Allows a text_input to sends more variation of operations to support
55  * richer features, such as set_preedit_region.
56  *
57  * Warning! The protocol described in this file is experimental and
58  * backward incompatible changes may be made. Backward compatible changes
59  * may be added together with the corresponding uinterface version bump.
60  * Backward incompatible changes are done by bumping the version number in
61  * the protocol and interface names and resetting the interface version.
62  * Once the protocol is to be declared stable, the 'z' prefix and the
63  * version number in the protocol and interface names are removed and the
64  * interface version number is reset.
65  * @section page_iface_zcr_text_input_extension_v1_api API
66  * See @ref iface_zcr_text_input_extension_v1.
67  */
68 /**
69  * @defgroup iface_zcr_text_input_extension_v1 The zcr_text_input_extension_v1 interface
70  *
71  * Allows a text_input to sends more variation of operations to support
72  * richer features, such as set_preedit_region.
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 interface 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_text_input_extension_v1_interface;
84 #endif
85 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_INTERFACE
86 #define ZCR_EXTENDED_TEXT_INPUT_V1_INTERFACE
87 /**
88  * @page page_iface_zcr_extended_text_input_v1 zcr_extended_text_input_v1
89  * @section page_iface_zcr_extended_text_input_v1_desc Description
90  *
91  * The zcr_extended_text_input_v1 interface extends the text_input interface
92  * to support more rich operations on text_input.
93  * @section page_iface_zcr_extended_text_input_v1_api API
94  * See @ref iface_zcr_extended_text_input_v1.
95  */
96 /**
97  * @defgroup iface_zcr_extended_text_input_v1 The zcr_extended_text_input_v1 interface
98  *
99  * The zcr_extended_text_input_v1 interface extends the text_input interface
100  * to support more rich operations on text_input.
101  */
102 extern const struct wl_interface zcr_extended_text_input_v1_interface;
103 #endif
104 
105 #ifndef ZCR_TEXT_INPUT_EXTENSION_V1_ERROR_ENUM
106 #define ZCR_TEXT_INPUT_EXTENSION_V1_ERROR_ENUM
107 enum zcr_text_input_extension_v1_error {
108 	/**
109 	 * the text_input already has an extended_text_input object associated
110 	 */
111 	ZCR_TEXT_INPUT_EXTENSION_V1_ERROR_EXTENDED_TEXT_INPUT_EXISTS = 0,
112 };
113 #endif /* ZCR_TEXT_INPUT_EXTENSION_V1_ERROR_ENUM */
114 
115 #define ZCR_TEXT_INPUT_EXTENSION_V1_GET_EXTENDED_TEXT_INPUT 0
116 
117 
118 /**
119  * @ingroup iface_zcr_text_input_extension_v1
120  */
121 #define ZCR_TEXT_INPUT_EXTENSION_V1_GET_EXTENDED_TEXT_INPUT_SINCE_VERSION 1
122 
123 /** @ingroup iface_zcr_text_input_extension_v1 */
124 static inline void
zcr_text_input_extension_v1_set_user_data(struct zcr_text_input_extension_v1 * zcr_text_input_extension_v1,void * user_data)125 zcr_text_input_extension_v1_set_user_data(struct zcr_text_input_extension_v1 *zcr_text_input_extension_v1, void *user_data)
126 {
127 	wl_proxy_set_user_data((struct wl_proxy *) zcr_text_input_extension_v1, user_data);
128 }
129 
130 /** @ingroup iface_zcr_text_input_extension_v1 */
131 static inline void *
zcr_text_input_extension_v1_get_user_data(struct zcr_text_input_extension_v1 * zcr_text_input_extension_v1)132 zcr_text_input_extension_v1_get_user_data(struct zcr_text_input_extension_v1 *zcr_text_input_extension_v1)
133 {
134 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_text_input_extension_v1);
135 }
136 
137 static inline uint32_t
zcr_text_input_extension_v1_get_version(struct zcr_text_input_extension_v1 * zcr_text_input_extension_v1)138 zcr_text_input_extension_v1_get_version(struct zcr_text_input_extension_v1 *zcr_text_input_extension_v1)
139 {
140 	return wl_proxy_get_version((struct wl_proxy *) zcr_text_input_extension_v1);
141 }
142 
143 /** @ingroup iface_zcr_text_input_extension_v1 */
144 static inline void
zcr_text_input_extension_v1_destroy(struct zcr_text_input_extension_v1 * zcr_text_input_extension_v1)145 zcr_text_input_extension_v1_destroy(struct zcr_text_input_extension_v1 *zcr_text_input_extension_v1)
146 {
147 	wl_proxy_destroy((struct wl_proxy *) zcr_text_input_extension_v1);
148 }
149 
150 /**
151  * @ingroup iface_zcr_text_input_extension_v1
152  *
153  * Create extended_text_input object.
154  * See zcr_extended_text_input interface for details.
155  * If the given text_input object already has a extended_text_input object
156  * associated, the extended_text_input_exists protocol error is raised.
157  */
158 static inline struct zcr_extended_text_input_v1 *
zcr_text_input_extension_v1_get_extended_text_input(struct zcr_text_input_extension_v1 * zcr_text_input_extension_v1,struct zwp_text_input_v1 * text_input)159 zcr_text_input_extension_v1_get_extended_text_input(struct zcr_text_input_extension_v1 *zcr_text_input_extension_v1, struct zwp_text_input_v1 *text_input)
160 {
161 	struct wl_proxy *id;
162 
163 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_text_input_extension_v1,
164 			 ZCR_TEXT_INPUT_EXTENSION_V1_GET_EXTENDED_TEXT_INPUT, &zcr_extended_text_input_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_text_input_extension_v1), 0, NULL, text_input);
165 
166 	return (struct zcr_extended_text_input_v1 *) id;
167 }
168 
169 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_ENUM
170 #define ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_ENUM
171 /**
172  * @ingroup iface_zcr_extended_text_input_v1
173  * Chrome's TextInputType
174  *
175  * Wayland has its own input-type support, which is
176  * zwp_text_input::content_purpose. However, it is not rich enough to
177  * represent all Chrome's input types. This enum is introduced to keep
178  * all entries so exo can understand it without any information loss.
179  * See TextInputType's description for details about each entry.
180  */
181 enum zcr_extended_text_input_v1_input_type {
182 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_NONE = 0,
183 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_TEXT = 1,
184 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_PASSWORD = 2,
185 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_SEARCH = 3,
186 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_EMAIL = 4,
187 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_NUMBER = 5,
188 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_TELEPHONE = 6,
189 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_URL = 7,
190 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_DATE = 8,
191 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_DATE_TIME = 9,
192 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_DATE_TIME_LOCAL = 10,
193 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_MONTH = 11,
194 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_TIME = 12,
195 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_WEEK = 13,
196 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_TEXT_AREA = 14,
197 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_CONTENT_EDITABLE = 15,
198 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_DATE_TIME_FIELD = 16,
199 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_NULL = 17,
200 };
201 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_TYPE_ENUM */
202 
203 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_ENUM
204 #define ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_ENUM
205 /**
206  * @ingroup iface_zcr_extended_text_input_v1
207  * Chrome's TextInputMode
208  *
209  * Similar to input_type defined above, this keeps Chrome's TextInputMode.
210  * See TextInputMode's description for details for each entry.
211  */
212 enum zcr_extended_text_input_v1_input_mode {
213 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_DEFAULT = 0,
214 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_NONE = 1,
215 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_TEXT = 2,
216 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_TEL = 3,
217 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_URL = 4,
218 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_EMAIL = 5,
219 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_NUMERIC = 6,
220 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_DECIMAL = 7,
221 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_SEARCH = 8,
222 };
223 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_MODE_ENUM */
224 
225 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_ENUM
226 #define ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_ENUM
227 /**
228  * @ingroup iface_zcr_extended_text_input_v1
229  * Chrome's TextInputFlags
230  *
231  * Similar to input_type defined above, this keeps Chrome's TextInputFlags,
232  * because content_hint is not enough power to represent what Chrome wants.
233  * See TextInputFlags' description for details for each entry.
234  */
235 enum zcr_extended_text_input_v1_input_flags {
236 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_NONE = 0,
237 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCOMPLETE_ON = 1 << 0,
238 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCOMPLETE_OFF = 1 << 1,
239 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCORRECT_ON = 1 << 2,
240 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCORRECT_OFF = 1 << 3,
241 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_SPELLCHECK_ON = 1 << 4,
242 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_SPELLCHECK_OFF = 1 << 5,
243 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCAPITALIZE_NONE = 1 << 6,
244 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCAPITALIZE_CHARACTERS = 1 << 7,
245 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCAPITALIZE_WORDS = 1 << 8,
246 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_AUTOCAPITALIZE_SENTENCES = 1 << 9,
247 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_HAS_BEEN_PASSWORD = 1 << 10,
248 	ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_VERTICAL = 1 << 11,
249 };
250 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_INPUT_FLAGS_ENUM */
251 
252 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_LEARNING_MODE_ENUM
253 #define ZCR_EXTENDED_TEXT_INPUT_V1_LEARNING_MODE_ENUM
254 /**
255  * @ingroup iface_zcr_extended_text_input_v1
256  * Whether IME is allowed to learn
257  */
258 enum zcr_extended_text_input_v1_learning_mode {
259 	ZCR_EXTENDED_TEXT_INPUT_V1_LEARNING_MODE_DISABLED = 0,
260 	ZCR_EXTENDED_TEXT_INPUT_V1_LEARNING_MODE_ENABLED = 1,
261 };
262 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_LEARNING_MODE_ENUM */
263 
264 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_ENUM
265 #define ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_ENUM
266 /**
267  * @ingroup iface_zcr_extended_text_input_v1
268  * Chrome's TextInputClient::FocusReason
269  *
270  * This represents the reasons why the text input gets focused.
271  */
272 enum zcr_extended_text_input_v1_focus_reason_type {
273 	ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_NONE = 0,
274 	ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_MOUSE = 1,
275 	ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_TOUCH = 2,
276 	ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_PEN = 3,
277 	ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_OTHER = 4,
278 };
279 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_FOCUS_REASON_TYPE_ENUM */
280 
281 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_INLINE_COMPOSITION_SUPPORT_ENUM
282 #define ZCR_EXTENDED_TEXT_INPUT_V1_INLINE_COMPOSITION_SUPPORT_ENUM
283 /**
284  * @ingroup iface_zcr_extended_text_input_v1
285  * Whether inline composition is supported
286  *
287  * Inline composition is an IME feature for certain languages (e.g. CJK)
288  * which displays the uncommitted composition inside the input field as it
289  * is being typed.
290  */
291 enum zcr_extended_text_input_v1_inline_composition_support {
292 	ZCR_EXTENDED_TEXT_INPUT_V1_INLINE_COMPOSITION_SUPPORT_UNSUPPORTED = 0,
293 	ZCR_EXTENDED_TEXT_INPUT_V1_INLINE_COMPOSITION_SUPPORT_SUPPORTED = 1,
294 };
295 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_INLINE_COMPOSITION_SUPPORT_ENUM */
296 
297 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_SURROUNDING_TEXT_SUPPORT_ENUM
298 #define ZCR_EXTENDED_TEXT_INPUT_V1_SURROUNDING_TEXT_SUPPORT_ENUM
299 /**
300  * @ingroup iface_zcr_extended_text_input_v1
301  * Whether surrounding text is supported
302  */
303 enum zcr_extended_text_input_v1_surrounding_text_support {
304 	ZCR_EXTENDED_TEXT_INPUT_V1_SURROUNDING_TEXT_SUPPORT_UNSUPPORTED = 0,
305 	ZCR_EXTENDED_TEXT_INPUT_V1_SURROUNDING_TEXT_SUPPORT_SUPPORTED = 1,
306 };
307 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_SURROUNDING_TEXT_SUPPORT_ENUM */
308 
309 #ifndef ZCR_EXTENDED_TEXT_INPUT_V1_CONFIRM_PREEDIT_SELECTION_BEHAVIOR_ENUM
310 #define ZCR_EXTENDED_TEXT_INPUT_V1_CONFIRM_PREEDIT_SELECTION_BEHAVIOR_ENUM
311 /**
312  * @ingroup iface_zcr_extended_text_input_v1
313  * How the selection range is affected by confirm_preedit
314  */
315 enum zcr_extended_text_input_v1_confirm_preedit_selection_behavior {
316 	/**
317 	 * The cursor is moved to the end of the committed preedit text, if any.
318 	 */
319 	ZCR_EXTENDED_TEXT_INPUT_V1_CONFIRM_PREEDIT_SELECTION_BEHAVIOR_AFTER_PREEDIT = 0,
320 	/**
321 	 * The selection range is not affected at all.
322 	 */
323 	ZCR_EXTENDED_TEXT_INPUT_V1_CONFIRM_PREEDIT_SELECTION_BEHAVIOR_UNCHANGED = 1,
324 };
325 #endif /* ZCR_EXTENDED_TEXT_INPUT_V1_CONFIRM_PREEDIT_SELECTION_BEHAVIOR_ENUM */
326 
327 /**
328  * @ingroup iface_zcr_extended_text_input_v1
329  * @struct zcr_extended_text_input_v1_listener
330  */
331 struct zcr_extended_text_input_v1_listener {
332 	/**
333 	 * set preedit from the surrounding text
334 	 *
335 	 * IME requests to update text_input client to set the preedit
336 	 * from the surrounding text.
337 	 *
338 	 * index is the starting point of the preedit, relative to the
339 	 * current cursor position in utf-8 byte-offset. length is the
340 	 * length of the preedit region in utf-8 byte length.
341 	 *
342 	 * Following the convention we have in text_input::preedit_string,
343 	 * text_input::preedit_styling sent just before this will be
344 	 * applied.
345 	 */
346 	void (*set_preedit_region)(void *data,
347 				   struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
348 				   int32_t index,
349 				   uint32_t length);
350 	/**
351 	 * clear grammar fragments in a range
352 	 *
353 	 * IME requests to clear all the grammar markers within the given
354 	 * range defined by start and end.
355 	 *
356 	 * start and end are relative to the beginning of the input field
357 	 * in utf-8 byte length.
358 	 * @since 3
359 	 */
360 	void (*clear_grammar_fragments)(void *data,
361 					struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
362 					uint32_t start,
363 					uint32_t end);
364 	/**
365 	 * add grammar fragment
366 	 *
367 	 * IME requests to add a new grammar fragment.
368 	 *
369 	 * A grammar fragment describes a range of text (start, end) that
370 	 * has grammar error and also gives the correct replacement text.
371 	 * It is expected that the renderer will render markers (e.g.
372 	 * squigles or dashed underlines) under the text to notify users
373 	 * that there is a grammar error. It is also expected that the
374 	 * renderer will maintain and update the position of fragment when
375 	 * users edit other parts of the text, e.g. if users type something
376 	 * before the grammar fragment, the marker should move accordingly.
377 	 *
378 	 * start and end are relative to the beginning of the input field
379 	 * in utf-8 byte length. suggestion is the correct replacement
380 	 * text, encoded in utf-8 and suggested by ML model.
381 	 * @since 3
382 	 */
383 	void (*add_grammar_fragment)(void *data,
384 				     struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
385 				     uint32_t start,
386 				     uint32_t end,
387 				     const char *suggestion);
388 	/**
389 	 * set autocorrect range
390 	 *
391 	 * IME requests to update text_input client to set the
392 	 * autocorrect range. There is only one autocorrect range, so this
393 	 * replaces any existing autocorrect ranges.
394 	 *
395 	 * start and end are relative to the beginning of the input field
396 	 * in utf-8 byte length.
397 	 *
398 	 * If start and end are the same, then the autocorrect range is
399 	 * cleared.
400 	 * @since 4
401 	 */
402 	void (*set_autocorrect_range)(void *data,
403 				      struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
404 				      uint32_t start,
405 				      uint32_t end);
406 	/**
407 	 * Sets the virtual keyboard's occluded bounds.
408 	 *
409 	 * This event tells the client about the part of the virtual
410 	 * keyboard's bounds that occludes the text input's window, in
411 	 * screen DIP coordinates. In order for the text input to make
412 	 * proper use of this information, it needs to know its window's
413 	 * screen DIP bounds via another interface such as the aura-shell.
414 	 *
415 	 * The occluded bounds may be smaller than the keyboard's visual
416 	 * bounds.
417 	 *
418 	 * When the virtual keyboard is hidden or floating, empty bounds
419 	 * are sent, i.e. with zero width and height.
420 	 * @since 5
421 	 */
422 	void (*set_virtual_keyboard_occluded_bounds)(void *data,
423 						     struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
424 						     int32_t x,
425 						     int32_t y,
426 						     int32_t width,
427 						     int32_t height);
428 	/**
429 	 * Commits the current preedit
430 	 *
431 	 * Commits the current preedit and modify the selection range
432 	 * according to selection_behavior. Has no effect if there's no
433 	 * preedit text.
434 	 * @since 11
435 	 */
436 	void (*confirm_preedit)(void *data,
437 				struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
438 				uint32_t selection_behavior);
439 	/**
440 	 * Inserts image
441 	 *
442 	 * This inserts a given image into current editing field. The
443 	 * value of src should be a valid http(s) URL pointing to some
444 	 * image.
445 	 *
446 	 * Note: this only works for richly-editable editing field in web
447 	 * apps. Internally it sends a PasteFromImage editing command to
448 	 * blink engine. If the current editing field is not
449 	 * richly-editable, this event will be ignored.
450 	 * @since 13
451 	 */
452 	void (*insert_image)(void *data,
453 			     struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
454 			     const char *src);
455 };
456 
457 /**
458  * @ingroup iface_zcr_extended_text_input_v1
459  */
460 static inline int
zcr_extended_text_input_v1_add_listener(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,const struct zcr_extended_text_input_v1_listener * listener,void * data)461 zcr_extended_text_input_v1_add_listener(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1,
462 					const struct zcr_extended_text_input_v1_listener *listener, void *data)
463 {
464 	return wl_proxy_add_listener((struct wl_proxy *) zcr_extended_text_input_v1,
465 				     (void (**)(void)) listener, data);
466 }
467 
468 #define ZCR_EXTENDED_TEXT_INPUT_V1_DESTROY 0
469 #define ZCR_EXTENDED_TEXT_INPUT_V1_DEPRECATED_SET_INPUT_TYPE 1
470 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_GRAMMAR_FRAGMENT_AT_CURSOR 2
471 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_AUTOCORRECT_INFO 3
472 #define ZCR_EXTENDED_TEXT_INPUT_V1_FINALIZE_VIRTUAL_KEYBOARD_CHANGES 4
473 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_FOCUS_REASON 5
474 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_INPUT_TYPE 6
475 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_SURROUNDING_TEXT_SUPPORT 7
476 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_SURROUNDING_TEXT_OFFSET_UTF16 8
477 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_LARGE_SURROUNDING_TEXT 9
478 
479 /**
480  * @ingroup iface_zcr_extended_text_input_v1
481  */
482 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_PREEDIT_REGION_SINCE_VERSION 1
483 /**
484  * @ingroup iface_zcr_extended_text_input_v1
485  */
486 #define ZCR_EXTENDED_TEXT_INPUT_V1_CLEAR_GRAMMAR_FRAGMENTS_SINCE_VERSION 3
487 /**
488  * @ingroup iface_zcr_extended_text_input_v1
489  */
490 #define ZCR_EXTENDED_TEXT_INPUT_V1_ADD_GRAMMAR_FRAGMENT_SINCE_VERSION 3
491 /**
492  * @ingroup iface_zcr_extended_text_input_v1
493  */
494 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_AUTOCORRECT_RANGE_SINCE_VERSION 4
495 /**
496  * @ingroup iface_zcr_extended_text_input_v1
497  */
498 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_VIRTUAL_KEYBOARD_OCCLUDED_BOUNDS_SINCE_VERSION 5
499 /**
500  * @ingroup iface_zcr_extended_text_input_v1
501  */
502 #define ZCR_EXTENDED_TEXT_INPUT_V1_CONFIRM_PREEDIT_SINCE_VERSION 11
503 /**
504  * @ingroup iface_zcr_extended_text_input_v1
505  */
506 #define ZCR_EXTENDED_TEXT_INPUT_V1_INSERT_IMAGE_SINCE_VERSION 13
507 
508 /**
509  * @ingroup iface_zcr_extended_text_input_v1
510  */
511 #define ZCR_EXTENDED_TEXT_INPUT_V1_DESTROY_SINCE_VERSION 1
512 /**
513  * @ingroup iface_zcr_extended_text_input_v1
514  */
515 #define ZCR_EXTENDED_TEXT_INPUT_V1_DEPRECATED_SET_INPUT_TYPE_SINCE_VERSION 2
516 /**
517  * @ingroup iface_zcr_extended_text_input_v1
518  */
519 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_GRAMMAR_FRAGMENT_AT_CURSOR_SINCE_VERSION 3
520 /**
521  * @ingroup iface_zcr_extended_text_input_v1
522  */
523 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_AUTOCORRECT_INFO_SINCE_VERSION 4
524 /**
525  * @ingroup iface_zcr_extended_text_input_v1
526  */
527 #define ZCR_EXTENDED_TEXT_INPUT_V1_FINALIZE_VIRTUAL_KEYBOARD_CHANGES_SINCE_VERSION 6
528 /**
529  * @ingroup iface_zcr_extended_text_input_v1
530  */
531 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_FOCUS_REASON_SINCE_VERSION 7
532 /**
533  * @ingroup iface_zcr_extended_text_input_v1
534  */
535 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_INPUT_TYPE_SINCE_VERSION 8
536 /**
537  * @ingroup iface_zcr_extended_text_input_v1
538  */
539 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_SURROUNDING_TEXT_SUPPORT_SINCE_VERSION 9
540 /**
541  * @ingroup iface_zcr_extended_text_input_v1
542  */
543 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_SURROUNDING_TEXT_OFFSET_UTF16_SINCE_VERSION 10
544 /**
545  * @ingroup iface_zcr_extended_text_input_v1
546  */
547 #define ZCR_EXTENDED_TEXT_INPUT_V1_SET_LARGE_SURROUNDING_TEXT_SINCE_VERSION 12
548 
549 /** @ingroup iface_zcr_extended_text_input_v1 */
550 static inline void
zcr_extended_text_input_v1_set_user_data(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,void * user_data)551 zcr_extended_text_input_v1_set_user_data(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, void *user_data)
552 {
553 	wl_proxy_set_user_data((struct wl_proxy *) zcr_extended_text_input_v1, user_data);
554 }
555 
556 /** @ingroup iface_zcr_extended_text_input_v1 */
557 static inline void *
zcr_extended_text_input_v1_get_user_data(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1)558 zcr_extended_text_input_v1_get_user_data(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1)
559 {
560 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_extended_text_input_v1);
561 }
562 
563 static inline uint32_t
zcr_extended_text_input_v1_get_version(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1)564 zcr_extended_text_input_v1_get_version(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1)
565 {
566 	return wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1);
567 }
568 
569 /**
570  * @ingroup iface_zcr_extended_text_input_v1
571  */
572 static inline void
zcr_extended_text_input_v1_destroy(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1)573 zcr_extended_text_input_v1_destroy(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1)
574 {
575 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
576 			 ZCR_EXTENDED_TEXT_INPUT_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), WL_MARSHAL_FLAG_DESTROY);
577 }
578 
579 /**
580  * @ingroup iface_zcr_extended_text_input_v1
581  *
582  * Deprecated. Use the new set_input_type.
583  */
584 static inline void
zcr_extended_text_input_v1_deprecated_set_input_type(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,uint32_t input_type,uint32_t input_mode,uint32_t input_flags,uint32_t learning_mode)585 zcr_extended_text_input_v1_deprecated_set_input_type(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, uint32_t input_type, uint32_t input_mode, uint32_t input_flags, uint32_t learning_mode)
586 {
587 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
588 			 ZCR_EXTENDED_TEXT_INPUT_V1_DEPRECATED_SET_INPUT_TYPE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, input_type, input_mode, input_flags, learning_mode);
589 }
590 
591 /**
592  * @ingroup iface_zcr_extended_text_input_v1
593  *
594  * Informs the IME of the grammar fragment containing the current cursor.
595  * If not existing, both start and end are set to 0. This is called
596  * whenever the cursor position or surrounding text have changed.
597  *
598  * start and end are relative to the beginning of the input field in
599  * utf-8 byte length. suggestion is the correct replacement text encoded
600  * in utf-8 and suggested by ML model.
601  */
602 static inline void
zcr_extended_text_input_v1_set_grammar_fragment_at_cursor(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,uint32_t start,uint32_t end,const char * suggestion)603 zcr_extended_text_input_v1_set_grammar_fragment_at_cursor(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, uint32_t start, uint32_t end, const char *suggestion)
604 {
605 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
606 			 ZCR_EXTENDED_TEXT_INPUT_V1_SET_GRAMMAR_FRAGMENT_AT_CURSOR, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, start, end, suggestion);
607 }
608 
609 /**
610  * @ingroup iface_zcr_extended_text_input_v1
611  *
612  * Informs the IME the range and bounds of the current autocorrect change.
613  * This is called whenever the range or bounds have changed.
614  *
615  * start and end are relative to the beginning of the input field in utf-8
616  * byte length.
617  *
618  * x, y, width, and height are the bounds of the autocorrect text, relative
619  * to the window.
620  *
621  * This request only changes a pending state that will be effective on the
622  * next 'set_surrounding_text' request.
623  */
624 static inline void
zcr_extended_text_input_v1_set_autocorrect_info(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,uint32_t start,uint32_t end,uint32_t x,uint32_t y,uint32_t width,uint32_t height)625 zcr_extended_text_input_v1_set_autocorrect_info(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, uint32_t start, uint32_t end, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
626 {
627 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
628 			 ZCR_EXTENDED_TEXT_INPUT_V1_SET_AUTOCORRECT_INFO, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, start, end, x, y, width, height);
629 }
630 
631 /**
632  * @ingroup iface_zcr_extended_text_input_v1
633  *
634  * This request notifies the server that the client has finished making
635  * requested changes to the virtual keyboard, and the server should update
636  * the client with the latest virtual keyboard state. This avoids spurious
637  * intermediate requests from causing the virtual keyboard to change state
638  * unnecessarily.
639  *
640  * Clients that connect to the server at this or higher versions must send
641  * this request after it finishes sending the applicable requests. The
642  * server is free to decide how it handles or honors this request.
643  *
644  * As of version 6, the applicable requests are:
645  * - zwp_text_input_v1.show_input_panel
646  * - zwp_text_input_v1.hide_input_panel
647  */
648 static inline void
zcr_extended_text_input_v1_finalize_virtual_keyboard_changes(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1)649 zcr_extended_text_input_v1_finalize_virtual_keyboard_changes(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1)
650 {
651 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
652 			 ZCR_EXTENDED_TEXT_INPUT_V1_FINALIZE_VIRTUAL_KEYBOARD_CHANGES, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0);
653 }
654 
655 /**
656  * @ingroup iface_zcr_extended_text_input_v1
657  *
658  * Updates the reason why the following focus event is triggered.
659  * This should be called just before text_input::activate,
660  * and is in effect when it is called together (i.e. it is not in effect
661  * until text_input::activate is called).
662  *
663  * `reason` is an extended parameter providing the mode for the next
664  * `text_input::active request`.
665  */
666 static inline void
zcr_extended_text_input_v1_set_focus_reason(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,uint32_t reason)667 zcr_extended_text_input_v1_set_focus_reason(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, uint32_t reason)
668 {
669 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
670 			 ZCR_EXTENDED_TEXT_INPUT_V1_SET_FOCUS_REASON, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, reason);
671 }
672 
673 /**
674  * @ingroup iface_zcr_extended_text_input_v1
675  *
676  * Used in place of zwp_text_input::set_content_type.
677  *
678  * Instead of hint and purpose, this API uses concepts that more closely
679  * align with those used by Chrome.
680  */
681 static inline void
zcr_extended_text_input_v1_set_input_type(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,uint32_t input_type,uint32_t input_mode,uint32_t input_flags,uint32_t learning_mode,uint32_t inline_composition_support)682 zcr_extended_text_input_v1_set_input_type(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, uint32_t input_type, uint32_t input_mode, uint32_t input_flags, uint32_t learning_mode, uint32_t inline_composition_support)
683 {
684 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
685 			 ZCR_EXTENDED_TEXT_INPUT_V1_SET_INPUT_TYPE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, input_type, input_mode, input_flags, learning_mode, inline_composition_support);
686 }
687 
688 /**
689  * @ingroup iface_zcr_extended_text_input_v1
690  *
691  * Some clients are not able to provide surrounding text or selection.
692  * When the server receives this request with the unsupproted enum, it
693  * will disable functionality relying on surrounding text and avoid
694  * sending events that depend on it like delete_surrounding_text,
695  * set_preedit_region and cursor_position.
696  *
697  * This request will take effect on the next 'set_content_type' or
698  * 'set_input_type' request.
699  *
700  * By default, the server will assume surrounding text is supported.
701  */
702 static inline void
zcr_extended_text_input_v1_set_surrounding_text_support(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,uint32_t support)703 zcr_extended_text_input_v1_set_surrounding_text_support(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, uint32_t support)
704 {
705 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
706 			 ZCR_EXTENDED_TEXT_INPUT_V1_SET_SURROUNDING_TEXT_SUPPORT, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, support);
707 }
708 
709 /**
710  * @ingroup iface_zcr_extended_text_input_v1
711  *
712  * This updates UTF-16 offset of the immediately following
713  * text_input::set_surrounding_text.
714  *
715  * The value will be invalidated when the next set_surrounding_text
716  * comes (i.e., if two consecutive set_surrounding_text is called,
717  * the second set_surrounding_text's offset should be reset to 0).
718  *
719  * Note: unlike other APIs, this is in "UTF-16" unit for Chrome's purpose,
720  * because there's no way to convert UTF-8 offset to UTF-16 without
721  * the original text, while sending whole text would cause performance
722  * concerns.
723  */
724 static inline void
zcr_extended_text_input_v1_set_surrounding_text_offset_utf16(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,uint32_t offset_utf16)725 zcr_extended_text_input_v1_set_surrounding_text_offset_utf16(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, uint32_t offset_utf16)
726 {
727 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
728 			 ZCR_EXTENDED_TEXT_INPUT_V1_SET_SURROUNDING_TEXT_OFFSET_UTF16, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, offset_utf16);
729 }
730 
731 /**
732  * @ingroup iface_zcr_extended_text_input_v1
733  *
734  * Almost as same as text_input::set_surrounding_text. However, this takes handle
735  * instead of string in order to avoid the limit of the size.
736  *
737  * |size| is the size of surrounding text in Utf-8, i.e. bytes to be read from fd.
738  */
739 static inline void
zcr_extended_text_input_v1_set_large_surrounding_text(struct zcr_extended_text_input_v1 * zcr_extended_text_input_v1,int32_t text,uint32_t size,uint32_t cursor,uint32_t anchor)740 zcr_extended_text_input_v1_set_large_surrounding_text(struct zcr_extended_text_input_v1 *zcr_extended_text_input_v1, int32_t text, uint32_t size, uint32_t cursor, uint32_t anchor)
741 {
742 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_extended_text_input_v1,
743 			 ZCR_EXTENDED_TEXT_INPUT_V1_SET_LARGE_SURROUNDING_TEXT, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_extended_text_input_v1), 0, text, size, cursor, anchor);
744 }
745 
746 #ifdef  __cplusplus
747 }
748 #endif
749 
750 #endif
751