Support selection text 27/67427/2
authorLi Zhang <li2012.zhang@samsung.com>
Tue, 26 Apr 2016 11:34:34 +0000 (19:34 +0800)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 26 Apr 2016 22:47:04 +0000 (07:47 +0900)
Change-Id: I5e969cad4694d566a773694191236fa1d191c3b2

src/e_mod_main.c

index d1b78bc069092da22d02b6974991af33f70e9121..f4c7eb567551159cb74a8cbfa26fd697eb74daf5 100644 (file)
@@ -1122,6 +1122,31 @@ _e_text_input_cb_bidi_direction_set(struct wl_client *client EINA_UNUSED, struct
      }
 }
 
+static void
+_e_text_input_cb_selection_text_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, const char *text)
+{
+   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_selection_text(input_method->context->resource,
+                                                      text);
+     }
+}
+
 static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_activate,
      _e_text_input_cb_deactivate,
@@ -1137,7 +1162,8 @@ static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_return_key_type_set,
      _e_text_input_cb_return_key_disabled_set,
      _e_text_input_cb_input_panel_data_set,
-     _e_text_input_cb_bidi_direction_set
+     _e_text_input_cb_bidi_direction_set,
+     _e_text_input_cb_selection_text_set
 };
 
 static void