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