Create and use syncronous ecore_imf API rev.67290
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 Jan 2012 04:38:04 +0000 (04:38 +0000)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 30 Jan 2012 10:46:52 +0000 (19:46 +0900)
Change-Id: I30858f48182e9e27a779cfede9909f3dcca24c51

src/lib/edje_entry.c

index 76f31b1..e7ba69c 100644 (file)
@@ -3,9 +3,9 @@
 
 #ifdef HAVE_ECORE_IMF
 static Eina_Bool _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
-static Eina_Bool _edje_entry_imf_event_commit_cb(void *data, int type, void *event);
-static Eina_Bool _edje_entry_imf_event_preedit_changed_cb(void *data, int type, void *event);
-static Eina_Bool _edje_entry_imf_event_delete_surrounding_cb(void *data, int type, void *event);
+static void      _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info);
+static void      _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *event_info);
+static void      _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx, void *event);
 #endif
 
 static void _edje_entry_top_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
@@ -75,10 +75,6 @@ struct _Entry
 #ifdef HAVE_ECORE_IMF
    Eina_Bool have_preedit : 1;
    Ecore_IMF_Context *imf_context;
-
-   Ecore_Event_Handler *imf_ee_handler_commit;
-   Ecore_Event_Handler *imf_ee_handler_delete;
-   Ecore_Event_Handler *imf_ee_handler_changed;
 #endif
 
    Ecore_Timer *longpress_timer;
@@ -491,6 +487,7 @@ static void
 _sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
 {
    if (!en->sel_end) return;
+   _edje_entry_imf_context_reset(en);
    _sel_enable(c, o, en);
    if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
 
@@ -508,13 +505,13 @@ _sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
         en->selection = NULL;
      }
    _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name);
-   _edje_entry_imf_context_reset(en);
 }
 
 static void
 _sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
 {
    if (!en->sel_end) return;
+   _edje_entry_imf_context_reset(en);
    _sel_enable(c, o, en);
    if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
 
@@ -532,7 +529,6 @@ _sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
         en->selection = NULL;
      }
    _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name);
-   _edje_entry_imf_context_reset(en);
 }
 
 static void
@@ -1308,6 +1304,10 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
      }
 #endif
 
+   if ((!strcmp(ev->key, "Escape")) ||
+       (!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
+     _edje_entry_imf_context_reset(en);
+
    old_cur_pos = evas_textblock_cursor_pos_get(en->cursor);
 
    control = evas_key_modifier_is_set(ev->modifiers, "Control");
@@ -1506,10 +1506,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
         _edje_emit(ed, "entry,key,end", rp->part->name);
         ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
      }
-   else if (!strcmp(ev->key, "Shift_L") || !strcmp(ev->key, "Shift_R"))
-     {
-        return;
-     }
    else if ((control) && (!strcmp(ev->key, "v")))
      {
         _edje_emit(ed, "entry,paste,request", rp->part->name);
@@ -1722,7 +1718,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
    if (!cursor_changed && (old_cur_pos != evas_textblock_cursor_pos_get(en->cursor)))
      _edje_emit(ed, "cursor,changed", rp->part->name);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
    _edje_entry_real_part_configure(rp);
 }
@@ -1921,6 +1916,8 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
      }
 #endif
 
+   _edje_entry_imf_context_reset(en);
+
    en->select_mod_start = EINA_FALSE;
    en->select_mod_end = EINA_FALSE;
    if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
@@ -2045,8 +2042,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
         _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
      }
    evas_textblock_cursor_free(tc);
-
-   _edje_entry_imf_context_reset(en);
+   
    _edje_entry_imf_cursor_info_set(en);
 
    if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
@@ -2107,6 +2103,8 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED
      }
 #endif
 
+   _edje_entry_imf_context_reset(en);
+
    tc = evas_object_textblock_cursor_new(rp->object);
    evas_textblock_cursor_copy(en->cursor, tc);
    evas_object_geometry_get(rp->object, &x, &y, &w, &h);
@@ -2184,7 +2182,6 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED
      }
    evas_textblock_cursor_free(tc);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
    _edje_entry_real_part_configure(rp);
 }
@@ -2654,9 +2651,9 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
 
         ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context,
                                                             _edje_entry_imf_retrieve_surrounding_cb, rp->edje);
