1 /* Generated by wayland-scanner 1.22.0 */
2 
3 #ifndef TEXT_INPUT_UNSTABLE_V3_CLIENT_PROTOCOL_H
4 #define TEXT_INPUT_UNSTABLE_V3_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_unstable_v3 The text_input_unstable_v3 protocol
16  * Protocol for composing text
17  *
18  * @section page_desc_text_input_unstable_v3 Description
19  *
20  * This protocol allows compositors to act as input methods and to send text
21  * to applications. A text input object is used to manage state of what are
22  * typically text entry fields in the application.
23  *
24  * This document adheres to the RFC 2119 when using words like "must",
25  * "should", "may", etc.
26  *
27  * Warning! The protocol described in this file is experimental and
28  * backward incompatible changes may be made. Backward compatible changes
29  * may be added together with the corresponding interface version bump.
30  * Backward incompatible changes are done by bumping the version number in
31  * the protocol and interface names and resetting the interface version.
32  * Once the protocol is to be declared stable, the 'z' prefix and the
33  * version number in the protocol and interface names are removed and the
34  * interface version number is reset.
35  *
36  * @section page_ifaces_text_input_unstable_v3 Interfaces
37  * - @subpage page_iface_zwp_text_input_v3 - text input
38  * - @subpage page_iface_zwp_text_input_manager_v3 - text input manager
39  * @section page_copyright_text_input_unstable_v3 Copyright
40  * <pre>
41  *
42  * Copyright © 2012, 2013 Intel Corporation
43  * Copyright © 2015, 2016 Jan Arne Petersen
44  * Copyright © 2017, 2018 Red Hat, Inc.
45  * Copyright © 2018       Purism SPC
46  *
47  * Permission to use, copy, modify, distribute, and sell this
48  * software and its documentation for any purpose is hereby granted
49  * without fee, provided that the above copyright notice appear in
50  * all copies and that both that copyright notice and this permission
51  * notice appear in supporting documentation, and that the name of
52  * the copyright holders not be used in advertising or publicity
53  * pertaining to distribution of the software without specific,
54  * written prior permission.  The copyright holders make no
55  * representations about the suitability of this software for any
56  * purpose.  It is provided "as is" without express or implied
57  * warranty.
58  *
59  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
60  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
61  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
62  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
63  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
64  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
65  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
66  * THIS SOFTWARE.
67  * </pre>
68  */
69 struct wl_seat;
70 struct wl_surface;
71 struct zwp_text_input_manager_v3;
72 struct zwp_text_input_v3;
73 
74 #ifndef ZWP_TEXT_INPUT_V3_INTERFACE
75 #define ZWP_TEXT_INPUT_V3_INTERFACE
76 /**
77  * @page page_iface_zwp_text_input_v3 zwp_text_input_v3
78  * @section page_iface_zwp_text_input_v3_desc Description
79  *
80  * The zwp_text_input_v3 interface represents text input and input methods
81  * associated with a seat. It provides enter/leave events to follow the
82  * text input focus for a seat.
83  *
84  * Requests are used to enable/disable the text-input object and set
85  * state information like surrounding and selected text or the content type.
86  * The information about the entered text is sent to the text-input object
87  * via the preedit_string and commit_string events.
88  *
89  * Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices
90  * must not point to middle bytes inside a code point: they must either
91  * point to the first byte of a code point or to the end of the buffer.
92  * Lengths must be measured between two valid indices.
93  *
94  * Focus moving throughout surfaces will result in the emission of
95  * zwp_text_input_v3.enter and zwp_text_input_v3.leave events. The focused
96  * surface must commit zwp_text_input_v3.enable and
97  * zwp_text_input_v3.disable requests as the keyboard focus moves across
98  * editable and non-editable elements of the UI. Those two requests are not
99  * expected to be paired with each other, the compositor must be able to
100  * handle consecutive series of the same request.
101  *
102  * State is sent by the state requests (set_surrounding_text,
103  * set_content_type and set_cursor_rectangle) and a commit request. After an
104  * enter event or disable request all state information is invalidated and
105  * needs to be resent by the client.
106  * @section page_iface_zwp_text_input_v3_api API
107  * See @ref iface_zwp_text_input_v3.
108  */
109 /**
110  * @defgroup iface_zwp_text_input_v3 The zwp_text_input_v3 interface
111  *
112  * The zwp_text_input_v3 interface represents text input and input methods
113  * associated with a seat. It provides enter/leave events to follow the
114  * text input focus for a seat.
115  *
116  * Requests are used to enable/disable the text-input object and set
117  * state information like surrounding and selected text or the content type.
118  * The information about the entered text is sent to the text-input object
119  * via the preedit_string and commit_string events.
120  *
121  * Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices
122  * must not point to middle bytes inside a code point: they must either
123  * point to the first byte of a code point or to the end of the buffer.
124  * Lengths must be measured between two valid indices.
125  *
126  * Focus moving throughout surfaces will result in the emission of
127  * zwp_text_input_v3.enter and zwp_text_input_v3.leave events. The focused
128  * surface must commit zwp_text_input_v3.enable and
129  * zwp_text_input_v3.disable requests as the keyboard focus moves across
130  * editable and non-editable elements of the UI. Those two requests are not
131  * expected to be paired with each other, the compositor must be able to
132  * handle consecutive series of the same request.
133  *
134  * State is sent by the state requests (set_surrounding_text,
135  * set_content_type and set_cursor_rectangle) and a commit request. After an
136  * enter event or disable request all state information is invalidated and
137  * needs to be resent by the client.
138  */
139 extern const struct wl_interface zwp_text_input_v3_interface;
140 #endif
141 #ifndef ZWP_TEXT_INPUT_MANAGER_V3_INTERFACE
142 #define ZWP_TEXT_INPUT_MANAGER_V3_INTERFACE
143 /**
144  * @page page_iface_zwp_text_input_manager_v3 zwp_text_input_manager_v3
145  * @section page_iface_zwp_text_input_manager_v3_desc Description
146  *
147  * A factory for text-input objects. This object is a global singleton.
148  * @section page_iface_zwp_text_input_manager_v3_api API
149  * See @ref iface_zwp_text_input_manager_v3.
150  */
151 /**
152  * @defgroup iface_zwp_text_input_manager_v3 The zwp_text_input_manager_v3 interface
153  *
154  * A factory for text-input objects. This object is a global singleton.
155  */
156 extern const struct wl_interface zwp_text_input_manager_v3_interface;
157 #endif
158 
159 #ifndef ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_ENUM
160 #define ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_ENUM
161 /**
162  * @ingroup iface_zwp_text_input_v3
163  * text change reason
164  *
165  * Reason for the change of surrounding text or cursor posision.
166  */
167 enum zwp_text_input_v3_change_cause {
168 	/**
169 	 * input method caused the change
170 	 */
171 	ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD = 0,
172 	/**
173 	 * something else than the input method caused the change
174 	 */
175 	ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER = 1,
176 };
177 #endif /* ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_ENUM */
178 
179 #ifndef ZWP_TEXT_INPUT_V3_CONTENT_HINT_ENUM
180 #define ZWP_TEXT_INPUT_V3_CONTENT_HINT_ENUM
181 /**
182  * @ingroup iface_zwp_text_input_v3
183  * content hint
184  *
185  * Content hint is a bitmask to allow to modify the behavior of the text
186  * input.
187  */
188 enum zwp_text_input_v3_content_hint {
189 	/**
190 	 * no special behavior
191 	 */
192 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE = 0x0,
193 	/**
194 	 * suggest word completions
195 	 */
196 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_COMPLETION = 0x1,
197 	/**
198 	 * suggest word corrections
199 	 */
200 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK = 0x2,
201 	/**
202 	 * switch to uppercase letters at the start of a sentence
203 	 */
204 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION = 0x4,
205 	/**
206 	 * prefer lowercase letters
207 	 */
208 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE = 0x8,
209 	/**
210 	 * prefer uppercase letters
211 	 */
212 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE = 0x10,
213 	/**
214 	 * prefer casing for titles and headings (can be language dependent)
215 	 */
216 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_TITLECASE = 0x20,
217 	/**
218 	 * characters should be hidden
219 	 */
220 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_HIDDEN_TEXT = 0x40,
221 	/**
222 	 * typed text should not be stored
223 	 */
224 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA = 0x80,
225 	/**
226 	 * just Latin characters should be entered
227 	 */
228 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN = 0x100,
229 	/**
230 	 * the text input is multiline
231 	 */
232 	ZWP_TEXT_INPUT_V3_CONTENT_HINT_MULTILINE = 0x200,
233 };
234 #endif /* ZWP_TEXT_INPUT_V3_CONTENT_HINT_ENUM */
235 
236 #ifndef ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_ENUM
237 #define ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_ENUM
238 /**
239  * @ingroup iface_zwp_text_input_v3
240  * content purpose
241  *
242  * The content purpose allows to specify the primary purpose of a text
243  * input.
244  *
245  * This allows an input method to show special purpose input panels with
246  * extra characters or to disallow some characters.
247  */
248 enum zwp_text_input_v3_content_purpose {
249 	/**
250 	 * default input, allowing all characters
251 	 */
252 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL = 0,
253 	/**
254 	 * allow only alphabetic characters
255 	 */
256 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_ALPHA = 1,
257 	/**
258 	 * allow only digits
259 	 */
260 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DIGITS = 2,
261 	/**
262 	 * input a number (including decimal separator and sign)
263 	 */
264 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER = 3,
265 	/**
266 	 * input a phone number
267 	 */
268 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE = 4,
269 	/**
270 	 * input an URL
271 	 */
272 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_URL = 5,
273 	/**
274 	 * input an email address
275 	 */
276 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_EMAIL = 6,
277 	/**
278 	 * input a name of a person
279 	 */
280 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NAME = 7,
281 	/**
282 	 * input a password (combine with sensitive_data hint)
283 	 */
284 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PASSWORD = 8,
285 	/**
286 	 * input is a numeric password (combine with sensitive_data hint)
287 	 */
288 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PIN = 9,
289 	/**
290 	 * input a date
291 	 */
292 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE = 10,
293 	/**
294 	 * input a time
295 	 */
296 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TIME = 11,
297 	/**
298 	 * input a date and time
299 	 */
300 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME = 12,
301 	/**
302 	 * input for a terminal
303 	 */
304 	ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TERMINAL = 13,
305 };
306 #endif /* ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_ENUM */
307 
308 /**
309  * @ingroup iface_zwp_text_input_v3
310  * @struct zwp_text_input_v3_listener
311  */
312 struct zwp_text_input_v3_listener {
313 	/**
314 	 * enter event
315 	 *
316 	 * Notification that this seat's text-input focus is on a certain
317 	 * surface.
318 	 *
319 	 * If client has created multiple text input objects, compositor
320 	 * must send this event to all of them.
321 	 *
322 	 * When the seat has the keyboard capability the text-input focus
323 	 * follows the keyboard focus. This event sets the current surface
324 	 * for the text-input object.
325 	 */
326 	void (*enter)(void *data,
327 		      struct zwp_text_input_v3 *zwp_text_input_v3,
328 		      struct wl_surface *surface);
329 	/**
330 	 * leave event
331 	 *
332 	 * Notification that this seat's text-input focus is no longer on
333 	 * a certain surface. The client should reset any preedit string
334 	 * previously set.
335 	 *
336 	 * The leave notification clears the current surface. It is sent
337 	 * before the enter notification for the new focus. After leave
338 	 * event, compositor must ignore requests from any text input
339 	 * instances until next enter event.
340 	 *
341 	 * When the seat has the keyboard capability the text-input focus
342 	 * follows the keyboard focus.
343 	 */
344 	void (*leave)(void *data,
345 		      struct zwp_text_input_v3 *zwp_text_input_v3,
346 		      struct wl_surface *surface);
347 	/**
348 	 * pre-edit
349 	 *
350 	 * Notify when a new composing text (pre-edit) should be set at
351 	 * the current cursor position. Any previously set composing text
352 	 * must be removed. Any previously existing selected text must be
353 	 * removed.
354 	 *
355 	 * The argument text contains the pre-edit string buffer.
356 	 *
357 	 * The parameters cursor_begin and cursor_end are counted in bytes
358 	 * relative to the beginning of the submitted text buffer. Cursor
359 	 * should be hidden when both are equal to -1.
360 	 *
361 	 * They could be represented by the client as a line if both values
362 	 * are the same, or as a text highlight otherwise.
363 	 *
364 	 * Values set with this event are double-buffered. They must be
365 	 * applied and reset to initial on the next zwp_text_input_v3.done
366 	 * event.
367 	 *
368 	 * The initial value of text is an empty string, and cursor_begin,
369 	 * cursor_end and cursor_hidden are all 0.
370 	 */
371 	void (*preedit_string)(void *data,
372 			       struct zwp_text_input_v3 *zwp_text_input_v3,
373 			       const char *text,
374 			       int32_t cursor_begin,
375 			       int32_t cursor_end);
376 	/**
377 	 * text commit
378 	 *
379 	 * Notify when text should be inserted into the editor widget.
380 	 * The text to commit could be either just a single character after
381 	 * a key press or the result of some composing (pre-edit).
382 	 *
383 	 * Values set with this event are double-buffered. They must be
384 	 * applied and reset to initial on the next zwp_text_input_v3.done
385 	 * event.
386 	 *
387 	 * The initial value of text is an empty string.
388 	 */
389 	void (*commit_string)(void *data,
390 			      struct zwp_text_input_v3 *zwp_text_input_v3,
391 			      const char *text);
392 	/**
393 	 * delete surrounding text
394 	 *
395 	 * Notify when the text around the current cursor position should
396 	 * be deleted.
397 	 *
398 	 * Before_length and after_length are the number of bytes before
399 	 * and after the current cursor index (excluding the selection) to
400 	 * delete.
401 	 *
402 	 * If a preedit text is present, in effect before_length is counted
403 	 * from the beginning of it, and after_length from its end (see
404 	 * done event sequence).
405 	 *
406 	 * Values set with this event are double-buffered. They must be
407 	 * applied and reset to initial on the next zwp_text_input_v3.done
408 	 * event.
409 	 *
410 	 * The initial values of both before_length and after_length are 0.
411 	 * @param before_length length of text before current cursor position
412 	 * @param after_length length of text after current cursor position
413 	 */
414 	void (*delete_surrounding_text)(void *data,
415 					struct zwp_text_input_v3 *zwp_text_input_v3,
416 					uint32_t before_length,
417 					uint32_t after_length);
418 	/**
419 	 * apply changes
420 	 *
421 	 * Instruct the application to apply changes to state requested
422 	 * by the preedit_string, commit_string and delete_surrounding_text
423 	 * events. The state relating to these events is double-buffered,
424 	 * and each one modifies the pending state. This event replaces the
425 	 * current state with the pending state.
426 	 *
427 	 * The application must proceed by evaluating the changes in the
428 	 * following order:
429 	 *
430 	 * 1. Replace existing preedit string with the cursor. 2. Delete
431 	 * requested surrounding text. 3. Insert commit string with the
432 	 * cursor at its end. 4. Calculate surrounding text to send. 5.
433 	 * Insert new preedit text in cursor position. 6. Place cursor
434 	 * inside preedit text.
435 	 *
436 	 * The serial number reflects the last state of the
437 	 * zwp_text_input_v3 object known to the compositor. The value of
438 	 * the serial argument must be equal to the number of commit
439 	 * requests already issued on that object. When the client receives
440 	 * a done event with a serial different than the number of past
441 	 * commit requests, it must proceed as normal, except it should not
442 	 * change the current state of the zwp_text_input_v3 object.
443 	 */
444 	void (*done)(void *data,
445 		     struct zwp_text_input_v3 *zwp_text_input_v3,
446 		     uint32_t serial);
447 };
448 
449 /**
450  * @ingroup iface_zwp_text_input_v3
451  */
452 static inline int
zwp_text_input_v3_add_listener(struct zwp_text_input_v3 * zwp_text_input_v3,const struct zwp_text_input_v3_listener * listener,void * data)453 zwp_text_input_v3_add_listener(struct zwp_text_input_v3 *zwp_text_input_v3,
454 			       const struct zwp_text_input_v3_listener *listener, void *data)
455 {
456 	return wl_proxy_add_listener((struct wl_proxy *) zwp_text_input_v3,
457 				     (void (**)(void)) listener, data);
458 }
459 
460 #define ZWP_TEXT_INPUT_V3_DESTROY 0
461 #define ZWP_TEXT_INPUT_V3_ENABLE 1
462 #define ZWP_TEXT_INPUT_V3_DISABLE 2
463 #define ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT 3
464 #define ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE 4
465 #define ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE 5
466 #define ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE 6
467 #define ZWP_TEXT_INPUT_V3_COMMIT 7
468 
469 /**
470  * @ingroup iface_zwp_text_input_v3
471  */
472 #define ZWP_TEXT_INPUT_V3_ENTER_SINCE_VERSION 1
473 /**
474  * @ingroup iface_zwp_text_input_v3
475  */
476 #define ZWP_TEXT_INPUT_V3_LEAVE_SINCE_VERSION 1
477 /**
478  * @ingroup iface_zwp_text_input_v3
479  */
480 #define ZWP_TEXT_INPUT_V3_PREEDIT_STRING_SINCE_VERSION 1
481 /**
482  * @ingroup iface_zwp_text_input_v3
483  */
484 #define ZWP_TEXT_INPUT_V3_COMMIT_STRING_SINCE_VERSION 1
485 /**
486  * @ingroup iface_zwp_text_input_v3
487  */
488 #define ZWP_TEXT_INPUT_V3_DELETE_SURROUNDING_TEXT_SINCE_VERSION 1
489 /**
490  * @ingroup iface_zwp_text_input_v3
491  */
492 #define ZWP_TEXT_INPUT_V3_DONE_SINCE_VERSION 1
493 
494 /**
495  * @ingroup iface_zwp_text_input_v3
496  */
497 #define ZWP_TEXT_INPUT_V3_DESTROY_SINCE_VERSION 1
498 /**
499  * @ingroup iface_zwp_text_input_v3
500  */
501 #define ZWP_TEXT_INPUT_V3_ENABLE_SINCE_VERSION 1
502 /**
503  * @ingroup iface_zwp_text_input_v3
504  */
505 #define ZWP_TEXT_INPUT_V3_DISABLE_SINCE_VERSION 1
506 /**
507  * @ingroup iface_zwp_text_input_v3
508  */
509 #define ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT_SINCE_VERSION 1
510 /**
511  * @ingroup iface_zwp_text_input_v3
512  */
513 #define ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE_SINCE_VERSION 1
514 /**
515  * @ingroup iface_zwp_text_input_v3
516  */
517 #define ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE_SINCE_VERSION 1
518 /**
519  * @ingroup iface_zwp_text_input_v3
520  */
521 #define ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE_SINCE_VERSION 1
522 /**
523  * @ingroup iface_zwp_text_input_v3
524  */
525 #define ZWP_TEXT_INPUT_V3_COMMIT_SINCE_VERSION 1
526 
527 /** @ingroup iface_zwp_text_input_v3 */
528 static inline void
zwp_text_input_v3_set_user_data(struct zwp_text_input_v3 * zwp_text_input_v3,void * user_data)529 zwp_text_input_v3_set_user_data(struct zwp_text_input_v3 *zwp_text_input_v3, void *user_data)
530 {
531 	wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_v3, user_data);
532 }
533 
534 /** @ingroup iface_zwp_text_input_v3 */
535 static inline void *
zwp_text_input_v3_get_user_data(struct zwp_text_input_v3 * zwp_text_input_v3)536 zwp_text_input_v3_get_user_data(struct zwp_text_input_v3 *zwp_text_input_v3)
537 {
538 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_v3);
539 }
540 
541 static inline uint32_t
zwp_text_input_v3_get_version(struct zwp_text_input_v3 * zwp_text_input_v3)542 zwp_text_input_v3_get_version(struct zwp_text_input_v3 *zwp_text_input_v3)
543 {
544 	return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3);
545 }
546 
547 /**
548  * @ingroup iface_zwp_text_input_v3
549  *
550  * Destroy the wp_text_input object. Also disables all surfaces enabled
551  * through this wp_text_input object.
552  */
553 static inline void
zwp_text_input_v3_destroy(struct zwp_text_input_v3 * zwp_text_input_v3)554 zwp_text_input_v3_destroy(struct zwp_text_input_v3 *zwp_text_input_v3)
555 {
556 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
557 			 ZWP_TEXT_INPUT_V3_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), WL_MARSHAL_FLAG_DESTROY);
558 }
559 
560 /**
561  * @ingroup iface_zwp_text_input_v3
562  *
563  * Requests text input on the surface previously obtained from the enter
564  * event.
565  *
566  * This request must be issued every time the active text input changes
567  * to a new one, including within the current surface. Use
568  * zwp_text_input_v3.disable when there is no longer any input focus on
569  * the current surface.
570  *
571  * Clients must not enable more than one text input on the single seat
572  * and should disable the current text input before enabling the new one.
573  * At most one instance of text input may be in enabled state per instance,
574  * Requests to enable the another text input when some text input is active
575  * must be ignored by compositor.
576  *
577  * This request resets all state associated with previous enable, disable,
578  * set_surrounding_text, set_text_change_cause, set_content_type, and
579  * set_cursor_rectangle requests, as well as the state associated with
580  * preedit_string, commit_string, and delete_surrounding_text events.
581  *
582  * The set_surrounding_text, set_content_type and set_cursor_rectangle
583  * requests must follow if the text input supports the necessary
584  * functionality.
585  *
586  * State set with this request is double-buffered. It will get applied on
587  * the next zwp_text_input_v3.commit request, and stay valid until the
588  * next committed enable or disable request.
589  *
590  * The changes must be applied by the compositor after issuing a
591  * zwp_text_input_v3.commit request.
592  */
593 static inline void
zwp_text_input_v3_enable(struct zwp_text_input_v3 * zwp_text_input_v3)594 zwp_text_input_v3_enable(struct zwp_text_input_v3 *zwp_text_input_v3)
595 {
596 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
597 			 ZWP_TEXT_INPUT_V3_ENABLE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0);
598 }
599 
600 /**
601  * @ingroup iface_zwp_text_input_v3
602  *
603  * Explicitly disable text input on the current surface (typically when
604  * there is no focus on any text entry inside the surface).
605  *
606  * State set with this request is double-buffered. It will get applied on
607  * the next zwp_text_input_v3.commit request.
608  */
609 static inline void
zwp_text_input_v3_disable(struct zwp_text_input_v3 * zwp_text_input_v3)610 zwp_text_input_v3_disable(struct zwp_text_input_v3 *zwp_text_input_v3)
611 {
612 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
613 			 ZWP_TEXT_INPUT_V3_DISABLE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0);
614 }
615 
616 /**
617  * @ingroup iface_zwp_text_input_v3
618  *
619  * Sets the surrounding plain text around the input, excluding the preedit
620  * text.
621  *
622  * The client should notify the compositor of any changes in any of the
623  * values carried with this request, including changes caused by handling
624  * incoming text-input events as well as changes caused by other
625  * mechanisms like keyboard typing.
626  *
627  * If the client is unaware of the text around the cursor, it should not
628  * issue this request, to signify lack of support to the compositor.
629  *
630  * Text is UTF-8 encoded, and should include the cursor position, the
631  * complete selection and additional characters before and after them.
632  * There is a maximum length of wayland messages, so text can not be
633  * longer than 4000 bytes.
634  *
635  * Cursor is the byte offset of the cursor within text buffer.
636  *
637  * Anchor is the byte offset of the selection anchor within text buffer.
638  * If there is no selected text, anchor is the same as cursor.
639  *
640  * If any preedit text is present, it is replaced with a cursor for the
641  * purpose of this event.
642  *
643  * Values set with this request are double-buffered. They will get applied
644  * on the next zwp_text_input_v3.commit request, and stay valid until the
645  * next committed enable or disable request.
646  *
647  * The initial state for affected fields is empty, meaning that the text
648  * input does not support sending surrounding text. If the empty values
649  * get applied, subsequent attempts to change them may have no effect.
650  */
651 static inline void
zwp_text_input_v3_set_surrounding_text(struct zwp_text_input_v3 * zwp_text_input_v3,const char * text,int32_t cursor,int32_t anchor)652 zwp_text_input_v3_set_surrounding_text(struct zwp_text_input_v3 *zwp_text_input_v3, const char *text, int32_t cursor, int32_t anchor)
653 {
654 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
655 			 ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, text, cursor, anchor);
656 }
657 
658 /**
659  * @ingroup iface_zwp_text_input_v3
660  *
661  * Tells the compositor why the text surrounding the cursor changed.
662  *
663  * Whenever the client detects an external change in text, cursor, or
664  * anchor posision, it must issue this request to the compositor. This
665  * request is intended to give the input method a chance to update the
666  * preedit text in an appropriate way, e.g. by removing it when the user
667  * starts typing with a keyboard.
668  *
669  * cause describes the source of the change.
670  *
671  * The value set with this request is double-buffered. It must be applied
672  * and reset to initial at the next zwp_text_input_v3.commit request.
673  *
674  * The initial value of cause is input_method.
675  */
676 static inline void
zwp_text_input_v3_set_text_change_cause(struct zwp_text_input_v3 * zwp_text_input_v3,uint32_t cause)677 zwp_text_input_v3_set_text_change_cause(struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t cause)
678 {
679 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
680 			 ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, cause);
681 }
682 
683 /**
684  * @ingroup iface_zwp_text_input_v3
685  *
686  * Sets the content purpose and content hint. While the purpose is the
687  * basic purpose of an input field, the hint flags allow to modify some of
688  * the behavior.
689  *
690  * Values set with this request are double-buffered. They will get applied
691  * on the next zwp_text_input_v3.commit request.
692  * Subsequent attempts to update them may have no effect. The values
693  * remain valid until the next committed enable or disable request.
694  *
695  * The initial value for hint is none, and the initial value for purpose
696  * is normal.
697  */
698 static inline void
zwp_text_input_v3_set_content_type(struct zwp_text_input_v3 * zwp_text_input_v3,uint32_t hint,uint32_t purpose)699 zwp_text_input_v3_set_content_type(struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t hint, uint32_t purpose)
700 {
701 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
702 			 ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, hint, purpose);
703 }
704 
705 /**
706  * @ingroup iface_zwp_text_input_v3
707  *
708  * Marks an area around the cursor as a x, y, width, height rectangle in
709  * surface local coordinates.
710  *
711  * Allows the compositor to put a window with word suggestions near the
712  * cursor, without obstructing the text being input.
713  *
714  * If the client is unaware of the position of edited text, it should not
715  * issue this request, to signify lack of support to the compositor.
716  *
717  * Values set with this request are double-buffered. They will get applied
718  * on the next zwp_text_input_v3.commit request, and stay valid until the
719  * next committed enable or disable request.
720  *
721  * The initial values describing a cursor rectangle are empty. That means
722  * the text input does not support describing the cursor area. If the
723  * empty values get applied, subsequent attempts to change them may have
724  * no effect.
725  */
726 static inline void
zwp_text_input_v3_set_cursor_rectangle(struct zwp_text_input_v3 * zwp_text_input_v3,int32_t x,int32_t y,int32_t width,int32_t height)727 zwp_text_input_v3_set_cursor_rectangle(struct zwp_text_input_v3 *zwp_text_input_v3, int32_t x, int32_t y, int32_t width, int32_t height)
728 {
729 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
730 			 ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, x, y, width, height);
731 }
732 
733 /**
734  * @ingroup iface_zwp_text_input_v3
735  *
736  * Atomically applies state changes recently sent to the compositor.
737  *
738  * The commit request establishes and updates the state of the client, and
739  * must be issued after any changes to apply them.
740  *
741  * Text input state (enabled status, content purpose, content hint,
742  * surrounding text and change cause, cursor rectangle) is conceptually
743  * double-buffered within the context of a text input, i.e. between a
744  * committed enable request and the following committed enable or disable
745  * request.
746  *
747  * Protocol requests modify the pending state, as opposed to the current
748  * state in use by the input method. A commit request atomically applies
749  * all pending state, replacing the current state. After commit, the new
750  * pending state is as documented for each related request.
751  *
752  * Requests are applied in the order of arrival.
753  *
754  * Neither current nor pending state are modified unless noted otherwise.
755  *
756  * The compositor must count the number of commit requests coming from
757  * each zwp_text_input_v3 object and use the count as the serial in done
758  * events.
759  */
760 static inline void
zwp_text_input_v3_commit(struct zwp_text_input_v3 * zwp_text_input_v3)761 zwp_text_input_v3_commit(struct zwp_text_input_v3 *zwp_text_input_v3)
762 {
763 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
764 			 ZWP_TEXT_INPUT_V3_COMMIT, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0);
765 }
766 
767 #define ZWP_TEXT_INPUT_MANAGER_V3_DESTROY 0
768 #define ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT 1
769 
770 
771 /**
772  * @ingroup iface_zwp_text_input_manager_v3
773  */
774 #define ZWP_TEXT_INPUT_MANAGER_V3_DESTROY_SINCE_VERSION 1
775 /**
776  * @ingroup iface_zwp_text_input_manager_v3
777  */
778 #define ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT_SINCE_VERSION 1
779 
780 /** @ingroup iface_zwp_text_input_manager_v3 */
781 static inline void
zwp_text_input_manager_v3_set_user_data(struct zwp_text_input_manager_v3 * zwp_text_input_manager_v3,void * user_data)782 zwp_text_input_manager_v3_set_user_data(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3, void *user_data)
783 {
784 	wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_manager_v3, user_data);
785 }
786 
787 /** @ingroup iface_zwp_text_input_manager_v3 */
788 static inline void *
zwp_text_input_manager_v3_get_user_data(struct zwp_text_input_manager_v3 * zwp_text_input_manager_v3)789 zwp_text_input_manager_v3_get_user_data(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
790 {
791 	return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_manager_v3);
792 }
793 
794 static inline uint32_t
zwp_text_input_manager_v3_get_version(struct zwp_text_input_manager_v3 * zwp_text_input_manager_v3)795 zwp_text_input_manager_v3_get_version(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
796 {
797 	return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_manager_v3);
798 }
799 
800 /**
801  * @ingroup iface_zwp_text_input_manager_v3
802  *
803  * Destroy the wp_text_input_manager object.
804  */
805 static inline void
zwp_text_input_manager_v3_destroy(struct zwp_text_input_manager_v3 * zwp_text_input_manager_v3)806 zwp_text_input_manager_v3_destroy(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
807 {
808 	wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_manager_v3,
809 			 ZWP_TEXT_INPUT_MANAGER_V3_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_manager_v3), WL_MARSHAL_FLAG_DESTROY);
810 }
811 
812 /**
813  * @ingroup iface_zwp_text_input_manager_v3
814  *
815  * Creates a new text-input object for a given seat.
816  */
817 static inline struct zwp_text_input_v3 *
zwp_text_input_manager_v3_get_text_input(struct zwp_text_input_manager_v3 * zwp_text_input_manager_v3,struct wl_seat * seat)818 zwp_text_input_manager_v3_get_text_input(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3, struct wl_seat *seat)
819 {
820 	struct wl_proxy *id;
821 
822 	id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_manager_v3,
823 			 ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT, &zwp_text_input_v3_interface, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_manager_v3), 0, NULL, seat);
824 
825 	return (struct zwp_text_input_v3 *) id;
826 }
827 
828 #ifdef  __cplusplus
829 }
830 #endif
831 
832 #endif
833