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