From: Jihoon Kim <imfine98@gmail.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 Jan 2012 04:38:04 +0000 (04:38 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 Jan 2012 04:38:04 +0000 (04:38 +0000)
Long time ago, in
http://www.mail-archive.com/enlightenment-devel@lists.sourceforge.net/msg32795.html
mail thread and IRC,

I talked with about problem of asynchronous event API such as
ecore_imf_context_commit_event_add,
ecore_imf_context_preedit_changed_event_add, so on.

In short, The problem is that key event and text_set APIs are processed
immediately, but commit event and preedit changed event is processed
asynchronously  because those APIs add each event to ecore event queue.

To fix these problems, I've decided to create synchronous event APIs such
as ecore_imf_context_event_callback_add, del and call.

For considering compatibility, sync and async event callback functions are
used in xim and scim immodule.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@67290 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_entry.c

index e48fc7a..b7254e9 100644 (file)
@@ -2,9 +2,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
 
 typedef struct _Entry Entry;
@@ -39,10 +39,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
 };
 
@@ -401,6 +397,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;
    evas_textblock_cursor_copy(c, en->sel_end);
@@ -410,13 +407,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;
    evas_textblock_cursor_copy(c, en->sel_start);
@@ -426,7 +423,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
@@ -1093,6 +1089,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");
@@ -1291,10 +1291,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);
@@ -1508,7 +1504,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);
 }
@@ -1585,6 +1580,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)
@@ -1705,7 +1702,6 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
      }
    evas_textblock_cursor_free(tc);
    
-   _edje_entry_imf_context_reset(en);
    _edje_entry_imf_cursor_info_set(en);
 
    _edje_entry_real_part_configure(rp);
@@ -1745,6 +1741,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);
@@ -1817,7 +1815,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);
 }
@@ -2075,9 +2072,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);
@@ -2114,23 +2111,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;
@@ -2209,7 +2192,7 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
 {
    Entry *en = rp->entry_data;
    if (!en) return;
-
+   _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);
@@ -2248,6 +2231,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);
@@ -2259,9 +2244,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);
 }
 
@@ -2298,6 +2281,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);
@@ -2305,7 +2291,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);
 }
@@ -2315,12 +2300,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);
@@ -2331,9 +2318,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);
@@ -2580,13 +2567,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);
@@ -2600,6 +2588,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;
@@ -2608,7 +2599,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);
@@ -2624,6 +2614,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;
@@ -2640,7 +2633,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);
@@ -2656,6 +2648,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,
@@ -2671,7 +2666,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);
@@ -2684,10 +2678,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);
@@ -2699,10 +2695,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);
@@ -2735,10 +2733,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);
@@ -2751,10 +2750,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);
@@ -2813,10 +2812,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);
@@ -2911,30 +2910,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);
@@ -2942,16 +2936,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 */
@@ -2959,17 +2944,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);
@@ -2979,15 +2963,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);
@@ -2997,24 +2974,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;
@@ -3024,21 +2999,19 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void *
    Ecore_IMF_Preedit_Attr *attr;
    Eina_Strbuf *buf;
 
-   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;
@@ -3140,28 +3113,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);
 
@@ -3175,8 +3143,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