-        en->imf_ee_handler_commit = ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _edje_entry_imf_event_commit_cb, rp->edje);
-        en->imf_ee_handler_delete = ecore_event_handler_add(ECORE_IMF_EVENT_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb, rp->edje);
-        en->imf_ee_handler_changed = ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb, rp->edje);
+        ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb, rp->edje);
+        ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb, rp->edje);
+        ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb, rp->edje);
         ecore_imf_context_input_mode_set(en->imf_context,
                                          rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD ?
                                          ECORE_IMF_INPUT_MODE_INVISIBLE : ECORE_IMF_INPUT_MODE_FULL);
@@ -2721,23 +2718,9 @@ _edje_entry_real_part_shutdown(Edje_Real_Part *rp)
      {
         if (en->imf_context)
           {
-             if (en->imf_ee_handler_commit)
-               {
-                  ecore_event_handler_del(en->imf_ee_handler_commit);
-                  en->imf_ee_handler_commit = NULL;
-               }
-
-             if (en->imf_ee_handler_delete)
-               {
-                  ecore_event_handler_del(en->imf_ee_handler_delete);
-                  en->imf_ee_handler_delete = NULL;
-               }
-
-             if (en->imf_ee_handler_changed)
-               {
-                  ecore_event_handler_del(en->imf_ee_handler_changed);
-                  en->imf_ee_handler_changed = NULL;
-               }
+              ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb);
+              ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb);
+              ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb);
 
              ecore_imf_context_del(en->imf_context);
              en->imf_context = NULL;
@@ -2816,13 +2799,7 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
 {
    Entry *en = rp->entry_data;
    if (!en) return;
-#ifdef HAVE_ECORE_IMF
-   if ((en->have_preedit) && (en->imf_context))
-     {
-        ecore_imf_context_reset(en->imf_context);
-        ecore_main_loop_iterate();
-     }
-#endif
+   _edje_entry_imf_context_reset(en);
    // set text as markup
    _sel_clear(en->cursor, rp->object, en);
    evas_object_textblock_text_markup_set(rp->object, text);
@@ -2861,6 +2838,8 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
 {
    Entry *en = rp->entry_data;
    if (!en) return;
+   _edje_entry_imf_context_reset(en);
+
    // prepend markup @ cursor pos
    if (en->have_selection)
      _range_del(en->cursor, rp->object, en);
@@ -2872,9 +2851,7 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
    _edje_emit(rp->edje, "entry,changed", rp->part->name);
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
-   
    _edje_entry_real_part_configure(rp);
 }
 
@@ -2911,6 +2888,9 @@ _edje_entry_select_all(Edje_Real_Part *rp)
 {
    Entry *en = rp->entry_data;
    if (!en) return;
+
+   _edje_entry_imf_context_reset(en);
+
    _sel_clear(en->cursor, rp->object, en);
    _curs_start(en->cursor, rp->object, en);
    _sel_enable(en->cursor, rp->object, en);
@@ -2918,7 +2898,6 @@ _edje_entry_select_all(Edje_Real_Part *rp)
    _curs_end(en->cursor, rp->object, en);
    _sel_extend(en->cursor, rp->object, en);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
    _edje_entry_real_part_configure(rp);
 
@@ -2933,12 +2912,14 @@ _edje_entry_select_begin(Edje_Real_Part *rp)
 {
    Entry *en = rp->entry_data;
    if (!en) return;
+
+   _edje_entry_imf_context_reset(en);
+
    _sel_clear(en->cursor, rp->object, en);
    _sel_enable(en->cursor, rp->object, en);
    _sel_start(en->cursor, rp->object, en);
    _sel_extend(en->cursor, rp->object, en);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_entry_real_part_configure(rp);
@@ -2949,9 +2930,9 @@ _edje_entry_select_extend(Edje_Real_Part *rp)
 {
    Entry *en = rp->entry_data;
    if (!en) return;
+   _edje_entry_imf_context_reset(en);
    _sel_extend(en->cursor, rp->object, en);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_entry_real_part_configure(rp);
@@ -3260,13 +3241,14 @@ _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur)
    Entry *en = rp->entry_data;
    Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
    if (!c) return EINA_FALSE;
+
+   _edje_entry_imf_context_reset(en);
+
    if (!evas_textblock_cursor_char_next(c))
      {
         return EINA_FALSE;
      }
    _sel_update(c, rp->object, rp->entry_data);
-
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
@@ -3280,6 +3262,9 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
    Entry *en = rp->entry_data;
    Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
    if (!c) return EINA_FALSE;
+
+   _edje_entry_imf_context_reset(en);
+
    if (!evas_textblock_cursor_char_prev(c))
      {
         if (evas_textblock_cursor_paragraph_prev(c)) goto ok;
@@ -3288,7 +3273,6 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
 ok:
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
@@ -3304,6 +3288,9 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
    Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
    int ln;
    if (!c) return EINA_FALSE;
+
+   _edje_entry_imf_context_reset(en);
+
    ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
    ln--;
    if (ln < 0) return EINA_FALSE;
@@ -3320,7 +3307,6 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
      }
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
@@ -3336,6 +3322,9 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
    Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
    int ln;
    if (!c) return EINA_FALSE;
+
+   _edje_entry_imf_context_reset(en);
+
    ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
    ln++;
    if (!evas_object_textblock_line_number_geometry_get(rp->object, ln,
@@ -3351,7 +3340,6 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
      }
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
    _edje_entry_real_part_configure(rp);
@@ -3364,10 +3352,12 @@ _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur)
    Entry *en = rp->entry_data;
    Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
    if (!c) return;
+
+   _edje_entry_imf_context_reset(en);
+
    evas_textblock_cursor_paragraph_first(c);
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
    _edje_entry_real_part_configure(rp);
@@ -3379,10 +3369,12 @@ _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur)
    Entry *en = rp->entry_data;
    Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
    if (!c) return;
+
+   _edje_entry_imf_context_reset(en);
+
    _curs_end(c, rp->object, rp->entry_data);
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
@@ -3415,10 +3407,11 @@ _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur)
    Entry *en = rp->entry_data;
    Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
    if (!c) return;
+   _edje_entry_imf_context_reset(en);
+
    evas_textblock_cursor_line_char_first(c);
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
@@ -3431,10 +3424,10 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur)
    Entry *en = rp->entry_data;
    Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
    if (!c) return;
