wayland_text_input.h raw
1 /* Generated by wayland-scanner 1.19.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 * When the seat has the keyboard capability the text-input focus
320 * follows the keyboard focus. This event sets the current surface
321 * for the text-input object.
322 */
323 void (*enter)(void *data,
324 struct zwp_text_input_v3 *zwp_text_input_v3,
325 struct wl_surface *surface);
326 /**
327 * leave event
328 *
329 * Notification that this seat's text-input focus is no longer on
330 * a certain surface. The client should reset any preedit string
331 * previously set.
332 *
333 * The leave notification clears the current surface. It is sent
334 * before the enter notification for the new focus.
335 *
336 * When the seat has the keyboard capability the text-input focus
337 * follows the keyboard focus.
338 */
339 void (*leave)(void *data,
340 struct zwp_text_input_v3 *zwp_text_input_v3,
341 struct wl_surface *surface);
342 /**
343 * pre-edit
344 *
345 * Notify when a new composing text (pre-edit) should be set at
346 * the current cursor position. Any previously set composing text
347 * must be removed. Any previously existing selected text must be
348 * removed.
349 *
350 * The argument text contains the pre-edit string buffer.
351 *
352 * The parameters cursor_begin and cursor_end are counted in bytes
353 * relative to the beginning of the submitted text buffer. Cursor
354 * should be hidden when both are equal to -1.
355 *
356 * They could be represented by the client as a line if both values
357 * are the same, or as a text highlight otherwise.
358 *
359 * Values set with this event are double-buffered. They must be
360 * applied and reset to initial on the next zwp_text_input_v3.done
361 * event.
362 *
363 * The initial value of text is an empty string, and cursor_begin,
364 * cursor_end and cursor_hidden are all 0.
365 */
366 void (*preedit_string)(void *data,
367 struct zwp_text_input_v3 *zwp_text_input_v3,
368 const char *text,
369 int32_t cursor_begin,
370 int32_t cursor_end);
371 /**
372 * text commit
373 *
374 * Notify when text should be inserted into the editor widget.
375 * The text to commit could be either just a single character after
376 * a key press or the result of some composing (pre-edit).
377 *
378 * Values set with this event are double-buffered. They must be
379 * applied and reset to initial on the next zwp_text_input_v3.done
380 * event.
381 *
382 * The initial value of text is an empty string.
383 */
384 void (*commit_string)(void *data,
385 struct zwp_text_input_v3 *zwp_text_input_v3,
386 const char *text);
387 /**
388 * delete surrounding text
389 *
390 * Notify when the text around the current cursor position should
391 * be deleted.
392 *
393 * Before_length and after_length are the number of bytes before
394 * and after the current cursor index (excluding the selection) to
395 * delete.
396 *
397 * If a preedit text is present, in effect before_length is counted
398 * from the beginning of it, and after_length from its end (see
399 * done event sequence).
400 *
401 * Values set with this event are double-buffered. They must be
402 * applied and reset to initial on the next zwp_text_input_v3.done
403 * event.
404 *
405 * The initial values of both before_length and after_length are 0.
406 * @param before_length length of text before current cursor position
407 * @param after_length length of text after current cursor position
408 */
409 void (*delete_surrounding_text)(void *data,
410 struct zwp_text_input_v3 *zwp_text_input_v3,
411 uint32_t before_length,
412 uint32_t after_length);
413 /**
414 * apply changes
415 *
416 * Instruct the application to apply changes to state requested
417 * by the preedit_string, commit_string and delete_surrounding_text
418 * events. The state relating to these events is double-buffered,
419 * and each one modifies the pending state. This event replaces the
420 * current state with the pending state.
421 *
422 * The application must proceed by evaluating the changes in the
423 * following order:
424 *
425 * 1. Replace existing preedit string with the cursor. 2. Delete
426 * requested surrounding text. 3. Insert commit string with the
427 * cursor at its end. 4. Calculate surrounding text to send. 5.
428 * Insert new preedit text in cursor position. 6. Place cursor
429 * inside preedit text.
430 *
431 * The serial number reflects the last state of the
432 * zwp_text_input_v3 object known to the compositor. The value of
433 * the serial argument must be equal to the number of commit
434 * requests already issued on that object. When the client receives
435 * a done event with a serial different than the number of past
436 * commit requests, it must proceed as normal, except it should not
437 * change the current state of the zwp_text_input_v3 object.
438 */
439 void (*done)(void *data,
440 struct zwp_text_input_v3 *zwp_text_input_v3,
441 uint32_t serial);
442 };
443
444 /**
445 * @ingroup iface_zwp_text_input_v3
446 */
447 static inline int
448 zwp_text_input_v3_add_listener(struct zwp_text_input_v3 *zwp_text_input_v3,
449 const struct zwp_text_input_v3_listener *listener, void *data)
450 {
451 return wl_proxy_add_listener((struct wl_proxy *) zwp_text_input_v3,
452 (void (**)(void)) listener, data);
453 }
454
455 #define ZWP_TEXT_INPUT_V3_DESTROY 0
456 #define ZWP_TEXT_INPUT_V3_ENABLE 1
457 #define ZWP_TEXT_INPUT_V3_DISABLE 2
458 #define ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT 3
459 #define ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE 4
460 #define ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE 5
461 #define ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE 6
462 #define ZWP_TEXT_INPUT_V3_COMMIT 7
463
464 /**
465 * @ingroup iface_zwp_text_input_v3
466 */
467 #define ZWP_TEXT_INPUT_V3_ENTER_SINCE_VERSION 1
468 /**
469 * @ingroup iface_zwp_text_input_v3
470 */
471 #define ZWP_TEXT_INPUT_V3_LEAVE_SINCE_VERSION 1
472 /**
473 * @ingroup iface_zwp_text_input_v3
474 */
475 #define ZWP_TEXT_INPUT_V3_PREEDIT_STRING_SINCE_VERSION 1
476 /**
477 * @ingroup iface_zwp_text_input_v3
478 */
479 #define ZWP_TEXT_INPUT_V3_COMMIT_STRING_SINCE_VERSION 1
480 /**
481 * @ingroup iface_zwp_text_input_v3
482 */
483 #define ZWP_TEXT_INPUT_V3_DELETE_SURROUNDING_TEXT_SINCE_VERSION 1
484 /**
485 * @ingroup iface_zwp_text_input_v3
486 */
487 #define ZWP_TEXT_INPUT_V3_DONE_SINCE_VERSION 1
488
489 /**
490 * @ingroup iface_zwp_text_input_v3
491 */
492 #define ZWP_TEXT_INPUT_V3_DESTROY_SINCE_VERSION 1
493 /**
494 * @ingroup iface_zwp_text_input_v3
495 */
496 #define ZWP_TEXT_INPUT_V3_ENABLE_SINCE_VERSION 1
497 /**
498 * @ingroup iface_zwp_text_input_v3
499 */
500 #define ZWP_TEXT_INPUT_V3_DISABLE_SINCE_VERSION 1
501 /**
502 * @ingroup iface_zwp_text_input_v3
503 */
504 #define ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT_SINCE_VERSION 1
505 /**
506 * @ingroup iface_zwp_text_input_v3
507 */
508 #define ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE_SINCE_VERSION 1
509 /**
510 * @ingroup iface_zwp_text_input_v3
511 */
512 #define ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE_SINCE_VERSION 1
513 /**
514 * @ingroup iface_zwp_text_input_v3
515 */
516 #define ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE_SINCE_VERSION 1
517 /**
518 * @ingroup iface_zwp_text_input_v3
519 */
520 #define ZWP_TEXT_INPUT_V3_COMMIT_SINCE_VERSION 1
521
522 /** @ingroup iface_zwp_text_input_v3 */
523 static inline void
524 zwp_text_input_v3_set_user_data(struct zwp_text_input_v3 *zwp_text_input_v3, void *user_data)
525 {
526 wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_v3, user_data);
527 }
528
529 /** @ingroup iface_zwp_text_input_v3 */
530 static inline void *
531 zwp_text_input_v3_get_user_data(struct zwp_text_input_v3 *zwp_text_input_v3)
532 {
533 return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_v3);
534 }
535
536 static inline uint32_t
537 zwp_text_input_v3_get_version(struct zwp_text_input_v3 *zwp_text_input_v3)
538 {
539 return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3);
540 }
541
542 /**
543 * @ingroup iface_zwp_text_input_v3
544 *
545 * Destroy the wp_text_input object. Also disables all surfaces enabled
546 * through this wp_text_input object.
547 */
548 static inline void
549 zwp_text_input_v3_destroy(struct zwp_text_input_v3 *zwp_text_input_v3)
550 {
551 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
552 ZWP_TEXT_INPUT_V3_DESTROY);
553
554 wl_proxy_destroy((struct wl_proxy *) zwp_text_input_v3);
555 }
556
557 /**
558 * @ingroup iface_zwp_text_input_v3
559 *
560 * Requests text input on the surface previously obtained from the enter
561 * event.
562 *
563 * This request must be issued every time the active text input changes
564 * to a new one, including within the current surface. Use
565 * zwp_text_input_v3.disable when there is no longer any input focus on
566 * the current surface.
567 *
568 * This request resets all state associated with previous enable, disable,
569 * set_surrounding_text, set_text_change_cause, set_content_type, and
570 * set_cursor_rectangle requests, as well as the state associated with
571 * preedit_string, commit_string, and delete_surrounding_text events.
572 *
573 * The set_surrounding_text, set_content_type and set_cursor_rectangle
574 * requests must follow if the text input supports the necessary
575 * functionality.
576 *
577 * State set with this request is double-buffered. It will get applied on
578 * the next zwp_text_input_v3.commit request, and stay valid until the
579 * next committed enable or disable request.
580 *
581 * The changes must be applied by the compositor after issuing a
582 * zwp_text_input_v3.commit request.
583 */
584 static inline void
585 zwp_text_input_v3_enable(struct zwp_text_input_v3 *zwp_text_input_v3)
586 {
587 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
588 ZWP_TEXT_INPUT_V3_ENABLE);
589 }
590
591 /**
592 * @ingroup iface_zwp_text_input_v3
593 *
594 * Explicitly disable text input on the current surface (typically when
595 * there is no focus on any text entry inside the surface).
596 *
597 * State set with this request is double-buffered. It will get applied on
598 * the next zwp_text_input_v3.commit request.
599 */
600 static inline void
601 zwp_text_input_v3_disable(struct zwp_text_input_v3 *zwp_text_input_v3)
602 {
603 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
604 ZWP_TEXT_INPUT_V3_DISABLE);
605 }
606
607 /**
608 * @ingroup iface_zwp_text_input_v3
609 *
610 * Sets the surrounding plain text around the input, excluding the preedit
611 * text.
612 *
613 * The client should notify the compositor of any changes in any of the
614 * values carried with this request, including changes caused by handling
615 * incoming text-input events as well as changes caused by other
616 * mechanisms like keyboard typing.
617 *
618 * If the client is unaware of the text around the cursor, it should not
619 * issue this request, to signify lack of support to the compositor.
620 *
621 * Text is UTF-8 encoded, and should include the cursor position, the
622 * complete selection and additional characters before and after them.
623 * There is a maximum length of wayland messages, so text can not be
624 * longer than 4000 bytes.
625 *
626 * Cursor is the byte offset of the cursor within text buffer.
627 *
628 * Anchor is the byte offset of the selection anchor within text buffer.
629 * If there is no selected text, anchor is the same as cursor.
630 *
631 * If any preedit text is present, it is replaced with a cursor for the
632 * purpose of this event.
633 *
634 * Values set with this request are double-buffered. They will get applied
635 * on the next zwp_text_input_v3.commit request, and stay valid until the
636 * next committed enable or disable request.
637 *
638 * The initial state for affected fields is empty, meaning that the text
639 * input does not support sending surrounding text. If the empty values
640 * get applied, subsequent attempts to change them may have no effect.
641 */
642 static inline void
643 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)
644 {
645 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
646 ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT, text, cursor, anchor);
647 }
648
649 /**
650 * @ingroup iface_zwp_text_input_v3
651 *
652 * Tells the compositor why the text surrounding the cursor changed.
653 *
654 * Whenever the client detects an external change in text, cursor, or
655 * anchor posision, it must issue this request to the compositor. This
656 * request is intended to give the input method a chance to update the
657 * preedit text in an appropriate way, e.g. by removing it when the user
658 * starts typing with a keyboard.
659 *
660 * cause describes the source of the change.
661 *
662 * The value set with this request is double-buffered. It must be applied
663 * and reset to initial at the next zwp_text_input_v3.commit request.
664 *
665 * The initial value of cause is input_method.
666 */
667 static inline void
668 zwp_text_input_v3_set_text_change_cause(struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t cause)
669 {
670 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
671 ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE, cause);
672 }
673
674 /**
675 * @ingroup iface_zwp_text_input_v3
676 *
677 * Sets the content purpose and content hint. While the purpose is the
678 * basic purpose of an input field, the hint flags allow to modify some of
679 * the behavior.
680 *
681 * Values set with this request are double-buffered. They will get applied
682 * on the next zwp_text_input_v3.commit request.
683 * Subsequent attempts to update them may have no effect. The values
684 * remain valid until the next committed enable or disable request.
685 *
686 * The initial value for hint is none, and the initial value for purpose
687 * is normal.
688 */
689 static inline void
690 zwp_text_input_v3_set_content_type(struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t hint, uint32_t purpose)
691 {
692 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
693 ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE, hint, purpose);
694 }
695
696 /**
697 * @ingroup iface_zwp_text_input_v3
698 *
699 * Marks an area around the cursor as a x, y, width, height rectangle in
700 * surface local coordinates.
701 *
702 * Allows the compositor to put a window with word suggestions near the
703 * cursor, without obstructing the text being input.
704 *
705 * If the client is unaware of the position of edited text, it should not
706 * issue this request, to signify lack of support to the compositor.
707 *
708 * Values set with this request are double-buffered. They will get applied
709 * on the next zwp_text_input_v3.commit request, and stay valid until the
710 * next committed enable or disable request.
711 *
712 * The initial values describing a cursor rectangle are empty. That means
713 * the text input does not support describing the cursor area. If the
714 * empty values get applied, subsequent attempts to change them may have
715 * no effect.
716 */
717 static inline void
718 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)
719 {
720 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
721 ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE, x, y, width, height);
722 }
723
724 /**
725 * @ingroup iface_zwp_text_input_v3
726 *
727 * Atomically applies state changes recently sent to the compositor.
728 *
729 * The commit request establishes and updates the state of the client, and
730 * must be issued after any changes to apply them.
731 *
732 * Text input state (enabled status, content purpose, content hint,
733 * surrounding text and change cause, cursor rectangle) is conceptually
734 * double-buffered within the context of a text input, i.e. between a
735 * committed enable request and the following committed enable or disable
736 * request.
737 *
738 * Protocol requests modify the pending state, as opposed to the current
739 * state in use by the input method. A commit request atomically applies
740 * all pending state, replacing the current state. After commit, the new
741 * pending state is as documented for each related request.
742 *
743 * Requests are applied in the order of arrival.
744 *
745 * Neither current nor pending state are modified unless noted otherwise.
746 *
747 * The compositor must count the number of commit requests coming from
748 * each zwp_text_input_v3 object and use the count as the serial in done
749 * events.
750 */
751 static inline void
752 zwp_text_input_v3_commit(struct zwp_text_input_v3 *zwp_text_input_v3)
753 {
754 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v3,
755 ZWP_TEXT_INPUT_V3_COMMIT);
756 }
757
758 #define ZWP_TEXT_INPUT_MANAGER_V3_DESTROY 0
759 #define ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT 1
760
761
762 /**
763 * @ingroup iface_zwp_text_input_manager_v3
764 */
765 #define ZWP_TEXT_INPUT_MANAGER_V3_DESTROY_SINCE_VERSION 1
766 /**
767 * @ingroup iface_zwp_text_input_manager_v3
768 */
769 #define ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT_SINCE_VERSION 1
770
771 /** @ingroup iface_zwp_text_input_manager_v3 */
772 static inline void
773 zwp_text_input_manager_v3_set_user_data(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3, void *user_data)
774 {
775 wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_manager_v3, user_data);
776 }
777
778 /** @ingroup iface_zwp_text_input_manager_v3 */
779 static inline void *
780 zwp_text_input_manager_v3_get_user_data(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
781 {
782 return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_manager_v3);
783 }
784
785 static inline uint32_t
786 zwp_text_input_manager_v3_get_version(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
787 {
788 return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_manager_v3);
789 }
790
791 /**
792 * @ingroup iface_zwp_text_input_manager_v3
793 *
794 * Destroy the wp_text_input_manager object.
795 */
796 static inline void
797 zwp_text_input_manager_v3_destroy(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
798 {
799 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_manager_v3,
800 ZWP_TEXT_INPUT_MANAGER_V3_DESTROY);
801
802 wl_proxy_destroy((struct wl_proxy *) zwp_text_input_manager_v3);
803 }
804
805 /**
806 * @ingroup iface_zwp_text_input_manager_v3
807 *
808 * Creates a new text-input object for a given seat.
809 */
810 static inline struct zwp_text_input_v3 *
811 zwp_text_input_manager_v3_get_text_input(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3, struct wl_seat *seat)
812 {
813 struct wl_proxy *id;
814
815 id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_text_input_manager_v3,
816 ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT, &zwp_text_input_v3_interface, NULL, seat);
817
818 return (struct zwp_text_input_v3 *) id;
819 }
820
821 #ifdef __cplusplus
822 }
823 #endif
824
825 #endif
826