Debian Codegraph @

wayland/qtwayland-dev/5.15.1/QtWaylandClient/private/wayland-text-input-unstable-v2-client-protocol.h

raw symbols SCIP
1 /* Generated by wayland-scanner 1.16.0 */
2
3 #ifndef TEXT_INPUT_UNSTABLE_V2_CLIENT_PROTOCOL_H
4 #define TEXT_INPUT_UNSTABLE_V2_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_v2 The text_input_unstable_v2 protocol
16 * @section page_ifaces_text_input_unstable_v2 Interfaces
17 * - @subpage page_iface_zwp_text_input_v2 - text input
18 * - @subpage page_iface_zwp_text_input_manager_v2 - text input manager
19 * @section page_copyright_text_input_unstable_v2 Copyright
20 * <pre>
21 *
22 * Copyright © 2012, 2013 Intel Corporation
23 * Copyright © 2015, 2016 Jan Arne Petersen
24 *
25 * Permission to use, copy, modify, distribute, and sell this
26 * software and its documentation for any purpose is hereby granted
27 * without fee, provided that the above copyright notice appear in
28 * all copies and that both that copyright notice and this permission
29 * notice appear in supporting documentation, and that the name of
30 * the copyright holders not be used in advertising or publicity
31 * pertaining to distribution of the software without specific,
32 * written prior permission. The copyright holders make no
33 * representations about the suitability of this software for any
34 * purpose. It is provided "as is" without express or implied
35 * warranty.
36 *
37 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
38 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
39 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
40 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
41 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
42 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
44 * THIS SOFTWARE.
45 * </pre>
46 */
47 struct wl_seat;
48 struct wl_surface;
49 struct zwp_text_input_manager_v2;
50 struct zwp_text_input_v2;
51
52 /**
53 * @page page_iface_zwp_text_input_v2 zwp_text_input_v2
54 * @section page_iface_zwp_text_input_v2_desc Description
55 *
56 * The zwp_text_input_v2 interface represents text input and input methods
57 * associated with a seat. It provides enter/leave events to follow the
58 * text input focus for a seat.
59 *
60 * Requests are used to enable/disable the text-input object and set
61 * state information like surrounding and selected text or the content type.
62 * The information about the entered text is sent to the text-input object
63 * via the pre-edit and commit events. Using this interface removes the need
64 * for applications to directly process hardware key events and compose text
65 * out of them.
66 *
67 * Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices
68 * have to always point to the first byte of an UTF-8 encoded code point.
69 * Lengths are not allowed to contain just a part of an UTF-8 encoded code
70 * point.
71 *
72 * State is sent by the state requests (set_surrounding_text,
73 * set_content_type, set_cursor_rectangle and set_preferred_language) and
74 * an update_state request. After an enter or an input_method_change event
75 * all state information is invalidated and needs to be resent from the
76 * client. A reset or entering a new widget on client side also
77 * invalidates all current state information.
78 * @section page_iface_zwp_text_input_v2_api API
79 * See @ref iface_zwp_text_input_v2.
80 */
81 /**
82 * @defgroup iface_zwp_text_input_v2 The zwp_text_input_v2 interface
83 *
84 * The zwp_text_input_v2 interface represents text input and input methods
85 * associated with a seat. It provides enter/leave events to follow the
86 * text input focus for a seat.
87 *
88 * Requests are used to enable/disable the text-input object and set
89 * state information like surrounding and selected text or the content type.
90 * The information about the entered text is sent to the text-input object
91 * via the pre-edit and commit events. Using this interface removes the need
92 * for applications to directly process hardware key events and compose text
93 * out of them.
94 *
95 * Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices
96 * have to always point to the first byte of an UTF-8 encoded code point.
97 * Lengths are not allowed to contain just a part of an UTF-8 encoded code
98 * point.
99 *
100 * State is sent by the state requests (set_surrounding_text,
101 * set_content_type, set_cursor_rectangle and set_preferred_language) and
102 * an update_state request. After an enter or an input_method_change event
103 * all state information is invalidated and needs to be resent from the
104 * client. A reset or entering a new widget on client side also
105 * invalidates all current state information.
106 */
107 extern const struct wl_interface zwp_text_input_v2_interface;
108 /**
109 * @page page_iface_zwp_text_input_manager_v2 zwp_text_input_manager_v2
110 * @section page_iface_zwp_text_input_manager_v2_desc Description
111 *
112 * A factory for text-input objects. This object is a global singleton.
113 * @section page_iface_zwp_text_input_manager_v2_api API
114 * See @ref iface_zwp_text_input_manager_v2.
115 */
116 /**
117 * @defgroup iface_zwp_text_input_manager_v2 The zwp_text_input_manager_v2 interface
118 *
119 * A factory for text-input objects. This object is a global singleton.
120 */
121 extern const struct wl_interface zwp_text_input_manager_v2_interface;
122
123 #ifndef ZWP_TEXT_INPUT_V2_CONTENT_HINT_ENUM
124 #define ZWP_TEXT_INPUT_V2_CONTENT_HINT_ENUM
125 /**
126 * @ingroup iface_zwp_text_input_v2
127 * content hint
128 *
129 * Content hint is a bitmask to allow to modify the behavior of the text
130 * input.
131 */
132 enum zwp_text_input_v2_content_hint {
133 /**
134 * no special behaviour
135 */
136 ZWP_TEXT_INPUT_V2_CONTENT_HINT_NONE = 0x0,
137 /**
138 * suggest word completions
139 */
140 ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_COMPLETION = 0x1,
141 /**
142 * suggest word corrections
143 */
144 ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CORRECTION = 0x2,
145 /**
146 * switch to uppercase letters at the start of a sentence
147 */
148 ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CAPITALIZATION = 0x4,
149 /**
150 * prefer lowercase letters
151 */
152 ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE = 0x8,
153 /**
154 * prefer uppercase letters
155 */
156 ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE = 0x10,
157 /**
158 * prefer casing for titles and headings (can be language dependent)
159 */
160 ZWP_TEXT_INPUT_V2_CONTENT_HINT_TITLECASE = 0x20,
161 /**
162 * characters should be hidden
163 */
164 ZWP_TEXT_INPUT_V2_CONTENT_HINT_HIDDEN_TEXT = 0x40,
165 /**
166 * typed text should not be stored
167 */
168 ZWP_TEXT_INPUT_V2_CONTENT_HINT_SENSITIVE_DATA = 0x80,
169 /**
170 * just latin characters should be entered
171 */
172 ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN = 0x100,
173 /**
174 * the text input is multiline
175 */
176 ZWP_TEXT_INPUT_V2_CONTENT_HINT_MULTILINE = 0x200,
177 };
178 #endif /* ZWP_TEXT_INPUT_V2_CONTENT_HINT_ENUM */
179
180 #ifndef ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_ENUM
181 #define ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_ENUM
182 /**
183 * @ingroup iface_zwp_text_input_v2
184 * content purpose
185 *
186 * The content purpose allows to specify the primary purpose of a text
187 * input.
188 *
189 * This allows an input method to show special purpose input panels with
190 * extra characters or to disallow some characters.
191 */
192 enum zwp_text_input_v2_content_purpose {
193 /**
194 * default input, allowing all characters
195 */
196 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NORMAL = 0,
197 /**
198 * allow only alphabetic characters
199 */
200 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_ALPHA = 1,
201 /**
202 * allow only digits
203 */
204 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DIGITS = 2,
205 /**
206 * input a number (including decimal separator and sign)
207 */
208 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NUMBER = 3,
209 /**
210 * input a phone number
211 */
212 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_PHONE = 4,
213 /**
214 * input an URL
215 */
216 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_URL = 5,
217 /**
218 * input an email address
219 */
220 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_EMAIL = 6,
221 /**
222 * input a name of a person
223 */
224 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NAME = 7,
225 /**
226 * input a password (combine with password or sensitive_data hint)
227 */
228 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_PASSWORD = 8,
229 /**
230 * input a date
231 */
232 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATE = 9,
233 /**
234 * input a time
235 */
236 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_TIME = 10,
237 /**
238 * input a date and time
239 */
240 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATETIME = 11,
241 /**
242 * input for a terminal
243 */
244 ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_TERMINAL = 12,
245 };
246 #endif /* ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_ENUM */
247
248 #ifndef ZWP_TEXT_INPUT_V2_UPDATE_STATE_ENUM
249 #define ZWP_TEXT_INPUT_V2_UPDATE_STATE_ENUM
250 /**
251 * @ingroup iface_zwp_text_input_v2
252 * update_state flags
253 *
254 * Defines the reason for sending an updated state.
255 */
256 enum zwp_text_input_v2_update_state {
257 /**
258 * updated state because it changed
259 */
260 ZWP_TEXT_INPUT_V2_UPDATE_STATE_CHANGE = 0,
261 /**
262 * full state after enter or input_method_changed event
263 */
264 ZWP_TEXT_INPUT_V2_UPDATE_STATE_FULL = 1,
265 /**
266 * full state after reset
267 */
268 ZWP_TEXT_INPUT_V2_UPDATE_STATE_RESET = 2,
269 /**
270 * full state after switching focus to a different widget on client side
271 */
272 ZWP_TEXT_INPUT_V2_UPDATE_STATE_ENTER = 3,
273 };
274 #endif /* ZWP_TEXT_INPUT_V2_UPDATE_STATE_ENUM */
275
276 #ifndef ZWP_TEXT_INPUT_V2_INPUT_PANEL_VISIBILITY_ENUM
277 #define ZWP_TEXT_INPUT_V2_INPUT_PANEL_VISIBILITY_ENUM
278 enum zwp_text_input_v2_input_panel_visibility {
279 /**
280 * the input panel (virtual keyboard) is hidden
281 */
282 ZWP_TEXT_INPUT_V2_INPUT_PANEL_VISIBILITY_HIDDEN = 0,
283 /**
284 * the input panel (virtual keyboard) is visible
285 */
286 ZWP_TEXT_INPUT_V2_INPUT_PANEL_VISIBILITY_VISIBLE = 1,
287 };
288 #endif /* ZWP_TEXT_INPUT_V2_INPUT_PANEL_VISIBILITY_ENUM */
289
290 #ifndef ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_ENUM
291 #define ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_ENUM
292 enum zwp_text_input_v2_preedit_style {
293 /**
294 * default style for composing text
295 */
296 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_DEFAULT = 0,
297 /**
298 * composing text should be shown the same as non-composing text
299 */
300 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_NONE = 1,
301 /**
302 * composing text might be bold
303 */
304 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_ACTIVE = 2,
305 /**
306 * composing text might be cursive
307 */
308 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INACTIVE = 3,
309 /**
310 * composing text might have a different background color
311 */
312 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_HIGHLIGHT = 4,
313 /**
314 * composing text might be underlined
315 */
316 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_UNDERLINE = 5,
317 /**
318 * composing text should be shown the same as selected text
319 */
320 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_SELECTION = 6,
321 /**
322 * composing text might be underlined with a red wavy line
323 */
324 ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INCORRECT = 7,
325 };
326 #endif /* ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_ENUM */
327
328 #ifndef ZWP_TEXT_INPUT_V2_TEXT_DIRECTION_ENUM
329 #define ZWP_TEXT_INPUT_V2_TEXT_DIRECTION_ENUM
330 enum zwp_text_input_v2_text_direction {
331 /**
332 * automatic text direction based on text and language
333 */
334 ZWP_TEXT_INPUT_V2_TEXT_DIRECTION_AUTO = 0,
335 /**
336 * left-to-right
337 */
338 ZWP_TEXT_INPUT_V2_TEXT_DIRECTION_LTR = 1,
339 /**
340 * right-to-left
341 */
342 ZWP_TEXT_INPUT_V2_TEXT_DIRECTION_RTL = 2,
343 };
344 #endif /* ZWP_TEXT_INPUT_V2_TEXT_DIRECTION_ENUM */
345
346 /**
347 * @ingroup iface_zwp_text_input_v2
348 * @struct zwp_text_input_v2_listener
349 */
350 struct zwp_text_input_v2_listener {
351 /**
352 * enter event
353 *
354 * Notification that this seat's text-input focus is on a certain
355 * surface.
356 *
357 * When the seat has the keyboard capability the text-input focus
358 * follows the keyboard focus.
359 * @param serial serial to be used by update_state
360 */
361 void (*enter)(void *data,
362 struct zwp_text_input_v2 *zwp_text_input_v2,
363 uint32_t serial,
364 struct wl_surface *surface);
365 /**
366 * leave event
367 *
368 * Notification that this seat's text-input focus is no longer on
369 * a certain surface.
370 *
371 * The leave notification is sent before the enter notification for
372 * the new focus.
373 *
374 * When the seat has the keyboard capabillity the text-input focus
375 * follows the keyboard focus.
376 */
377 void (*leave)(void *data,
378 struct zwp_text_input_v2 *zwp_text_input_v2,
379 uint32_t serial,
380 struct wl_surface *surface);
381 /**
382 * state of the input panel
383 *
384 * Notification that the visibility of the input panel (virtual
385 * keyboard) changed.
386 *
387 * The rectangle x, y, width, height defines the area overlapped by
388 * the input panel (virtual keyboard) on the surface having the
389 * text focus in surface local coordinates.
390 *
391 * That can be used to make sure widgets are visible and not
392 * covered by a virtual keyboard.
393 */
394 void (*input_panel_state)(void *data,
395 struct zwp_text_input_v2 *zwp_text_input_v2,
396 uint32_t state,
397 int32_t x,
398 int32_t y,
399 int32_t width,
400 int32_t height);
401 /**
402 * pre-edit
403 *
404 * Notify when a new composing text (pre-edit) should be set
405 * around the current cursor position. Any previously set composing
406 * text should be removed.
407 *
408 * The commit text can be used to replace the composing text in
409 * some cases (for example when losing focus).
410 *
411 * The text input should also handle all preedit_style and
412 * preedit_cursor events occurring directly before preedit_string.
413 */
414 void (*preedit_string)(void *data,
415 struct zwp_text_input_v2 *zwp_text_input_v2,
416 const char *text,
417 const char *commit);
418 /**
419 * pre-edit styling
420 *
421 * Sets styling information on composing text. The style is
422 * applied for length bytes from index relative to the beginning of
423 * the composing text (as byte offset). Multiple styles can be
424 * applied to a composing text by sending multiple preedit_styling
425 * events.
426 *
427 * This event is handled as part of a following preedit_string
428 * event.
429 */
430 void (*preedit_styling)(void *data,
431 struct zwp_text_input_v2 *zwp_text_input_v2,
432 uint32_t index,
433 uint32_t length,
434 uint32_t style);
435 /**
436 * pre-edit cursor
437 *
438 * Sets the cursor position inside the composing text (as byte
439 * offset) relative to the start of the composing text. When index
440 * is a negative number no cursor is shown.
441 *
442 * When no preedit_cursor event is sent the cursor will be at the
443 * end of the composing text by default.
444 *
445 * This event is handled as part of a following preedit_string
446 * event.
447 */
448 void (*preedit_cursor)(void *data,
449 struct zwp_text_input_v2 *zwp_text_input_v2,
450 int32_t index);
451 /**
452 * commit
453 *
454 * Notify when text should be inserted into the editor widget.
455 * The text to commit could be either just a single character after
456 * a key press or the result of some composing (pre-edit). It could
457 * be also an empty text when some text should be removed (see
458 * delete_surrounding_text) or when the input cursor should be
459 * moved (see cursor_position).
460 *
461 * Any previously set composing text should be removed.
462 */
463 void (*commit_string)(void *data,
464 struct zwp_text_input_v2 *zwp_text_input_v2,
465 const char *text);
466 /**
467 * set cursor to new position
468 *
469 * Notify when the cursor or anchor position should be modified.
470 *
471 * This event should be handled as part of a following
472 * commit_string event.
473 *
474 * The text between anchor and index should be selected.
475 * @param index position of cursor
476 * @param anchor position of selection anchor
477 */
478 void (*cursor_position)(void *data,
479 struct zwp_text_input_v2 *zwp_text_input_v2,
480 int32_t index,
481 int32_t anchor);
482 /**
483 * delete surrounding text
484 *
485 * Notify when the text around the current cursor position should
486 * be deleted. BeforeLength and afterLength is the length (in
487 * bytes) of text before and after the current cursor position
488 * (excluding the selection) to delete.
489 *
490 * This event should be handled as part of a following
491 * commit_string or preedit_string event.
492 * @param before_length length of text before current cursor positon
493 * @param after_length length of text after current cursor positon
494 */
495 void (*delete_surrounding_text)(void *data,
496 struct zwp_text_input_v2 *zwp_text_input_v2,
497 uint32_t before_length,
498 uint32_t after_length);
499 /**
500 * modifiers map
501 *
502 * Transfer an array of 0-terminated modifiers names. The
503 * position in the array is the index of the modifier as used in
504 * the modifiers bitmask in the keysym event.
505 */
506 void (*modifiers_map)(void *data,
507 struct zwp_text_input_v2 *zwp_text_input_v2,
508 struct wl_array *map);
509 /**
510 * keysym
511 *
512 * Notify when a key event was sent. Key events should not be
513 * used for normal text input operations, which should be done with
514 * commit_string, delete_surrounding_text, etc. The key event
515 * follows the wl_keyboard key event convention. Sym is a XKB
516 * keysym, state a wl_keyboard key_state. Modifiers are a mask for
517 * effective modifiers (where the modifier indices are set by the
518 * modifiers_map event)
519 */
520 void (*keysym)(void *data,
521 struct zwp_text_input_v2 *zwp_text_input_v2,
522 uint32_t time,
523 uint32_t sym,
524 uint32_t state,
525 uint32_t modifiers);
526 /**
527 * language
528 *
529 * Sets the language of the input text. The "language" argument
530 * is a RFC-3066 format language tag.
531 */
532 void (*language)(void *data,
533 struct zwp_text_input_v2 *zwp_text_input_v2,
534 const char *language);
535 /**
536 * text direction
537 *
538 * Sets the text direction of input text.
539 *
540 * It is mainly needed for showing input cursor on correct side of
541 * the editor when there is no input yet done and making sure
542 * neutral direction text is laid out properly.
543 */
544 void (*text_direction)(void *data,
545 struct zwp_text_input_v2 *zwp_text_input_v2,
546 uint32_t direction);
547 /**
548 * configure amount of surrounding text to be sent
549 *
550 * Configure what amount of surrounding text is expected by the
551 * input method. The surrounding text will be sent in the
552 * set_surrounding_text request on the following state information
553 * updates.
554 */
555 void (*configure_surrounding_text)(void *data,
556 struct zwp_text_input_v2 *zwp_text_input_v2,
557 int32_t before_cursor,
558 int32_t after_cursor);
559 /**
560 * Notifies about a changed input method
561 *
562 * The input method changed on compositor side, which invalidates
563 * all current state information. New state information should be
564 * sent from the client via state requests (set_surrounding_text,
565 * set_content_hint, ...) and update_state.
566 * @param serial serial to be used by update_state
567 * @param flags currently unused
568 */
569 void (*input_method_changed)(void *data,
570 struct zwp_text_input_v2 *zwp_text_input_v2,
571 uint32_t serial,
572 uint32_t flags);
573 };
574
575 /**
576 * @ingroup iface_zwp_text_input_v2
577 */
578 static inline int
579 zwp_text_input_v2_add_listener(struct zwp_text_input_v2 *zwp_text_input_v2,
580 const struct zwp_text_input_v2_listener *listener, void *data)
581 {
582 return wl_proxy_add_listener((struct wl_proxy *) zwp_text_input_v2,
583 (void (**)(void)) listener, data);
584 }
585
586 #define ZWP_TEXT_INPUT_V2_DESTROY 0
587 #define ZWP_TEXT_INPUT_V2_ENABLE 1
588 #define ZWP_TEXT_INPUT_V2_DISABLE 2
589 #define ZWP_TEXT_INPUT_V2_SHOW_INPUT_PANEL 3
590 #define ZWP_TEXT_INPUT_V2_HIDE_INPUT_PANEL 4
591 #define ZWP_TEXT_INPUT_V2_SET_SURROUNDING_TEXT 5
592 #define ZWP_TEXT_INPUT_V2_SET_CONTENT_TYPE 6
593 #define ZWP_TEXT_INPUT_V2_SET_CURSOR_RECTANGLE 7
594 #define ZWP_TEXT_INPUT_V2_SET_PREFERRED_LANGUAGE 8
595 #define ZWP_TEXT_INPUT_V2_UPDATE_STATE 9
596
597 /**
598 * @ingroup iface_zwp_text_input_v2
599 */
600 #define ZWP_TEXT_INPUT_V2_ENTER_SINCE_VERSION 1
601 /**
602 * @ingroup iface_zwp_text_input_v2
603 */
604 #define ZWP_TEXT_INPUT_V2_LEAVE_SINCE_VERSION 1
605 /**
606 * @ingroup iface_zwp_text_input_v2
607 */
608 #define ZWP_TEXT_INPUT_V2_INPUT_PANEL_STATE_SINCE_VERSION 1
609 /**
610 * @ingroup iface_zwp_text_input_v2
611 */
612 #define ZWP_TEXT_INPUT_V2_PREEDIT_STRING_SINCE_VERSION 1
613 /**
614 * @ingroup iface_zwp_text_input_v2
615 */
616 #define ZWP_TEXT_INPUT_V2_PREEDIT_STYLING_SINCE_VERSION 1
617 /**
618 * @ingroup iface_zwp_text_input_v2
619 */
620 #define ZWP_TEXT_INPUT_V2_PREEDIT_CURSOR_SINCE_VERSION 1
621 /**
622 * @ingroup iface_zwp_text_input_v2
623 */
624 #define ZWP_TEXT_INPUT_V2_COMMIT_STRING_SINCE_VERSION 1
625 /**
626 * @ingroup iface_zwp_text_input_v2
627 */
628 #define ZWP_TEXT_INPUT_V2_CURSOR_POSITION_SINCE_VERSION 1
629 /**
630 * @ingroup iface_zwp_text_input_v2
631 */
632 #define ZWP_TEXT_INPUT_V2_DELETE_SURROUNDING_TEXT_SINCE_VERSION 1
633 /**
634 * @ingroup iface_zwp_text_input_v2
635 */
636 #define ZWP_TEXT_INPUT_V2_MODIFIERS_MAP_SINCE_VERSION 1
637 /**
638 * @ingroup iface_zwp_text_input_v2
639 */
640 #define ZWP_TEXT_INPUT_V2_KEYSYM_SINCE_VERSION 1
641 /**
642 * @ingroup iface_zwp_text_input_v2
643 */
644 #define ZWP_TEXT_INPUT_V2_LANGUAGE_SINCE_VERSION 1
645 /**
646 * @ingroup iface_zwp_text_input_v2
647 */
648 #define ZWP_TEXT_INPUT_V2_TEXT_DIRECTION_SINCE_VERSION 1
649 /**
650 * @ingroup iface_zwp_text_input_v2
651 */
652 #define ZWP_TEXT_INPUT_V2_CONFIGURE_SURROUNDING_TEXT_SINCE_VERSION 1
653 /**
654 * @ingroup iface_zwp_text_input_v2
655 */
656 #define ZWP_TEXT_INPUT_V2_INPUT_METHOD_CHANGED_SINCE_VERSION 1
657
658 /**
659 * @ingroup iface_zwp_text_input_v2
660 */
661 #define ZWP_TEXT_INPUT_V2_DESTROY_SINCE_VERSION 1
662 /**
663 * @ingroup iface_zwp_text_input_v2
664 */
665 #define ZWP_TEXT_INPUT_V2_ENABLE_SINCE_VERSION 1
666 /**
667 * @ingroup iface_zwp_text_input_v2
668 */
669 #define ZWP_TEXT_INPUT_V2_DISABLE_SINCE_VERSION 1
670 /**
671 * @ingroup iface_zwp_text_input_v2
672 */
673 #define ZWP_TEXT_INPUT_V2_SHOW_INPUT_PANEL_SINCE_VERSION 1
674 /**
675 * @ingroup iface_zwp_text_input_v2
676 */
677 #define ZWP_TEXT_INPUT_V2_HIDE_INPUT_PANEL_SINCE_VERSION 1
678 /**
679 * @ingroup iface_zwp_text_input_v2
680 */
681 #define ZWP_TEXT_INPUT_V2_SET_SURROUNDING_TEXT_SINCE_VERSION 1
682 /**
683 * @ingroup iface_zwp_text_input_v2
684 */
685 #define ZWP_TEXT_INPUT_V2_SET_CONTENT_TYPE_SINCE_VERSION 1
686 /**
687 * @ingroup iface_zwp_text_input_v2
688 */
689 #define ZWP_TEXT_INPUT_V2_SET_CURSOR_RECTANGLE_SINCE_VERSION 1
690 /**
691 * @ingroup iface_zwp_text_input_v2
692 */
693 #define ZWP_TEXT_INPUT_V2_SET_PREFERRED_LANGUAGE_SINCE_VERSION 1
694 /**
695 * @ingroup iface_zwp_text_input_v2
696 */
697 #define ZWP_TEXT_INPUT_V2_UPDATE_STATE_SINCE_VERSION 1
698
699 /** @ingroup iface_zwp_text_input_v2 */
700 static inline void
701 zwp_text_input_v2_set_user_data(struct zwp_text_input_v2 *zwp_text_input_v2, void *user_data)
702 {
703 wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_v2, user_data);
704 }
705
706 /** @ingroup iface_zwp_text_input_v2 */
707 static inline void *
708 zwp_text_input_v2_get_user_data(struct zwp_text_input_v2 *zwp_text_input_v2)
709 {
710 return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_v2);
711 }
712
713 static inline uint32_t
714 zwp_text_input_v2_get_version(struct zwp_text_input_v2 *zwp_text_input_v2)
715 {
716 return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_v2);
717 }
718
719 /**
720 * @ingroup iface_zwp_text_input_v2
721 *
722 * Destroy the wp_text_input object. Also disables all surfaces enabled
723 * through this wp_text_input object
724 */
725 static inline void
726 zwp_text_input_v2_destroy(struct zwp_text_input_v2 *zwp_text_input_v2)
727 {
728 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
729 ZWP_TEXT_INPUT_V2_DESTROY);
730
731 wl_proxy_destroy((struct wl_proxy *) zwp_text_input_v2);
732 }
733
734 /**
735 * @ingroup iface_zwp_text_input_v2
736 *
737 * Enable text input in a surface (usually when a text entry inside of it
738 * has focus).
739 *
740 * This can be called before or after a surface gets text (or keyboard)
741 * focus via the enter event. Text input to a surface is only active
742 * when it has the current text (or keyboard) focus and is enabled.
743 */
744 static inline void
745 zwp_text_input_v2_enable(struct zwp_text_input_v2 *zwp_text_input_v2, struct wl_surface *surface)
746 {
747 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
748 ZWP_TEXT_INPUT_V2_ENABLE, surface);
749 }
750
751 /**
752 * @ingroup iface_zwp_text_input_v2
753 *
754 * Disable text input in a surface (typically when there is no focus on any
755 * text entry inside the surface).
756 */
757 static inline void
758 zwp_text_input_v2_disable(struct zwp_text_input_v2 *zwp_text_input_v2, struct wl_surface *surface)
759 {
760 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
761 ZWP_TEXT_INPUT_V2_DISABLE, surface);
762 }
763
764 /**
765 * @ingroup iface_zwp_text_input_v2
766 *
767 * Requests input panels (virtual keyboard) to show.
768 *
769 * This should be used for example to show a virtual keyboard again
770 * (with a tap) after it was closed by pressing on a close button on the
771 * keyboard.
772 */
773 static inline void
774 zwp_text_input_v2_show_input_panel(struct zwp_text_input_v2 *zwp_text_input_v2)
775 {
776 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
777 ZWP_TEXT_INPUT_V2_SHOW_INPUT_PANEL);
778 }
779
780 /**
781 * @ingroup iface_zwp_text_input_v2
782 *
783 * Requests input panels (virtual keyboard) to hide.
784 */
785 static inline void
786 zwp_text_input_v2_hide_input_panel(struct zwp_text_input_v2 *zwp_text_input_v2)
787 {
788 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
789 ZWP_TEXT_INPUT_V2_HIDE_INPUT_PANEL);
790 }
791
792 /**
793 * @ingroup iface_zwp_text_input_v2
794 *
795 * Sets the plain surrounding text around the input position. Text is
796 * UTF-8 encoded. Cursor is the byte offset within the surrounding text.
797 * Anchor is the byte offset of the selection anchor within the
798 * surrounding text. If there is no selected text, anchor is the same as
799 * cursor.
800 *
801 * Make sure to always send some text before and after the cursor
802 * except when the cursor is at the beginning or end of text.
803 *
804 * When there was a configure_surrounding_text event take the
805 * before_cursor and after_cursor arguments into account for picking how
806 * much surrounding text to send.
807 *
808 * There is a maximum length of wayland messages so text can not be
809 * longer than 4000 bytes.
810 */
811 static inline void
812 zwp_text_input_v2_set_surrounding_text(struct zwp_text_input_v2 *zwp_text_input_v2, const char *text, int32_t cursor, int32_t anchor)
813 {
814 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
815 ZWP_TEXT_INPUT_V2_SET_SURROUNDING_TEXT, text, cursor, anchor);
816 }
817
818 /**
819 * @ingroup iface_zwp_text_input_v2
820 *
821 * Sets the content purpose and content hint. While the purpose is the
822 * basic purpose of an input field, the hint flags allow to modify some
823 * of the behavior.
824 *
825 * When no content type is explicitly set, a normal content purpose with
826 * none hint should be assumed.
827 */
828 static inline void
829 zwp_text_input_v2_set_content_type(struct zwp_text_input_v2 *zwp_text_input_v2, uint32_t hint, uint32_t purpose)
830 {
831 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
832 ZWP_TEXT_INPUT_V2_SET_CONTENT_TYPE, hint, purpose);
833 }
834
835 /**
836 * @ingroup iface_zwp_text_input_v2
837 *
838 * Sets the cursor outline as a x, y, width, height rectangle in surface
839 * local coordinates.
840 *
841 * Allows the compositor to put a window with word suggestions near the
842 * cursor.
843 */
844 static inline void
845 zwp_text_input_v2_set_cursor_rectangle(struct zwp_text_input_v2 *zwp_text_input_v2, int32_t x, int32_t y, int32_t width, int32_t height)
846 {
847 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
848 ZWP_TEXT_INPUT_V2_SET_CURSOR_RECTANGLE, x, y, width, height);
849 }
850
851 /**
852 * @ingroup iface_zwp_text_input_v2
853 *
854 * Sets a specific language. This allows for example a virtual keyboard to
855 * show a language specific layout. The "language" argument is a RFC-3066
856 * format language tag.
857 *
858 * It could be used for example in a word processor to indicate language of
859 * currently edited document or in an instant message application which
860 * tracks languages of contacts.
861 */
862 static inline void
863 zwp_text_input_v2_set_preferred_language(struct zwp_text_input_v2 *zwp_text_input_v2, const char *language)
864 {
865 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
866 ZWP_TEXT_INPUT_V2_SET_PREFERRED_LANGUAGE, language);
867 }
868
869 /**
870 * @ingroup iface_zwp_text_input_v2
871 *
872 * Allows to atomically send state updates from client.
873 *
874 * This request should follow after a batch of state updating requests
875 * like set_surrounding_text, set_content_type, set_cursor_rectangle and
876 * set_preferred_language.
877 *
878 * The flags field indicates why an updated state is sent to the input
879 * method.
880 *
881 * Reset should be used by an editor widget after the text was changed
882 * outside of the normal input method flow.
883 *
884 * For "change" it is enough to send the changed state, else the full
885 * state should be send.
886 *
887 * Serial should be set to the serial from the last enter or
888 * input_method_changed event.
889 *
890 * To make sure to not receive outdated input method events after a
891 * reset or switching to a new widget wl_display_sync() should be used
892 * after update_state in these cases.
893 */
894 static inline void
895 zwp_text_input_v2_update_state(struct zwp_text_input_v2 *zwp_text_input_v2, uint32_t serial, uint32_t reason)
896 {
897 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_v2,
898 ZWP_TEXT_INPUT_V2_UPDATE_STATE, serial, reason);
899 }
900
901 #define ZWP_TEXT_INPUT_MANAGER_V2_DESTROY 0
902 #define ZWP_TEXT_INPUT_MANAGER_V2_GET_TEXT_INPUT 1
903
904
905 /**
906 * @ingroup iface_zwp_text_input_manager_v2
907 */
908 #define ZWP_TEXT_INPUT_MANAGER_V2_DESTROY_SINCE_VERSION 1
909 /**
910 * @ingroup iface_zwp_text_input_manager_v2
911 */
912 #define ZWP_TEXT_INPUT_MANAGER_V2_GET_TEXT_INPUT_SINCE_VERSION 1
913
914 /** @ingroup iface_zwp_text_input_manager_v2 */
915 static inline void
916 zwp_text_input_manager_v2_set_user_data(struct zwp_text_input_manager_v2 *zwp_text_input_manager_v2, void *user_data)
917 {
918 wl_proxy_set_user_data((struct wl_proxy *) zwp_text_input_manager_v2, user_data);
919 }
920
921 /** @ingroup iface_zwp_text_input_manager_v2 */
922 static inline void *
923 zwp_text_input_manager_v2_get_user_data(struct zwp_text_input_manager_v2 *zwp_text_input_manager_v2)
924 {
925 return wl_proxy_get_user_data((struct wl_proxy *) zwp_text_input_manager_v2);
926 }
927
928 static inline uint32_t
929 zwp_text_input_manager_v2_get_version(struct zwp_text_input_manager_v2 *zwp_text_input_manager_v2)
930 {
931 return wl_proxy_get_version((struct wl_proxy *) zwp_text_input_manager_v2);
932 }
933
934 /**
935 * @ingroup iface_zwp_text_input_manager_v2
936 *
937 * Destroy the wp_text_input_manager object.
938 */
939 static inline void
940 zwp_text_input_manager_v2_destroy(struct zwp_text_input_manager_v2 *zwp_text_input_manager_v2)
941 {
942 wl_proxy_marshal((struct wl_proxy *) zwp_text_input_manager_v2,
943 ZWP_TEXT_INPUT_MANAGER_V2_DESTROY);
944
945 wl_proxy_destroy((struct wl_proxy *) zwp_text_input_manager_v2);
946 }
947
948 /**
949 * @ingroup iface_zwp_text_input_manager_v2
950 *
951 * Creates a new text-input object for a given seat.
952 */
953 static inline struct zwp_text_input_v2 *
954 zwp_text_input_manager_v2_get_text_input(struct zwp_text_input_manager_v2 *zwp_text_input_manager_v2, struct wl_seat *seat)
955 {
956 struct wl_proxy *id;
957
958 id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_text_input_manager_v2,
959 ZWP_TEXT_INPUT_MANAGER_V2_GET_TEXT_INPUT, &zwp_text_input_v2_interface, NULL, seat);
960
961 return (struct zwp_text_input_v2 *) id;
962 }
963
964 #ifdef __cplusplus
965 }
966 #endif
967
968 #endif