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