+   _edje_entry_imf_context_reset(en);
    evas_textblock_cursor_line_char_last(c);
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
    _edje_entry_real_part_configure(rp);
@@ -3493,10 +3486,10 @@ _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
    if (evas_textblock_cursor_pos_get(c) == pos)
       return;
 
+   _edje_entry_imf_context_reset(en);
    evas_textblock_cursor_pos_set(c, pos);
    _sel_update(c, rp->object, rp->entry_data);
 
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
    _edje_emit(rp->edje, "cursor,changed", rp->part->name);
    _edje_entry_real_part_configure(rp);
@@ -3642,30 +3635,25 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNU
    return EINA_TRUE;
 }
 
-static Eina_Bool
-_edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
+static void
+_edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
 {
    Edje *ed = data;
    Edje_Real_Part *rp = ed->focused_part;
    Entry *en;
-   Ecore_IMF_Event_Commit *ev = event;
-   Evas_Textblock_Cursor *tc;
-   Eina_Bool cursor_move = EINA_FALSE;
+   char *commit_str = event_info;
    int start_pos;
 
-   if ((!rp) || (!ev) || (!ev->str)) return ECORE_CALLBACK_PASS_ON;
+   if ((!rp)) return;
 
    en = rp->entry_data;
    if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
        (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
-     return ECORE_CALLBACK_PASS_ON;
-
-   if (!en->imf_context) return ECORE_CALLBACK_PASS_ON;
-   if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
+     return;
 
    if (en->have_selection)
      {
-        if (strcmp(ev->str, ""))
+        if (strcmp(commit_str, ""))
           {
              /* delete selected characters */
              _range_del_emit(ed, en->cursor, rp->object, en);
@@ -3673,16 +3661,7 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
           }
      }
 
-   tc = evas_object_textblock_cursor_new(rp->object);
-
-   /* calculate the cursor position to insert commit string */
-   if (en->preedit_start)
-     evas_textblock_cursor_copy(en->preedit_start, tc);
-   else
-     evas_textblock_cursor_copy(en->cursor, tc);
-
-   start_pos = evas_textblock_cursor_pos_get(tc);
-
+   start_pos = evas_textblock_cursor_pos_get(en->cursor);
 
 #ifdef HAVE_ECORE_IMF
    /* delete preedit characters */
@@ -3690,17 +3669,16 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
    _preedit_clear(en);
 #endif
 
-   if (evas_textblock_cursor_compare(en->cursor, tc))
-     cursor_move = EINA_TRUE;
    if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
        _edje_password_show_last)
      _edje_entry_hide_visible_password(en->rp);
    if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
        _edje_password_show_last && (!en->preedit_start))
      {
-        _text_filter_format_prepend(en, tc, "+ password=off");
-        _text_filter_text_prepend(en, tc, ev->str);
-        _text_filter_format_prepend(en, tc, "- password");
+        _text_filter_format_prepend(en, en->cursor, "+ password=off");
+        _text_filter_text_prepend(en, en->cursor, commit_str);
+        _text_filter_format_prepend(en, en->cursor, "- password");
+
         if (en->pw_timer)
           {
              ecore_timer_del(en->pw_timer);
@@ -3710,15 +3688,8 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
                                        _password_timer_cb, en);
      }
    else
