Support to specify the return key on the input panel 39/44039/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 16 Jul 2015 09:56:48 +0000 (18:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 16 Jul 2015 09:56:48 +0000 (18:56 +0900)
Change-Id: I63f927bd6831617a8a446fd3d3ae883ee93b9c09

protocol/input-method.xml
protocol/text.xml
src/e_mod_main.c

index 2f596f0..a36210e 100644 (file)
     <event name="preferred_language">
       <arg name="language" type="string"/>
     </event>
+    <event name="return_key_type">
+      <arg name="return_key_type" type="uint"/>
+    </event>
   </interface>
 
   <interface name="wl_input_method" version="1">
index a4be38c..d61a4cd 100644 (file)
       <arg name="button" type="uint"/>
       <arg name="index" type="uint"/>
     </request>
+    <enum name="return_key_type">
+      <description summary="return key type">
+        The return key type allows to specify the return key on the input panel.
+      </description>
+      <entry name="default" value="0" summary="default"/>
+      <entry name="done" value="1" summary="done"/>
+      <entry name="go" value="2" summary="go"/>
+      <entry name="join" value="3" summary="join"/>
+      <entry name="login" value="4" summary="login"/>
+      <entry name="next" value="5" summary="next"/>
+      <entry name="search" value="6" summary="search"/>
+      <entry name="send" value="7" summary="send"/>
+    </enum>
+    <request name="set_return_key_type">
+      <description summary="set return key type">
+        Sets the return key type.
+      </description>
+      <arg name="return_key_type" type="uint"/>
+    </request>
     <event name="enter">
       <description summary="enter event">
         Notify the text-input object when it received focus. Typically in
index bb1b61a..4600b06 100644 (file)
@@ -671,6 +671,31 @@ _e_text_input_cb_action_invoke(struct wl_client *client EINA_UNUSED, struct wl_r
      }
 }
 
+static void
+_e_text_input_cb_return_key_type_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t return_key_type)
+{
+   E_Text_Input *text_input = wl_resource_get_user_data(resource);
+   E_Input_Method *input_method = NULL;
+   Eina_List *l = NULL;
+
+   if (!text_input)
+     {
+        wl_resource_post_error(resource,
+                               WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "No Text Input For Resource");
+        return;
+     }
+
+   EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
+     {
+        if (!input_method || !input_method->context) continue;
+
+        if (input_method->context->resource)
+          wl_input_method_context_send_return_key_type(input_method->context->resource,
+                                                       return_key_type);
+     }
+}
+
 static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_activate,
      _e_text_input_cb_deactivate,
@@ -682,7 +707,8 @@ static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_cursor_rectangle_set,
      _e_text_input_cb_preferred_language_set,
      _e_text_input_cb_state_commit,
-     _e_text_input_cb_action_invoke
+     _e_text_input_cb_action_invoke,
+     _e_text_input_cb_return_key_type_set
 };
 
 static void