Debian Codegraph @

client/wayland/text-input-unstable-v3-client-protocol.h

raw
1 /* Generated by wayland-scanner 1.24.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.
440 *
441 * When the client receives a done event with a serial different
442 * than the number of past commit requests, it must proceed with
443 * evaluating and applying the changes as normal, except it should
444 * not change the current state of the zwp_text_input_v3 object.
445 * All pending state requests (set_surrounding_text,
446 * set_content_type and set_cursor_rectangle) on the
447 * zwp_text_input_v3 object should be sent and committed after
448 * receiving a zwp_text_input_v3.done event with a matching serial.
449 */
450 void (*done)(void *data,
451 struct zwp_text_input_v3 *zwp_text_input_v3,
452 uint32_t serial);
453 };
454
455 /**
456 * @ingroup iface_zwp_text_input_v3
457 */
458 static inline int
459 zwp_text_input_v3_add_listener(struct zwp_text_input_v3 *zwp_text_input_v3,
460 const struct zwp_text_input_v3_listener *listener, void *data)
461 {
462 return wl_proxy_add_listener((struct wl_proxy *) zwp_text_input_v3,
463 (void (**)(void)) listener, data);
464 }
465
466 #define ZWP_TEXT_INPUT_V3_DESTROY 0
467 #define ZWP_TEXT_INPUT_V3_ENABLE 1
468 #define ZWP_TEXT_INPUT_V3_DISABLE 2
469 #define ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT 3
470 #define ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE 4
471 #define ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE 5
472 #define ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE 6
473 #define ZWP_TEXT_INPUT_V3_COMMIT 7
474
475 /**
476 * @ingroup iface_zwp_text_input_v3
477 */
478 #define ZWP_TEXT_INPUT_V3_ENTER_SINCE_VERSION 1
479 /**
480 * @ingroup iface_zwp_text_input_v3
481 */
482 #define ZWP_TEXT_INPUT_V3_LEAVE_SINCE_VERSION 1
483 /**
484 * @ingroup iface_zwp_text_input_v3
485 */
486 #define ZWP_TEXT_INPUT_V3_PREEDIT_STRING_SINCE_VERSION 1
487 /**
488 * @ingroup iface_zwp_text_input_v3
489 */
490 #define ZWP_TEXT_INPUT_V3_COMMIT_STRING_SINCE_VERSION 1
491 /**
492 * @ingroup iface_zwp_text_input_v3
493 */
494 #define ZWP_TEXT_INPUT_V3_DELETE_SURROUNDING_TEXT_SINCE_VERSION 1
495 /**
496 * @ingroup iface_zwp_text_input_v3
497 */
498 #define ZWP_TEXT_INPUT_V3_DONE_SINCE_VERSION 1
499
500 /**
501 * @ingroup iface_zwp_text_input_v3
502 */
503 #define ZWP_TEXT_INPUT_V3_DESTROY_SINCE_VERSION 1
504 /**
505 * @ingroup iface_zwp_text_input_v3
506 */
507 #define ZWP_TEXT_INPUT_V3_ENABLE_SINCE_VERSION 1
508 /**
509 * @ingroup iface_zwp_text_input_v3
510 */
511 #define ZWP_TEXT_INPUT_V3_DISABLE_SINCE_VERSION 1
512 /**
513 * @ingroup iface_zwp_text_input_v3
514 */
515 #define ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT_SINCE_VERSION 1
516 /**
517 * @ingroup iface_zwp_text_input_v3
518 */
519 #define ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE_SINCE_VERSION 1
520 /**
521 * @ingroup iface_zwp_text_input_v3
522 */
523 #define ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE_SINCE_VERSION 1
524 /**
525 * @ingroup iface_zwp_text_input_v3
526 */
527 #define ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE_SINCE_VERSION 1
528 /**
529 * @ingroup iface_zwp_text_input_v3
530 */
531 #define ZWP_TEXT_INPUT_V3_COMMIT_SINCE_VERSION 1
532
533 /** @ingroup iface_zwp_text_input_v3 */
534 static inline void
535 zwp_text_input_v3_set_user_data(struct zwp_text_input_v3 *zwp_text_input_v3, void *user_data)
536 {
537 wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_v3, user_data);
538 }
539
540 /** @ingroup iface_zwp_text_input_v3 */
541 static inline void *
542 zwp_text_input_v3_get_user_data(struct zwp_text_input_v3 *zwp_text_input_v3)
543 {
544 return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_v3);
545 }
546
547 static inline uint32_t
548 zwp_text_input_v3_get_version(struct zwp_text_input_v3 *zwp_text_input_v3)
549 {
550 return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3);
551 }
552
553 /**
554 * @ingroup iface_zwp_text_input_v3
555 *
556 * Destroy the wp_text_input object. Also disables all surfaces enabled
557 * through this wp_text_input object.
558 */
559 static inline void
560 zwp_text_input_v3_destroy(struct zwp_text_input_v3 *zwp_text_input_v3)
561 {
562 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
563 ZWP_TEXT_INPUT_V3_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), WL_MARSHAL_FLAG_DESTROY);
564 }
565
566 /**
567 * @ingroup iface_zwp_text_input_v3
568 *
569 * Requests text input on the surface previously obtained from the enter
570 * event.
571 *
572 * This request must be issued every time the focused text input changes
573 * to a new one, including within the current surface. Use
574 * zwp_text_input_v3.disable when there is no longer any input focus on
575 * the current surface.
576 *
577 * Clients must not enable more than one text input on the single seat
578 * and should disable the current text input before enabling the new one.
579 * Requests to enable a text input when another text input is enabled
580 * on the same seat must be ignored by compositor.
581 *
582 * This request resets all state associated with previous enable, disable,
583 * set_surrounding_text, set_text_change_cause, set_content_type, and
584 * set_cursor_rectangle requests, as well as the state associated with
585 * preedit_string, commit_string, and delete_surrounding_text events.
586 *
587 * The set_surrounding_text, set_content_type and set_cursor_rectangle
588 * requests must follow if the text input supports the necessary
589 * functionality.
590 *
591 * State set with this request is double-buffered. It will get applied on
592 * the next zwp_text_input_v3.commit request, and stay valid until the
593 * next committed enable or disable request.
594 *
595 * The changes must be applied by the compositor after issuing a
596 * zwp_text_input_v3.commit request.
597 */
598 static inline void
599 zwp_text_input_v3_enable(struct zwp_text_input_v3 *zwp_text_input_v3)
600 {
601 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
602 ZWP_TEXT_INPUT_V3_ENABLE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0);
603 }
604
605 /**
606 * @ingroup iface_zwp_text_input_v3
607 *
608 * Explicitly disable text input on the current surface (typically when
609 * there is no focus on any text entry inside the surface).
610 *
611 * State set with this request is double-buffered. It will get applied on
612 * the next zwp_text_input_v3.commit request.
613 */
614 static inline void
615 zwp_text_input_v3_disable(struct zwp_text_input_v3 *zwp_text_input_v3)
616 {
617 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
618 ZWP_TEXT_INPUT_V3_DISABLE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0);
619 }
620
621 /**
622 * @ingroup iface_zwp_text_input_v3
623 *
624 * Sets the surrounding plain text around the input, excluding the preedit
625 * text.
626 *
627 * The client should notify the compositor of any changes in any of the
628 * values carried with this request, including changes caused by handling
629 * incoming text-input events as well as changes caused by other
630 * mechanisms like keyboard typing.
631 *
632 * If the client is unaware of the text around the cursor, it should not
633 * issue this request, to signify lack of support to the compositor.
634 *
635 * Text is UTF-8 encoded, and should include the cursor position, the
636 * complete selection and additional characters before and after them.
637 * There is a maximum length of wayland messages, so text can not be
638 * longer than 4000 bytes.
639 *
640 * Cursor is the byte offset of the cursor within text buffer.
641 *
642 * Anchor is the byte offset of the selection anchor within text buffer.
643 * If there is no selected text, anchor is the same as cursor.
644 *
645 * If any preedit text is present, it is replaced with a cursor for the
646 * purpose of this event.
647 *
648 * Values set with this request are double-buffered. They will get applied
649 * on the next zwp_text_input_v3.commit request, and stay valid until the
650 * next committed enable or disable request.
651 *
652 * The initial state for affected fields is empty, meaning that the text
653 * input does not support sending surrounding text. If the empty values
654 * get applied, subsequent attempts to change them may have no effect.
655 */
656 static inline void
657 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)
658 {
659 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
660 ZWP_TEXT_INPUT_V3_SET_SURROUNDING_TEXT, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, text, cursor, anchor);
661 }
662
663 /**
664 * @ingroup iface_zwp_text_input_v3
665 *
666 * Tells the compositor why the text surrounding the cursor changed.
667 *
668 * Whenever the client detects an external change in text, cursor, or
669 * anchor posision, it must issue this request to the compositor. This
670 * request is intended to give the input method a chance to update the
671 * preedit text in an appropriate way, e.g. by removing it when the user
672 * starts typing with a keyboard.
673 *
674 * cause describes the source of the change.
675 *
676 * The value set with this request is double-buffered. It must be applied
677 * and reset to initial at the next zwp_text_input_v3.commit request.
678 *
679 * The initial value of cause is input_method.
680 */
681 static inline void
682 zwp_text_input_v3_set_text_change_cause(struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t cause)
683 {
684 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
685 ZWP_TEXT_INPUT_V3_SET_TEXT_CHANGE_CAUSE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, cause);
686 }
687
688 /**
689 * @ingroup iface_zwp_text_input_v3
690 *
691 * Sets the content purpose and content hint. While the purpose is the
692 * basic purpose of an input field, the hint flags allow to modify some of
693 * the behavior.
694 *
695 * Values set with this request are double-buffered. They will get applied
696 * on the next zwp_text_input_v3.commit request.
697 * Subsequent attempts to update them may have no effect. The values
698 * remain valid until the next committed enable or disable request.
699 *
700 * The initial value for hint is none, and the initial value for purpose
701 * is normal.
702 */
703 static inline void
704 zwp_text_input_v3_set_content_type(struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t hint, uint32_t purpose)
705 {
706 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
707 ZWP_TEXT_INPUT_V3_SET_CONTENT_TYPE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, hint, purpose);
708 }
709
710 /**
711 * @ingroup iface_zwp_text_input_v3
712 *
713 * Marks an area around the cursor as a x, y, width, height rectangle in
714 * surface local coordinates.
715 *
716 * Allows the compositor to put a window with word suggestions near the
717 * cursor, without obstructing the text being input.
718 *
719 * If the client is unaware of the position of edited text, it should not
720 * issue this request, to signify lack of support to the compositor.
721 *
722 * Values set with this request are double-buffered. They will get applied
723 * on the next zwp_text_input_v3.commit request, and stay valid until the
724 * next committed enable or disable request.
725 *
726 * The initial values describing a cursor rectangle are empty. That means
727 * the text input does not support describing the cursor area. If the
728 * empty values get applied, subsequent attempts to change them may have
729 * no effect.
730 */
731 static inline void
732 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)
733 {
734 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
735 ZWP_TEXT_INPUT_V3_SET_CURSOR_RECTANGLE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0, x, y, width, height);
736 }
737
738 /**
739 * @ingroup iface_zwp_text_input_v3
740 *
741 * Atomically applies state changes recently sent to the compositor.
742 *
743 * The commit request establishes and updates the state of the client, and
744 * must be issued after any changes to apply them.
745 *
746 * Text input state (enabled status, content purpose, content hint,
747 * surrounding text and change cause, cursor rectangle) is conceptually
748 * double-buffered within the context of a text input, i.e. between a
749 * committed enable request and the following committed enable or disable
750 * request.
751 *
752 * Protocol requests modify the pending state, as opposed to the current
753 * state in use by the input method. A commit request atomically applies
754 * all pending state, replacing the current state. After commit, the new
755 * pending state is as documented for each related request.
756 *
757 * Requests are applied in the order of arrival.
758 *
759 * Neither current nor pending state are modified unless noted otherwise.
760 *
761 * The compositor must count the number of commit requests coming from
762 * each zwp_text_input_v3 object and use the count as the serial in done
763 * events.
764 */
765 static inline void
766 zwp_text_input_v3_commit(struct zwp_text_input_v3 *zwp_text_input_v3)
767 {
768 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_v3,
769 ZWP_TEXT_INPUT_V3_COMMIT, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v3), 0);
770 }
771
772 #define ZWP_TEXT_INPUT_MANAGER_V3_DESTROY 0
773 #define ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT 1
774
775
776 /**
777 * @ingroup iface_zwp_text_input_manager_v3
778 */
779 #define ZWP_TEXT_INPUT_MANAGER_V3_DESTROY_SINCE_VERSION 1
780 /**
781 * @ingroup iface_zwp_text_input_manager_v3
782 */
783 #define ZWP_TEXT_INPUT_MANAGER_V3_GET_TEXT_INPUT_SINCE_VERSION 1
784
785 /** @ingroup iface_zwp_text_input_manager_v3 */
786 static inline void
787 zwp_text_input_manager_v3_set_user_data(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3, void *user_data)
788 {
789 wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_manager_v3, user_data);
790 }
791
792 /** @ingroup iface_zwp_text_input_manager_v3 */
793 static inline void *
794 zwp_text_input_manager_v3_get_user_data(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
795 {
796 return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_manager_v3);
797 }
798
799 static inline uint32_t
800 zwp_text_input_manager_v3_get_version(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
801 {
802 return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_manager_v3);
803 }
804
805 /**
806 * @ingroup iface_zwp_text_input_manager_v3
807 *
808 * Destroy the wp_text_input_manager object.
809 */
810 static inline void
811 zwp_text_input_manager_v3_destroy(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3)
812 {
813 wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_manager_v3,
814 ZWP_TEXT_INPUT_MANAGER_V3_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_text_input_manager_v3), WL_MARSHAL_FLAG_DESTROY);
815 }
816
817 /**
818 * @ingroup iface_zwp_text_input_manager_v3
819 *
820 * Creates a new text-input object for a given seat.
821 */
822 static inline struct zwp_text_input_v3 *
823 zwp_text_input_manager_v3_get_text_input(struct zwp_text_input_manager_v3 *zwp_text_input_manager_v3, struct wl_seat *seat)
824 {
825 struct wl_proxy *id;
826
827 id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_text_input_manager_v3,
828 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);
829
830 return (struct zwp_text_input_v3 *) id;
831 }
832
833 #ifdef __cplusplus
834 }
835 #endif
836
837 #endif