• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<protocol name="text_input_unstable_v1">
3
4  <copyright>
5    Copyright © 2012, 2013 Intel Corporation
6
7    Permission is hereby granted, free of charge, to any person obtaining a
8    copy of this software and associated documentation files (the "Software"),
9    to deal in the Software without restriction, including without limitation
10    the rights to use, copy, modify, merge, publish, distribute, sublicense,
11    and/or sell copies of the Software, and to permit persons to whom the
12    Software is furnished to do so, subject to the following conditions:
13
14    The above copyright notice and this permission notice (including the next
15    paragraph) shall be included in all copies or substantial portions of the
16    Software.
17
18    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24    DEALINGS IN THE SOFTWARE.
25  </copyright>
26
27  <interface name="zwp_text_input_v1" version="1">
28    <description summary="text input">
29      An object used for text input. Adds support for text input and input
30      methods to applications. A text_input object is created from a
31      wl_text_input_manager and corresponds typically to a text entry in an
32      application.
33
34      Requests are used to activate/deactivate the text_input object and set
35      state information like surrounding and selected text or the content type.
36      The information about entered text is sent to the text_input object via
37      the pre-edit and commit events. Using this interface removes the need
38      for applications to directly process hardware key events and compose text
39      out of them.
40
41      Text is generally UTF-8 encoded, indices and lengths are in bytes.
42
43      Serials are used to synchronize the state between the text input and
44      an input method. New serials are sent by the text input in the
45      commit_state request and are used by the input method to indicate
46      the known text input state in events like preedit_string, commit_string,
47      and keysym. The text input can then ignore events from the input method
48      which are based on an outdated state (for example after a reset).
49
50      Warning! The protocol described in this file is experimental and
51      backward incompatible changes may be made. Backward compatible changes
52      may be added together with the corresponding interface version bump.
53      Backward incompatible changes are done by bumping the version number in
54      the protocol and interface names and resetting the interface version.
55      Once the protocol is to be declared stable, the 'z' prefix and the
56      version number in the protocol and interface names are removed and the
57      interface version number is reset.
58    </description>
59
60    <request name="activate">
61      <description summary="request activation">
62	Requests the text_input object to be activated (typically when the
63	text entry gets focus).
64
65	The seat argument is a wl_seat which maintains the focus for this
66	activation. The surface argument is a wl_surface assigned to the
67	text_input object and tracked for focus lost. The enter event
68	is emitted on successful activation.
69      </description>
70      <arg name="seat" type="object" interface="wl_seat"/>
71      <arg name="surface" type="object" interface="wl_surface"/>
72    </request>
73
74    <request name="deactivate">
75      <description summary="request deactivation">
76	Requests the text_input object to be deactivated (typically when the
77	text entry lost focus). The seat argument is a wl_seat which was used
78	for activation.
79      </description>
80      <arg name="seat" type="object" interface="wl_seat"/>
81    </request>
82
83    <request name="show_input_panel">
84      <description summary="show input panels">
85	Requests input panels (virtual keyboard) to show.
86      </description>
87    </request>
88
89    <request name="hide_input_panel">
90      <description summary="hide input panels">
91	Requests input panels (virtual keyboard) to hide.
92      </description>
93    </request>
94
95    <request name="reset">
96      <description summary="reset">
97	Should be called by an editor widget when the input state should be
98	reset, for example after the text was changed outside of the normal
99	input method flow.
100      </description>
101    </request>
102
103    <request name="set_surrounding_text">
104      <description summary="sets the surrounding text">
105	Sets the plain surrounding text around the input position. Text is
106	UTF-8 encoded. Cursor is the byte offset within the
107	surrounding text. Anchor is the byte offset of the
108	selection anchor within the surrounding text. If there is no selected
109	text anchor, then it is the same as cursor.
110      </description>
111      <arg name="text" type="string"/>
112      <arg name="cursor" type="uint"/>
113      <arg name="anchor" type="uint"/>
114    </request>
115
116    <enum name="content_hint" bitfield="true">
117      <description summary="content hint">
118	Content hint is a bitmask to allow to modify the behavior of the text
119	input.
120      </description>
121      <entry name="none" value="0x0" summary="no special behaviour"/>
122      <entry name="default" value="0x7" summary="auto completion, correction and capitalization"/>
123      <entry name="password" value="0xc0" summary="hidden and sensitive text"/>
124      <entry name="auto_completion" value="0x1" summary="suggest word completions"/>
125      <entry name="auto_correction" value="0x2" summary="suggest word corrections"/>
126      <entry name="auto_capitalization" value="0x4" summary="switch to uppercase letters at the start of a sentence"/>
127      <entry name="lowercase" value="0x8" summary="prefer lowercase letters"/>
128      <entry name="uppercase" value="0x10" summary="prefer uppercase letters"/>
129      <entry name="titlecase" value="0x20" summary="prefer casing for titles and headings (can be language dependent)"/>
130      <entry name="hidden_text" value="0x40" summary="characters should be hidden"/>
131      <entry name="sensitive_data" value="0x80" summary="typed text should not be stored"/>
132      <entry name="latin" value="0x100" summary="just latin characters should be entered"/>
133      <entry name="multiline" value="0x200" summary="the text input is multiline"/>
134    </enum>
135
136    <enum name="content_purpose">
137      <description summary="content purpose">
138	The content purpose allows to specify the primary purpose of a text
139	input.
140
141	This allows an input method to show special purpose input panels with
142	extra characters or to disallow some characters.
143      </description>
144      <entry name="normal" value="0" summary="default input, allowing all characters"/>
145      <entry name="alpha" value="1" summary="allow only alphabetic characters"/>
146      <entry name="digits" value="2" summary="allow only digits"/>
147      <entry name="number" value="3" summary="input a number (including decimal separator and sign)"/>
148      <entry name="phone" value="4" summary="input a phone number"/>
149      <entry name="url" value="5" summary="input an URL"/>
150      <entry name="email" value="6" summary="input an email address"/>
151      <entry name="name" value="7" summary="input a name of a person"/>
152      <entry name="password" value="8" summary="input a password (combine with password or sensitive_data hint)"/>
153      <entry name="date" value="9" summary="input a date"/>
154      <entry name="time" value="10" summary="input a time"/>
155      <entry name="datetime" value="11" summary="input a date and time"/>
156      <entry name="terminal" value="12" summary="input for a terminal"/>
157    </enum>
158
159    <request name="set_content_type">
160      <description summary="set content purpose and hint">
161	Sets the content purpose and content hint. While the purpose is the
162	basic purpose of an input field, the hint flags allow to modify some
163	of the behavior.
164
165	When no content type is explicitly set, a normal content purpose with
166	default hints (auto completion, auto correction, auto capitalization)
167	should be assumed.
168      </description>
169      <arg name="hint" type="uint" enum="content_hint" />
170      <arg name="purpose" type="uint" enum="content_purpose" />
171    </request>
172
173    <request name="set_cursor_rectangle">
174      <arg name="x" type="int"/>
175      <arg name="y" type="int"/>
176      <arg name="width" type="int"/>
177      <arg name="height" type="int"/>
178    </request>
179
180    <request name="set_preferred_language">
181      <description summary="sets preferred language">
182	Sets a specific language. This allows for example a virtual keyboard to
183	show a language specific layout. The "language" argument is an RFC-3066
184	format language tag.
185
186	It could be used for example in a word processor to indicate the
187	language of the currently edited document or in an instant message
188	application which tracks languages of contacts.
189      </description>
190      <arg name="language" type="string"/>
191    </request>
192
193    <request name="commit_state">
194      <arg name="serial" type="uint" summary="used to identify the known state"/>
195    </request>
196
197    <request name="invoke_action">
198      <arg name="button" type="uint"/>
199      <arg name="index" type="uint"/>
200    </request>
201
202    <event name="enter">
203      <description summary="enter event">
204	Notify the text_input object when it received focus. Typically in
205	response to an activate request.
206      </description>
207      <arg name="surface" type="object" interface="wl_surface"/>
208    </event>
209
210    <event name="leave">
211      <description summary="leave event">
212	Notify the text_input object when it lost focus. Either in response
213	to a deactivate request or when the assigned surface lost focus or was
214	destroyed.
215      </description>
216    </event>
217
218    <event name="modifiers_map">
219      <description summary="modifiers map">
220	Transfer an array of 0-terminated modifier names. The position in
221	the array is the index of the modifier as used in the modifiers
222	bitmask in the keysym event.
223      </description>
224      <arg name="map" type="array"/>
225    </event>
226
227    <event name="input_panel_state">
228      <description summary="state of the input panel">
229	Notify when the visibility state of the input panel changed.
230      </description>
231      <arg name="state" type="uint"/>
232    </event>
233
234    <event name="preedit_string">
235      <description summary="pre-edit">
236	Notify when a new composing text (pre-edit) should be set around the
237	current cursor position. Any previously set composing text should
238	be removed.
239
240	The commit text can be used to replace the preedit text on reset
241	(for example on unfocus).
242
243	The text input should also handle all preedit_style and preedit_cursor
244	events occurring directly before preedit_string.
245      </description>
246      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
247      <arg name="text" type="string"/>
248      <arg name="commit" type="string"/>
249    </event>
250
251    <enum name="preedit_style">
252      <entry name="default" value="0" summary="default style for composing text"/>
253      <entry name="none" value="1" summary="style should be the same as in non-composing text"/>
254      <entry name="active" value="2"/>
255      <entry name="inactive" value="3"/>
256      <entry name="highlight" value="4"/>
257      <entry name="underline" value="5"/>
258      <entry name="selection" value="6"/>
259      <entry name="incorrect" value="7"/>
260    </enum>
261
262    <event name="preedit_styling">
263      <description summary="pre-edit styling">
264	Sets styling information on composing text. The style is applied for
265	length bytes from index relative to the beginning of the composing
266	text (as byte offset). Multiple styles can
267	be applied to a composing text by sending multiple preedit_styling
268	events.
269
270	This event is handled as part of a following preedit_string event.
271      </description>
272      <arg name="index" type="uint"/>
273      <arg name="length" type="uint"/>
274      <arg name="style" type="uint" enum="preedit_style" />
275    </event>
276
277    <event name="preedit_cursor">
278      <description summary="pre-edit cursor">
279	Sets the cursor position inside the composing text (as byte
280	offset) relative to the start of the composing text. When index is a
281	negative number no cursor is shown.
282
283	This event is handled as part of a following preedit_string event.
284      </description>
285      <arg name="index" type="int"/>
286    </event>
287
288    <event name="commit_string">
289      <description summary="commit">
290	Notify when text should be inserted into the editor widget. The text to
291	commit could be either just a single character after a key press or the
292	result of some composing (pre-edit). It could also be an empty text
293	when some text should be removed (see delete_surrounding_text) or when
294	the input cursor should be moved (see cursor_position).
295
296	Any previously set composing text should be removed.
297      </description>
298      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
299      <arg name="text" type="string"/>
300    </event>
301
302    <event name="cursor_position">
303      <description summary="set cursor to new position">
304	Notify when the cursor or anchor position should be modified.
305
306	This event should be handled as part of a following commit_string
307	event.
308      </description>
309      <arg name="index" type="int"/>
310      <arg name="anchor" type="int"/>
311    </event>
312
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
318	Index is relative to the current cursor (in bytes).
319	Length is the length of deleted text (in bytes).
320
321	This event should be handled as part of a following commit_string
322	event.
323      </description>
324      <arg name="index" type="int"/>
325      <arg name="length" type="uint"/>
326    </event>
327
328    <event name="keysym">
329      <description summary="keysym">
330	Notify when a key event was sent. Key events should not be used
331	for normal text input operations, which should be done with
332	commit_string, delete_surrounding_text, etc. The key event follows
333	the wl_keyboard key event convention. Sym is an XKB keysym, state a
334	wl_keyboard key_state. Modifiers are a mask for effective modifiers
335	(where the modifier indices are set by the modifiers_map event)
336      </description>
337      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
338      <arg name="time" type="uint"/>
339      <arg name="sym" type="uint"/>
340      <arg name="state" type="uint"/>
341      <arg name="modifiers" type="uint"/>
342    </event>
343
344    <event name="language">
345      <description summary="language">
346	Sets the language of the input text. The "language" argument is an
347	RFC-3066 format language tag.
348      </description>
349      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
350      <arg name="language" type="string"/>
351    </event>
352
353    <enum name="text_direction">
354      <entry name="auto" value="0" summary="automatic text direction based on text and language"/>
355      <entry name="ltr" value="1" summary="left-to-right"/>
356      <entry name="rtl" value="2" summary="right-to-left"/>
357    </enum>
358
359    <event name="text_direction">
360      <description summary="text direction">
361	Sets the text direction of input text.
362
363	It is mainly needed for showing an input cursor on the correct side of
364	the editor when there is no input done yet and making sure neutral
365	direction text is laid out properly.
366      </description>
367      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
368      <arg name="direction" type="uint" enum="text_direction" />
369    </event>
370  </interface>
371
372  <interface name="zwp_text_input_manager_v1" version="1">
373    <description summary="text input manager">
374      A factory for text_input objects. This object is a global singleton.
375    </description>
376
377    <request name="create_text_input">
378      <description summary="create text input">
379	Creates a new text_input object.
380      </description>
381      <arg name="id" type="new_id" interface="zwp_text_input_v1"/>
382    </request>
383  </interface>
384
385</protocol>
386