-     _text_filter_text_prepend(en, tc, ev->str);
-
-   if (!cursor_move)
-     {
-        /* move cursor to the end of commit string */
-        evas_textblock_cursor_copy(tc, en->cursor);
-     }
+     _text_filter_text_prepend(en, en->cursor, commit_str);
 
-   evas_textblock_cursor_free(tc);
 
    _edje_entry_imf_cursor_info_set(en);
    _anchors_get(en->cursor, rp->object, en);
@@ -3728,24 +3699,22 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
         Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
         info->insert = EINA_TRUE;
         info->change.insert.pos = start_pos;
-        info->change.insert.content = eina_stringshare_add(ev->str);
+        info->change.insert.content = eina_stringshare_add(commit_str);
         info->change.insert.plain_length =
            eina_unicode_utf8_get_len(info->change.insert.content);
         _edje_emit_full(ed, "entry,changed,user", rp->part->name,
                         info, _free_entry_change_info);
         _edje_emit(ed, "cursor,changed", rp->part->name);
      }
-
-   return ECORE_CALLBACK_DONE;
 }
 
-static Eina_Bool
-_edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void *event)
+static void
+_edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
 {
    Edje *ed = data;
    Edje_Real_Part *rp = ed->focused_part;
    Entry *en;
-   Ecore_IMF_Event_Preedit_Changed *ev = event;
+   char *str = event_info;
    int cursor_pos;
    int preedit_start_pos, preedit_end_pos;
    char *preedit_string;
@@ -3757,21 +3726,19 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void *
    char *preedit_tag_index;
    char *pretag = NULL;
 
-   if ((!rp) || (!ev)) return ECORE_CALLBACK_PASS_ON;
+   if ((!rp)) return;
 
    en = rp->entry_data;
    if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
        (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
-     return ECORE_CALLBACK_PASS_ON;
-
-   if (!en->imf_context) return ECORE_CALLBACK_PASS_ON;
+     return;
 
-   if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
+   if (!en->imf_context) return;
 
    ecore_imf_context_preedit_string_with_attributes_get(en->imf_context,
                                                         &preedit_string,
                                                         &attrs, &cursor_pos);
-   if (!preedit_string) return ECORE_CALLBACK_PASS_ON;
+   if (!preedit_string) return;
 
    if (!strcmp(preedit_string, ""))
      preedit_end_state = EINA_TRUE;
@@ -3900,28 +3867,23 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void *
      }
 
    free(preedit_string);
-
-   return ECORE_CALLBACK_DONE;
 }
 
-static Eina_Bool
-_edje_entry_imf_event_delete_surrounding_cb(void *data, int type __UNUSED__, void *event)
+static void
+_edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
 {
    Edje *ed = data;
    Edje_Real_Part *rp = ed->focused_part;
    Entry *en;
-   Ecore_IMF_Event_Delete_Surrounding *ev = event;
+   Ecore_IMF_Event_Delete_Surrounding *ev = event_info;
    Evas_Textblock_Cursor *del_start, *del_end;
    int cursor_pos;
 
-   if ((!rp) || (!ev)) return ECORE_CALLBACK_PASS_ON;
+   if ((!rp) || (!ev)) return;
    en = rp->entry_data;
    if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
        (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
-     return ECORE_CALLBACK_PASS_ON;
-
-   if (!en->imf_context) return ECORE_CALLBACK_PASS_ON;
-   if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
+     return;
 
    cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
 
@@ -3935,8 +3897,6 @@ _edje_entry_imf_event_delete_surrounding_cb(void *data, int type __UNUSED__, voi
 
    evas_textblock_cursor_free(del_start);
    evas_textblock_cursor_free(del_end);
-
-   return ECORE_CALLBACK_DONE;
 }
 #endif