hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=c301fab3cd9973847e19f093268341191ec90f6d
commit c301fab3cd9973847e19f093268341191ec90f6d Author: ChunEon Park <her...@hermet.pe.kr> Date: Tue Jun 23 10:11:03 2015 +0900 auto_comp: optimize code. use callback data rather than global variable. --- src/lib/auto_comp.c | 53 +++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/lib/auto_comp.c b/src/lib/auto_comp.c index 2cfcdbd..769e9fa 100644 --- a/src/lib/auto_comp.c +++ b/src/lib/auto_comp.c @@ -363,11 +363,11 @@ entry_anchor_off(autocomp_data *ad) } static void -anchor_unfocused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +anchor_unfocused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - autocomp_data *ad = g_ad; - if (!g_ad) return; + autocomp_data *ad = data; + if (!ad) return; entry_anchor_off(ad); } @@ -581,11 +581,11 @@ candidate_list_show(autocomp_data *ad) } static void -entry_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +entry_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) { - autocomp_data *ad = g_ad; - if ((!g_ad) || (!ad->enabled)) return; + autocomp_data *ad = data; + if ((!ad) || (!ad->enabled)) return; Elm_Entry_Change_Info *info = event_info; @@ -620,21 +620,21 @@ entry_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } static void -entry_cursor_changed_manual_cb(void *data EINA_UNUSED, +entry_cursor_changed_manual_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - autocomp_data *ad = g_ad; - if (!g_ad) return; + autocomp_data *ad = data; + if (!ad) return; if (ad->anchor_visible) entry_anchor_off(ad); } static void -entry_cursor_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, +entry_cursor_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { - autocomp_data *ad = g_ad; - if (!g_ad) return; + autocomp_data *ad = data; + if (!ad) return; //Update anchor position Evas_Coord x, y, cx, cy, cw, ch; @@ -646,20 +646,20 @@ entry_cursor_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, } static void -entry_press_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, +entry_press_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - autocomp_data *ad = g_ad; - if (!g_ad) return; + autocomp_data *ad = data; + if (!ad) return; if (ad->anchor_visible) entry_anchor_off(ad); } static void -entry_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, +entry_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - autocomp_data *ad = g_ad; - if (!g_ad) return; + autocomp_data *ad = data; + if (!ad) return; if (ad->anchor_visible) entry_anchor_off(ad); } @@ -676,7 +676,7 @@ list_item_move(autocomp_data *ad, Eina_Bool up) if (it) elm_list_item_selected_set(it, EINA_TRUE); evas_object_smart_callback_add(entry, "unfocused", anchor_unfocused_cb, - NULL); + ad); } /*****************************************************************************/ @@ -723,17 +723,14 @@ autocomp_target_set(edit_data *ed) if (!ed) return; entry = edit_entry_get(ed); - evas_object_smart_callback_add(entry, "changed,user", entry_changed_cb, - NULL); + evas_object_smart_callback_add(entry, "changed,user", entry_changed_cb, ad); evas_object_smart_callback_add(entry, "cursor,changed,manual", - entry_cursor_changed_manual_cb, NULL); + entry_cursor_changed_manual_cb, ad); evas_object_smart_callback_add(entry, "cursor,changed", - entry_cursor_changed_cb, NULL); - evas_object_smart_callback_add(entry, "unfocused", anchor_unfocused_cb, - NULL); - evas_object_smart_callback_add(entry, "press", entry_press_cb, NULL); - evas_object_event_callback_add(entry, EVAS_CALLBACK_MOVE, - entry_move_cb, NULL); + entry_cursor_changed_cb, ad); + evas_object_smart_callback_add(entry, "unfocused", anchor_unfocused_cb, ad); + evas_object_smart_callback_add(entry, "press", entry_press_cb, ad); + evas_object_event_callback_add(entry, EVAS_CALLBACK_MOVE, entry_move_cb, ad); ad->anchor = elm_button_add(edit_obj_get(ed)); ad->ed = ed; --