Add reset_sync and reset_done 94/75894/8
authorLi Zhang <li2012.zhang@samsung.com>
Wed, 22 Jun 2016 05:51:07 +0000 (13:51 +0800)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 30 Jun 2016 04:24:10 +0000 (21:24 -0700)
Change-Id: I36a98c988b483ae3354ed138ef247df43ce35c5d

src/e_mod_main.c

index 3b8dd94..4425138 100644 (file)
@@ -569,7 +569,7 @@ _e_text_input_method_context_cb_get_surrounding_text(struct wl_client *client EI
 
 static void
 _e_text_input_method_context_cb_filter_key_event_done(struct wl_client *client EINA_UNUSED, struct wl_resource *resource,
-                                                 uint32_t serial, uint32_t state)
+                                                      uint32_t serial, uint32_t state)
 {
     E_Input_Method_Context *context = wl_resource_get_user_data(resource);
 
@@ -584,7 +584,24 @@ _e_text_input_method_context_cb_filter_key_event_done(struct wl_client *client E
     if ((context->model) && (context->model->resource))
       wl_text_input_send_filter_key_event_done(context->model->resource,
                                           serial, state);
+}
+
+static void
+_e_text_input_method_context_cb_reset_done(struct wl_client *client EINA_UNUSED, struct wl_resource *resource,
+                                           uint32_t serial)
+{
+    E_Input_Method_Context *context = wl_resource_get_user_data(resource);
 
+    if (!context)
+      {
+         wl_resource_post_error(resource,
+                                WL_DISPLAY_ERROR_INVALID_OBJECT,
+                                "No Input Method Context For Resource");
+         return;
+      }
+
+    if ((context->model) && (context->model->resource))
+      wl_text_input_send_reset_done(context->model->resource, serial);
 }
 
 static const struct wl_input_method_context_interface _e_text_input_method_context_implementation = {
@@ -608,7 +625,8 @@ static const struct wl_input_method_context_interface _e_text_input_method_conte
      _e_text_input_method_context_cb_hide_input_panel,
      _e_text_input_method_context_cb_get_selection_text,
      _e_text_input_method_context_cb_get_surrounding_text,
-     _e_text_input_method_context_cb_filter_key_event_done
+     _e_text_input_method_context_cb_filter_key_event_done,
+     _e_text_input_method_context_cb_reset_done
 };
 
 static void
@@ -1258,6 +1276,28 @@ _e_text_input_cb_filter_key_event(struct wl_client *client EINA_UNUSED, struct w
                                                    serial, time, keyname, state, modifiers);
 }
 
+static void
+_e_text_input_cb_reset_sync(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial)
+{
+   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_reset_sync(input_method->context->resource, serial);
+     }
+}
 
 static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_activate,
@@ -1276,7 +1316,8 @@ static const struct wl_text_input_interface _e_text_input_implementation = {
      _e_text_input_cb_bidi_direction_set,
      _e_text_input_cb_cursor_position_set,
      _e_text_input_cb_process_input_device_event,
-     _e_text_input_cb_filter_key_event
+     _e_text_input_cb_filter_key_event,
+     _e_text_input_cb_reset_sync
 };
 
 static void