[PATCH 4/5] text: Improve protocol documentation.

Jan Arne Petersen jpetersen at openismus.com
Mon Apr 15 04:37:18 PDT 2013


From: Jan Arne Petersen <jpetersen at openismus.com>

Signed-off-by: Jan Arne Petersen <jpetersen at openismus.com>
---
 protocol/input-method.xml | 87 +++++++++++++++++++++++++++++++++++------------
 protocol/text.xml         |  6 ++--
 2 files changed, 70 insertions(+), 23 deletions(-)

diff --git a/protocol/input-method.xml b/protocol/input-method.xml
index 395d5e4..a533fd6 100644
--- a/protocol/input-method.xml
+++ b/protocol/input-method.xml
@@ -47,20 +47,30 @@
     <request name="destroy" type="destructor"/>
     <request name="commit_string">
       <description summary="commit string">
-        Send the commit string text to the applications text model and
-	set the cursor at index (as Unicode character offset) relative to 
-	the beginning of inserted text.
+        Send the commit string text for insertion to the application.
+
+        The text to commit could be either just a single character after a key
+        press or the result of some composing (pre-edit). It could be also an
+        empty text when some text should be removed (see
+        delete_surrounding_text) or when the input cursor should be moved (see
+        cursor_position).
+
+        Any previously set composing text will be removed.
       </description>
-      <arg name="serial" type="uint"/>
+      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
       <arg name="text" type="string"/>
     </request>
     <request name="preedit_string">
       <description summary="pre-edit string">
-        Send the pre-edit string text to the applications text model. The commit
-        text can be used to replace the preedit text on reset (for example on
-        unfocus).
+        Send the pre-edit string text to the application text input.
+
+        The commit text can be used to replace the preedit text on reset (for
+        example on unfocus).
+
+        Also previously sent preedit_style and preedit_cursor requests are
+        processed bt the text_input also.
       </description>
-      <arg name="serial" type="uint"/>
+      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
       <arg name="text" type="string"/>
       <arg name="commit" type="string"/>
     </request>
@@ -89,10 +99,28 @@
       <arg name="index" type="int"/>
     </request>
     <request name="delete_surrounding_text">
+      <description summary="delete text">
+
+
+        This request will be handled on text_input side as part of a directly
+        following commit_string request.
+      </description>
       <arg name="index" type="int"/>
       <arg name="length" type="uint"/>
     </request>
     <request name="cursor_position">
+      <description summary="set cursor to a new position">
+        Sets the cursor and anchor to a new position. Index is the new cursor
+        position in Unicode characters (when >= 0 relative to the end of
+        inserted text else relative to beginning of inserted text). Anchor is
+        the new anchor position in Unicode characters (when >= 0 relative to
+        the end of inserted text, else relative to beginning of inserted text).
+        When there should be no selected text anchor should be the same as
+        index.
+
+        This request will be handled on text_input side as part of a directly
+        following commit_string request.
+      </description>
       <arg name="index" type="int"/>
       <arg name="anchor" type="int"/>
     </request>
@@ -106,7 +134,7 @@
         delete_surrounfing_text, etc. The key event follows the wl_keyboard key
         event convention. Sym is a XKB keysym, state a wl_keyboard key_state.
       </description>
-      <arg name="serial" type="uint"/>
+      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
       <arg name="time" type="uint"/>
       <arg name="sym" type="uint"/>
       <arg name="state" type="uint"/>
@@ -122,24 +150,41 @@
        <arg name="keyboard" type="new_id" interface="wl_keyboard"/>
     </request>
     <request name="key">
-      <arg name="serial" type="uint"/>
-      <arg name="time" type="uint"/>
-      <arg name="key" type="uint"/>
-      <arg name="state" type="uint"/>
+      <description summary="forward key event">
+        Should be used when filtering key events with grab_keyboard.
+
+        When the wl_keyboard::key event is not processed by the input
+        method itself and should be sent to the client instead, forward it
+        with this request. The arguments should be the ones from the
+        wl_keyboard::key event.
+
+        For generating custom key events use the keysym request instead.
+      </description>
+      <arg name="serial" type="uint" summary="serial from wl_keyboard::key"/>
+      <arg name="time" type="uint" summary="time from wl_keyboard::key"/>
+      <arg name="key" type="uint" summary="key from wl_keyboard::key"/>
+      <arg name="state" type="uint" summary="state from wl_keyboard::key"/>
     </request>
     <request name="modifiers">
-      <arg name="serial" type="uint"/>
-      <arg name="mods_depressed" type="uint"/>
-      <arg name="mods_latched" type="uint"/>
-      <arg name="mods_locked" type="uint"/>
-      <arg name="group" type="uint"/>
+      <description summary="forward modifiers event">
+        Should be used when filtering key events with grab_keyboard.
+
+        When the wl_keyboard::modifiers event should be also send to the
+        client, forward it with this request. The arguments should be the ones
+        from the wl_keyboard::modifiers event.
+      </description>
+      <arg name="serial" type="uint" summary="serial from wl_keyboard::modifiers"/>
+      <arg name="mods_depressed" type="uint" summary="mods_depressed from wl_keyboard::modifiers"/>
+      <arg name="mods_latched" type="uint" summary="mods_latched from wl_keyboard::modifiers"/>
+      <arg name="mods_locked" type="uint" summary="mods_locked from wl_keyboard::modifiers"/>
+      <arg name="group" type="uint" summary="group from wl_keyboard::modifiers"/>
     </request>
     <request name="language">
-      <arg name="serial" type="uint"/>
+      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
       <arg name="language" type="string"/>
     </request>
     <request name="text_direction">
-      <arg name="serial" type="uint"/>
+      <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
       <arg name="direction" type="uint"/>
     </request>
     <event name="surrounding_text">
@@ -166,7 +211,7 @@
       <arg name="index" type="uint"/>
     </event>
     <event name="commit_state">
-      <arg name="serial" type="uint"/>
+      <arg name="serial" type="uint" summary="serial of text input state"/>
     </event>
     <event name="preferred_language">
       <arg name="language" type="string"/>
diff --git a/protocol/text.xml b/protocol/text.xml
index d76c145..fe477a0 100644
--- a/protocol/text.xml
+++ b/protocol/text.xml
@@ -259,7 +259,9 @@
       <description summary="commit">
         Notify when text should be inserted into the editor widget. The text to
         commit could be either just a single character after a key press or the
-        result of some composing (pre-edit).
+        result of some composing (pre-edit). It could be also an empty text
+        when some text should be removed (see delete_surrounding_text) or when
+        the input cursor should be moved (see cursor_position).
 
         Any previously set composing text should be removed.
       </description>
@@ -294,7 +296,7 @@
       <description summary="keysym">
         Notify when a key event was sent. Key events should not be used
         for normal text input operations, which should be done with
-        commit_string, delete_surrounfing_text, etc. The key event follows
+        commit_string, delete_surrounding_text, etc. The key event follows
         the wl_keyboard key event convention. Sym is a XKB keysym, state a
         wl_keyboard key_state. Modifiers are a mask for effective modifiers
         (where the modifier indices are set by the modifiers_map event)
-- 
1.8.1.4



More information about the wayland-devel mailing list