Fix issue cursor position callback is not called in IME process 60/58160/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 28 Jan 2016 04:50:55 +0000 (13:50 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 28 Jan 2016 04:50:55 +0000 (13:50 +0900)
Change-Id: If109dd4a7497c211a4873e6ad4f06f76ca631952

ism/extras/efl_wsc/isf_wsc_context.cpp
ism/extras/efl_wsc/isf_wsc_context.h
ism/extras/efl_wsc/isf_wsc_efl.cpp

index 42f807c..0227fcb 100644 (file)
@@ -1147,6 +1147,33 @@ isf_wsc_context_reset (WSCContextISF *ctx)
 }
 
 void
+isf_wsc_context_cursor_position_set (WSCContextISF *ctx, int cursor_pos)
+{
+    SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+    WSCContextISF *context_scim = ctx;
+
+    if (context_scim && context_scim->impl && context_scim == _focused_ic) {
+        if (context_scim->impl->cursor_pos != cursor_pos) {
+            LOGD ("ctx : %p, cursor pos : %d\n", ctx, cursor_pos);
+            context_scim->impl->cursor_pos = cursor_pos;
+
+            caps_mode_check (ctx, EINA_FALSE, EINA_TRUE);
+
+            if (context_scim->impl->preedit_updating)
+                return;
+
+            if (context_scim->impl->si) {
+                _panel_client.prepare (context_scim->id);
+                context_scim->impl->si->update_cursor_position (cursor_pos);
+                panel_req_update_cursor_position (context_scim, cursor_pos);
+                _panel_client.send ();
+            }
+        }
+    }
+}
+
+void
 isf_wsc_context_preedit_string_get (WSCContextISF *ctx, char** str, int *cursor_pos)
 {
     SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
index b8d5a10..174d02e 100644 (file)
@@ -75,7 +75,6 @@ struct weescim
     uint32_t content_purpose;
     uint32_t surrounding_cursor;
     uint32_t return_key_type;
-    int      cursor_pos;
 
     Eina_Bool context_changed;
     Eina_Bool hw_kbd;
@@ -107,6 +106,7 @@ void isf_wsc_context_del (WSCContextISF *ctx);
 void isf_wsc_context_focus_in (WSCContextISF *ctx);
 void isf_wsc_context_focus_out (WSCContextISF *ctx);
 void isf_wsc_context_reset (WSCContextISF *ctx);
+void isf_wsc_context_cursor_position_set (WSCContextISF *ctx, int cursor_pos);
 void isf_wsc_context_preedit_string_get (WSCContextISF *ctx, char** str, int *cursor_pos);
 void isf_wsc_context_prediction_allow_set (WSCContextISF* ctx, Eina_Bool prediction);
 Eina_Bool isf_wsc_context_prediction_allow_get (WSCContextISF* ctx);
index 0a7d861..2eff462 100644 (file)
@@ -100,12 +100,7 @@ _wsc_im_ctx_surrounding_text(void *data, struct wl_input_method_context *im_ctx,
     wsc->surrounding_text = strdup (text ? text : "");
     wsc->surrounding_cursor = cursor;
 
-    if (wsc->cursor_pos != (int)cursor) {
-        wsc->cursor_pos = cursor;
-
-        if (wsc->wsc_ctx)
-            caps_mode_check (wsc->wsc_ctx, EINA_FALSE, EINA_TRUE);
-    }
+    isf_wsc_context_cursor_position_set(wsc->wsc_ctx, cursor);
 
     LOGD ("text : '%s', cursor : %d", text, cursor);
 }
@@ -434,7 +429,6 @@ _wsc_im_activate(void *data, struct wl_input_method *input_method, struct wl_inp
     wsc->preedit_str = strdup ("");
     wsc->content_hint = WL_TEXT_INPUT_CONTENT_HINT_NONE;
     wsc->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
-    wsc->cursor_pos = -1;
 
     if (wsc->language) {
         free (wsc->language);