wayland_text_input.h 28 KB

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