text: Add some documentation to the text protocol
[profile/ivi/weston.git] / protocol / text.xml
1 <protocol name="text">
2   <interface name="text_model" version="1">
3     <description summary="text model">
4       A model for text input. Adds support for text input and input methods to
5       applications. A text_model object is created from a text_model_factory and
6       corresponds typically to a text entry in an application. Requests are used
7       to activate/deactivate the model and set information like surrounding and
8       selected text or the content type. The information about entered text is
9       sent to the model via the pre-edit and commit events. Using this interface
10       removes the need for applications to directly process hardware key events
11       and compose text out of them.
12     </description>
13     <request name="set_surrounding_text">
14       <arg name="text" type="string"/>
15     </request>
16     <request name="set_cursor_index">
17       <arg name="index" type="uint"/>
18     </request>
19     <request name="activate">
20       <description summary="request activation">
21         Requests the model to be activated (typically when the text entry gets
22         focus). The seat argument is a wl_seat which maintains the focus for
23         this activation. The surface argument is a wl_surface assigned to the
24         model and tracked for focus lost. The activated event is emitted on
25         successful activation.
26       </description>
27       <arg name="seat" type="object" interface="wl_seat"/>
28       <arg name="surface" type="object" interface="wl_surface"/>
29     </request>
30     <request name="deactivate">
31       <description summary="request deactivation">
32         Requests the model to be deactivated (typically when the text entry
33         lost focus). The seat argument is a wl_seat which was used for
34         activation.
35       </description>
36       <arg name="seat" type="object" interface="wl_seat"/>
37     </request>
38     <request name="set_selected_text">
39       <arg name="text" type="string"/>
40       <arg name="index" type="int"/>
41     </request>
42     <request name="set_micro_focus">
43       <arg name="x" type="int"/>
44       <arg name="y" type="int"/>
45       <arg name="width" type="int"/>
46       <arg name="height" type="int"/>
47     </request>
48     <request name="set_preedit"/>
49     <request name="set_content_type"/>
50
51     <event name="commit_string">
52       <arg name="text" type="string"/>
53       <arg name="index" type="uint"/>
54     </event>
55     <event name="preedit_string">
56       <arg name="text" type="string"/>
57       <arg name="index" type="uint"/>
58     </event>
59     <event name="preedit_styling"/>
60     <event name="key"/>
61     <event name="selection_replacement"/>
62     <event name="direction"/>
63     <event name="locale"/>
64     <event name="activated">
65       <description summary="activated event">
66         Notify the model when it is activated. Typically in response to an
67         activate request.
68       </description>
69     </event>
70     <event name="deactivated">
71       <description summary="deactivated event">
72         Notify the model when it is deactivated. Either in response to a
73         deactivate request or when the assigned surface lost focus or was
74         destroyed.
75       </description>
76     </event>
77   </interface>
78
79   <interface name="text_model_factory" version="1">
80     <description summary="text model factory">
81       A factory for text models. This object is a singleton global.
82     </description>
83     <request name="create_text_model">
84       <description summary="create text model">
85         Creates a new text model object.
86       </description>
87       <arg name="id" type="new_id" interface="text_model"/>
88     </request>
89   </interface>
90
91   <interface name="input_method_context" version="1">
92     <description summary="input method context">
93       Corresponds to a text model on input method side. An input method context
94       is created on text mode activation on the input method side. It allows to
95       receive information about the text model from the application via events.
96       Input method contexts do not keep state after deactivation and should be
97       destroyed after deactivation is handled.
98     </description>
99     <request name="destroy" type="destructor"/>
100     <request name="commit_string">
101       <description summary="commit string">
102         Send the commit string text to the applications text model.
103       </description>
104       <arg name="text" type="string"/>
105       <arg name="index" type="uint"/>
106     </request>
107     <event name="set_surrounding_text">
108       <description summary="surrounding text event">
109         The surrounding text from the model.
110       </description>
111       <arg name="text" type="string"/>
112     </event>
113   </interface>
114
115   <interface name="input_method" version="1">
116     <description summary="input method">
117       An input method object is responsible to compose text in response to
118       input from hardware or virtual keyboards. There is one input method
119       object per seat. On activate there is a new input method context object
120       created which allows the input method to communicate with the text model.
121     </description>
122     <event name="activate">
123       <description summary="activate event">
124         A text model was activated. Creates an input method context object
125         which allows communication with the text model.
126       </description>
127       <arg name="id" type="new_id" interface="input_method_context"/>
128     </event>
129     <event name="deactivate">
130       <description summary="activate event">
131         The text model corresponding to the context argument was deactivated.
132         The input method context should be destroyed after deactivation is
133         handled.
134       </description>
135       <arg name="context" type="object" interface="input_method_context"/>
136     </event>
137   </interface>
138 </protocol>