🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

452 lines
21 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <protocol name="text_input_unstable_v3">
  3. <copyright>
  4. Copyright © 2012, 2013 Intel Corporation
  5. Copyright © 2015, 2016 Jan Arne Petersen
  6. Copyright © 2017, 2018 Red Hat, Inc.
  7. Copyright © 2018 Purism SPC
  8. Permission to use, copy, modify, distribute, and sell this
  9. software and its documentation for any purpose is hereby granted
  10. without fee, provided that the above copyright notice appear in
  11. all copies and that both that copyright notice and this permission
  12. notice appear in supporting documentation, and that the name of
  13. the copyright holders not be used in advertising or publicity
  14. pertaining to distribution of the software without specific,
  15. written prior permission. The copyright holders make no
  16. representations about the suitability of this software for any
  17. purpose. It is provided "as is" without express or implied
  18. warranty.
  19. THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  20. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  21. FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
  22. SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  23. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
  24. AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  25. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
  26. THIS SOFTWARE.
  27. </copyright>
  28. <description summary="Protocol for composing text">
  29. This protocol allows compositors to act as input methods and to send text
  30. to applications. A text input object is used to manage state of what are
  31. typically text entry fields in the application.
  32. This document adheres to the RFC 2119 when using words like "must",
  33. "should", "may", etc.
  34. Warning! The protocol described in this file is experimental and
  35. backward incompatible changes may be made. Backward compatible changes
  36. may be added together with the corresponding interface version bump.
  37. Backward incompatible changes are done by bumping the version number in
  38. the protocol and interface names and resetting the interface version.
  39. Once the protocol is to be declared stable, the 'z' prefix and the
  40. version number in the protocol and interface names are removed and the
  41. interface version number is reset.
  42. </description>
  43. <interface name="zwp_text_input_v3" version="1">
  44. <description summary="text input">
  45. The zwp_text_input_v3 interface represents text input and input methods
  46. associated with a seat. It provides enter/leave events to follow the
  47. text input focus for a seat.
  48. Requests are used to enable/disable the text-input object and set
  49. state information like surrounding and selected text or the content type.
  50. The information about the entered text is sent to the text-input object
  51. via the preedit_string and commit_string events.
  52. Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices
  53. must not point to middle bytes inside a code point: they must either
  54. point to the first byte of a code point or to the end of the buffer.
  55. Lengths must be measured between two valid indices.
  56. Focus moving throughout surfaces will result in the emission of
  57. zwp_text_input_v3.enter and zwp_text_input_v3.leave events. The focused
  58. surface must commit zwp_text_input_v3.enable and
  59. zwp_text_input_v3.disable requests as the keyboard focus moves across
  60. editable and non-editable elements of the UI. Those two requests are not
  61. expected to be paired with each other, the compositor must be able to
  62. handle consecutive series of the same request.
  63. State is sent by the state requests (set_surrounding_text,
  64. set_content_type and set_cursor_rectangle) and a commit request. After an
  65. enter event or disable request all state information is invalidated and
  66. needs to be resent by the client.
  67. </description>
  68. <request name="destroy" type="destructor">
  69. <description summary="Destroy the wp_text_input">
  70. Destroy the wp_text_input object. Also disables all surfaces enabled
  71. through this wp_text_input object.
  72. </description>
  73. </request>
  74. <request name="enable">
  75. <description summary="Request text input to be enabled">
  76. Requests text input on the surface previously obtained from the enter
  77. event.
  78. This request must be issued every time the active text input changes
  79. to a new one, including within the current surface. Use
  80. zwp_text_input_v3.disable when there is no longer any input focus on
  81. the current surface.
  82. Clients must not enable more than one text input on the single seat
  83. and should disable the current text input before enabling the new one.
  84. At most one instance of text input may be in enabled state per instance,
  85. Requests to enable the another text input when some text input is active
  86. must be ignored by compositor.
  87. This request resets all state associated with previous enable, disable,
  88. set_surrounding_text, set_text_change_cause, set_content_type, and
  89. set_cursor_rectangle requests, as well as the state associated with
  90. preedit_string, commit_string, and delete_surrounding_text events.
  91. The set_surrounding_text, set_content_type and set_cursor_rectangle
  92. requests must follow if the text input supports the necessary
  93. functionality.
  94. State set with this request is double-buffered. It will get applied on
  95. the next zwp_text_input_v3.commit request, and stay valid until the
  96. next committed enable or disable request.
  97. The changes must be applied by the compositor after issuing a
  98. zwp_text_input_v3.commit request.
  99. </description>
  100. </request>
  101. <request name="disable">
  102. <description summary="Disable text input on a surface">
  103. Explicitly disable text input on the current surface (typically when
  104. there is no focus on any text entry inside the surface).
  105. State set with this request is double-buffered. It will get applied on
  106. the next zwp_text_input_v3.commit request.
  107. </description>
  108. </request>
  109. <request name="set_surrounding_text">
  110. <description summary="sets the surrounding text">
  111. Sets the surrounding plain text around the input, excluding the preedit
  112. text.
  113. The client should notify the compositor of any changes in any of the
  114. values carried with this request, including changes caused by handling
  115. incoming text-input events as well as changes caused by other
  116. mechanisms like keyboard typing.
  117. If the client is unaware of the text around the cursor, it should not
  118. issue this request, to signify lack of support to the compositor.
  119. Text is UTF-8 encoded, and should include the cursor position, the
  120. complete selection and additional characters before and after them.
  121. There is a maximum length of wayland messages, so text can not be
  122. longer than 4000 bytes.
  123. Cursor is the byte offset of the cursor within text buffer.
  124. Anchor is the byte offset of the selection anchor within text buffer.
  125. If there is no selected text, anchor is the same as cursor.
  126. If any preedit text is present, it is replaced with a cursor for the
  127. purpose of this event.
  128. Values set with this request are double-buffered. They will get applied
  129. on the next zwp_text_input_v3.commit request, and stay valid until the
  130. next committed enable or disable request.
  131. The initial state for affected fields is empty, meaning that the text
  132. input does not support sending surrounding text. If the empty values
  133. get applied, subsequent attempts to change them may have no effect.
  134. </description>
  135. <arg name="text" type="string"/>
  136. <arg name="cursor" type="int"/>
  137. <arg name="anchor" type="int"/>
  138. </request>
  139. <enum name="change_cause">
  140. <description summary="text change reason">
  141. Reason for the change of surrounding text or cursor posision.
  142. </description>
  143. <entry name="input_method" value="0" summary="input method caused the change"/>
  144. <entry name="other" value="1" summary="something else than the input method caused the change"/>
  145. </enum>
  146. <request name="set_text_change_cause">
  147. <description summary="indicates the cause of surrounding text change">
  148. Tells the compositor why the text surrounding the cursor changed.
  149. Whenever the client detects an external change in text, cursor, or
  150. anchor posision, it must issue this request to the compositor. This
  151. request is intended to give the input method a chance to update the
  152. preedit text in an appropriate way, e.g. by removing it when the user
  153. starts typing with a keyboard.
  154. cause describes the source of the change.
  155. The value set with this request is double-buffered. It must be applied
  156. and reset to initial at the next zwp_text_input_v3.commit request.
  157. The initial value of cause is input_method.
  158. </description>
  159. <arg name="cause" type="uint" enum="change_cause"/>
  160. </request>
  161. <enum name="content_hint" bitfield="true">
  162. <description summary="content hint">
  163. Content hint is a bitmask to allow to modify the behavior of the text
  164. input.
  165. </description>
  166. <entry name="none" value="0x0" summary="no special behavior"/>
  167. <entry name="completion" value="0x1" summary="suggest word completions"/>
  168. <entry name="spellcheck" value="0x2" summary="suggest word corrections"/>
  169. <entry name="auto_capitalization" value="0x4" summary="switch to uppercase letters at the start of a sentence"/>
  170. <entry name="lowercase" value="0x8" summary="prefer lowercase letters"/>
  171. <entry name="uppercase" value="0x10" summary="prefer uppercase letters"/>
  172. <entry name="titlecase" value="0x20" summary="prefer casing for titles and headings (can be language dependent)"/>
  173. <entry name="hidden_text" value="0x40" summary="characters should be hidden"/>
  174. <entry name="sensitive_data" value="0x80" summary="typed text should not be stored"/>
  175. <entry name="latin" value="0x100" summary="just Latin characters should be entered"/>
  176. <entry name="multiline" value="0x200" summary="the text input is multiline"/>
  177. </enum>
  178. <enum name="content_purpose">
  179. <description summary="content purpose">
  180. The content purpose allows to specify the primary purpose of a text
  181. input.
  182. This allows an input method to show special purpose input panels with
  183. extra characters or to disallow some characters.
  184. </description>
  185. <entry name="normal" value="0" summary="default input, allowing all characters"/>
  186. <entry name="alpha" value="1" summary="allow only alphabetic characters"/>
  187. <entry name="digits" value="2" summary="allow only digits"/>
  188. <entry name="number" value="3" summary="input a number (including decimal separator and sign)"/>
  189. <entry name="phone" value="4" summary="input a phone number"/>
  190. <entry name="url" value="5" summary="input an URL"/>
  191. <entry name="email" value="6" summary="input an email address"/>
  192. <entry name="name" value="7" summary="input a name of a person"/>
  193. <entry name="password" value="8" summary="input a password (combine with sensitive_data hint)"/>
  194. <entry name="pin" value="9" summary="input is a numeric password (combine with sensitive_data hint)"/>
  195. <entry name="date" value="10" summary="input a date"/>
  196. <entry name="time" value="11" summary="input a time"/>
  197. <entry name="datetime" value="12" summary="input a date and time"/>
  198. <entry name="terminal" value="13" summary="input for a terminal"/>
  199. </enum>
  200. <request name="set_content_type">
  201. <description summary="set content purpose and hint">
  202. Sets the content purpose and content hint. While the purpose is the
  203. basic purpose of an input field, the hint flags allow to modify some of
  204. the behavior.
  205. Values set with this request are double-buffered. They will get applied
  206. on the next zwp_text_input_v3.commit request.
  207. Subsequent attempts to update them may have no effect. The values
  208. remain valid until the next committed enable or disable request.
  209. The initial value for hint is none, and the initial value for purpose
  210. is normal.
  211. </description>
  212. <arg name="hint" type="uint" enum="content_hint"/>
  213. <arg name="purpose" type="uint" enum="content_purpose"/>
  214. </request>
  215. <request name="set_cursor_rectangle">
  216. <description summary="set cursor position">
  217. Marks an area around the cursor as a x, y, width, height rectangle in
  218. surface local coordinates.
  219. Allows the compositor to put a window with word suggestions near the
  220. cursor, without obstructing the text being input.
  221. If the client is unaware of the position of edited text, it should not
  222. issue this request, to signify lack of support to the compositor.
  223. Values set with this request are double-buffered. They will get applied
  224. on the next zwp_text_input_v3.commit request, and stay valid until the
  225. next committed enable or disable request.
  226. The initial values describing a cursor rectangle are empty. That means
  227. the text input does not support describing the cursor area. If the
  228. empty values get applied, subsequent attempts to change them may have
  229. no effect.
  230. </description>
  231. <arg name="x" type="int"/>
  232. <arg name="y" type="int"/>
  233. <arg name="width" type="int"/>
  234. <arg name="height" type="int"/>
  235. </request>
  236. <request name="commit">
  237. <description summary="commit state">
  238. Atomically applies state changes recently sent to the compositor.
  239. The commit request establishes and updates the state of the client, and
  240. must be issued after any changes to apply them.
  241. Text input state (enabled status, content purpose, content hint,
  242. surrounding text and change cause, cursor rectangle) is conceptually
  243. double-buffered within the context of a text input, i.e. between a
  244. committed enable request and the following committed enable or disable
  245. request.
  246. Protocol requests modify the pending state, as opposed to the current
  247. state in use by the input method. A commit request atomically applies
  248. all pending state, replacing the current state. After commit, the new
  249. pending state is as documented for each related request.
  250. Requests are applied in the order of arrival.
  251. Neither current nor pending state are modified unless noted otherwise.
  252. The compositor must count the number of commit requests coming from
  253. each zwp_text_input_v3 object and use the count as the serial in done
  254. events.
  255. </description>
  256. </request>
  257. <event name="enter">
  258. <description summary="enter event">
  259. Notification that this seat's text-input focus is on a certain surface.
  260. If client has created multiple text input objects, compositor must send
  261. this event to all of them.
  262. When the seat has the keyboard capability the text-input focus follows
  263. the keyboard focus. This event sets the current surface for the
  264. text-input object.
  265. </description>
  266. <arg name="surface" type="object" interface="wl_surface"/>
  267. </event>
  268. <event name="leave">
  269. <description summary="leave event">
  270. Notification that this seat's text-input focus is no longer on a
  271. certain surface. The client should reset any preedit string previously
  272. set.
  273. The leave notification clears the current surface. It is sent before
  274. the enter notification for the new focus. After leave event, compositor
  275. must ignore requests from any text input instances until next enter
  276. event.
  277. When the seat has the keyboard capability the text-input focus follows
  278. the keyboard focus.
  279. </description>
  280. <arg name="surface" type="object" interface="wl_surface"/>
  281. </event>
  282. <event name="preedit_string">
  283. <description summary="pre-edit">
  284. Notify when a new composing text (pre-edit) should be set at the
  285. current cursor position. Any previously set composing text must be
  286. removed. Any previously existing selected text must be removed.
  287. The argument text contains the pre-edit string buffer.
  288. The parameters cursor_begin and cursor_end are counted in bytes
  289. relative to the beginning of the submitted text buffer. Cursor should
  290. be hidden when both are equal to -1.
  291. They could be represented by the client as a line if both values are
  292. the same, or as a text highlight otherwise.
  293. Values set with this event are double-buffered. They must be applied
  294. and reset to initial on the next zwp_text_input_v3.done event.
  295. The initial value of text is an empty string, and cursor_begin,
  296. cursor_end and cursor_hidden are all 0.
  297. </description>
  298. <arg name="text" type="string" allow-null="true"/>
  299. <arg name="cursor_begin" type="int"/>
  300. <arg name="cursor_end" type="int"/>
  301. </event>
  302. <event name="commit_string">
  303. <description summary="text commit">
  304. Notify when text should be inserted into the editor widget. The text to
  305. commit could be either just a single character after a key press or the
  306. result of some composing (pre-edit).
  307. Values set with this event are double-buffered. They must be applied
  308. and reset to initial on the next zwp_text_input_v3.done event.
  309. The initial value of text is an empty string.
  310. </description>
  311. <arg name="text" type="string" allow-null="true"/>
  312. </event>
  313. <event name="delete_surrounding_text">
  314. <description summary="delete surrounding text">
  315. Notify when the text around the current cursor position should be
  316. deleted.
  317. Before_length and after_length are the number of bytes before and after
  318. the current cursor index (excluding the selection) to delete.
  319. If a preedit text is present, in effect before_length is counted from
  320. the beginning of it, and after_length from its end (see done event
  321. sequence).
  322. Values set with this event are double-buffered. They must be applied
  323. and reset to initial on the next zwp_text_input_v3.done event.
  324. The initial values of both before_length and after_length are 0.
  325. </description>
  326. <arg name="before_length" type="uint" summary="length of text before current cursor position"/>
  327. <arg name="after_length" type="uint" summary="length of text after current cursor position"/>
  328. </event>
  329. <event name="done">
  330. <description summary="apply changes">
  331. Instruct the application to apply changes to state requested by the
  332. preedit_string, commit_string and delete_surrounding_text events. The
  333. state relating to these events is double-buffered, and each one
  334. modifies the pending state. This event replaces the current state with
  335. the pending state.
  336. The application must proceed by evaluating the changes in the following
  337. order:
  338. 1. Replace existing preedit string with the cursor.
  339. 2. Delete requested surrounding text.
  340. 3. Insert commit string with the cursor at its end.
  341. 4. Calculate surrounding text to send.
  342. 5. Insert new preedit text in cursor position.
  343. 6. Place cursor inside preedit text.
  344. The serial number reflects the last state of the zwp_text_input_v3
  345. object known to the compositor. The value of the serial argument must
  346. be equal to the number of commit requests already issued on that object.
  347. When the client receives a done event with a serial different than the
  348. number of past commit requests, it must proceed as normal, except it
  349. should not change the current state of the zwp_text_input_v3 object.
  350. </description>
  351. <arg name="serial" type="uint"/>
  352. </event>
  353. </interface>
  354. <interface name="zwp_text_input_manager_v3" version="1">
  355. <description summary="text input manager">
  356. A factory for text-input objects. This object is a global singleton.
  357. </description>
  358. <request name="destroy" type="destructor">
  359. <description summary="Destroy the wp_text_input_manager">
  360. Destroy the wp_text_input_manager object.
  361. </description>
  362. </request>
  363. <request name="get_text_input">
  364. <description summary="create a new text input object">
  365. Creates a new text-input object for a given seat.
  366. </description>
  367. <arg name="id" type="new_id" interface="zwp_text_input_v3"/>
  368. <arg name="seat" type="object" interface="wl_seat"/>
  369. </request>
  370. </interface>
  371. </protocol>