From df19dd7f8eeeac9a6ce4757df5e72ef1449faff6 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 15 Mar 2017 19:40:38 +0900 Subject: [PATCH 01/16] Add to set voice touch as auto mode Change-Id: Id283dd5a9740a639d87c6be0f7cb7b9c9d4f2714 Signed-off-by: sooyeon.kim --- CMakeLists.txt | 3 + include/voice_control_elm_private.h | 7 ++ packaging/voice-control-elm.spec | 3 +- src/CMakeLists.txt | 1 + src/vc_elm.c | 72 +++++++++++++- src/vc_elm_core.c | 181 +++++++++++++++++++++++++++++++++++- 6 files changed, 259 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f124b6e..a8ce164 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,9 @@ SET(VERSION 0.2.0) # pkg config tool INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED + vconf +) # Build type SET(CMAKE_BUILD_TYPE "Release") diff --git a/include/voice_control_elm_private.h b/include/voice_control_elm_private.h index 6077ad6..5b55088 100644 --- a/include/voice_control_elm_private.h +++ b/include/voice_control_elm_private.h @@ -18,6 +18,7 @@ #ifndef VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ #define VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ + /** * @internal * @addtogroup VOICE_CONTROL_ELEMENTARY_PRIVATE_MODULE @@ -110,6 +111,12 @@ int vc_elm_set_click_time(float time); int vc_elm_unset_click_time(); +/** + * @brief Function that check whether voice touch is set as auto mode or not + * @param[out] is_vt_automode a parameter for checking whether voice touch is set as auto mode or not + */ +int vc_elm_is_supported_vt_auto(bool* is_vt_automode); + #ifdef __cplusplus } #endif diff --git a/packaging/voice-control-elm.spec b/packaging/voice-control-elm.spec index 2b498ba..00a4ed5 100644 --- a/packaging/voice-control-elm.spec +++ b/packaging/voice-control-elm.spec @@ -25,6 +25,7 @@ BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(voice-control-widget) +BuildRequires: pkgconfig(vconf) BuildRequires: gettext-tools %description @@ -98,4 +99,4 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice %manifest %{name}-devel.manifest %{_includedir}/voice_control_elm.h %{_includedir}/voice_control_elm_private.h -%{_libdir}/pkgconfig/%{name}.pc \ No newline at end of file +%{_libdir}/pkgconfig/%{name}.pc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c00e5ee..c71fa62 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,7 @@ SET(VC_ELM_PKGS elementary dlog libxml-2.0 + vconf ) IF(${SRPOL_DEBUG} EQUAL "1") diff --git a/src/vc_elm.c b/src/vc_elm.c index b89a392..19fd3ec 100644 --- a/src/vc_elm.c +++ b/src/vc_elm.c @@ -21,6 +21,7 @@ #include "vc_elm_main.h" #include #include +#include #include "vc_elm.h" #include "vc_elm_core.h" @@ -28,6 +29,15 @@ #include "vc_elm_tooltip.h" #include "vc_elm_widget_wrapper.h" +//#define VC_VOICE_TOUCH_AUTOMODE VCONFKEY_VC_VOICE_TOUCH_AUTOMODE +#define VC_VOICE_TOUCH_AUTOMODE "db/voice/vc/voice_touch/automode" + +#define VC_ELM_MODE_MANUAL 0 + +#define VC_ELM_MODE_AUTO_APP 1 + +#define VC_ELM_MODE_AUTO_APPFW 2 + /** * @brief Internal variable. It can check whether voice control elm is initilaized or not. */ @@ -928,17 +938,62 @@ int _vc_elm_get_text_domain(char **domain) return VC_ELM_ERROR_NONE; } +int _vc_elm_is_supported_vt_auto(bool* is_vt_automode) +{ + if (0 != __vc_elm_get_feature_enabled()) { + return VC_ELM_ERROR_NOT_SUPPORTED; + } + + int ret = -1; + ret = vconf_get_bool(VC_VOICE_TOUCH_AUTOMODE, is_vt_automode); + + if (0 != ret) { + VC_ELM_LOG_DBG("Fail to get vconfkey"); + return VC_ELM_ERROR_OPERATION_FAILED; + } + + VC_ELM_LOG_DBG("Success to get vconfkey(%d)", (int)(*is_vt_automode)); + + return ret; +} + +int vc_elm_is_supported_vt_auto(bool* is_vt_automode) +{ + if (0 != __vc_elm_get_feature_enabled()) { + return VC_ELM_ERROR_NOT_SUPPORTED; + } + + return _vc_elm_is_supported_vt_auto(is_vt_automode); +} + int _vc_elm_set_auto_register_mode(int mode, int click_method) { g_auto_mode = mode; g_click_method = click_method; + VC_ELM_LOG_DBG("g_auto_mode: %d, g_click_method: %d", g_auto_mode, g_click_method); + return 0; } + int _vc_elm_get_auto_register_mode(int* mode, int* click_method) { - *mode = g_auto_mode; - *click_method = g_click_method; + bool is_vt_auto; + if (0 != _vc_elm_is_supported_vt_auto(&is_vt_auto)) { + return VC_ELM_ERROR_OPERATION_FAILED; + } else { + if (false == is_vt_auto) { + VC_ELM_LOG_DBG("vt_automode is FALSE"); + *mode = g_auto_mode; + *click_method = g_click_method; + } else { + VC_ELM_LOG_DBG("vt_automode is TRUE"); + *mode = (int)VC_ELM_MODE_AUTO_APPFW; + *click_method = g_click_method; + } + } + + VC_ELM_LOG_DBG("mode: %d, click_method: %d", *mode, *click_method); return 0; } @@ -949,6 +1004,19 @@ int vc_elm_set_auto_register_mode(int mode, int click_method) return VC_ELM_ERROR_NOT_SUPPORTED; } + bool is_vt_auto; + if (0 != _vc_elm_is_supported_vt_auto(&is_vt_auto)) { + return VC_ELM_ERROR_OPERATION_FAILED; + } else { + if (false == is_vt_auto) { + VC_ELM_LOG_DBG("vt_automode is FALSE"); + return _vc_elm_set_auto_register_mode(mode, click_method); + } else { + VC_ELM_LOG_DBG("vt_automode is TRUE"); + return _vc_elm_set_auto_register_mode((int)VC_ELM_MODE_AUTO_APPFW, click_method); + } + } + return _vc_elm_set_auto_register_mode(mode, click_method); } diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 0990910..83df073 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -342,6 +342,128 @@ static Eina_Bool _vc_elm_click_matched_object(const char* cmd, int click_method) return text_found; } +static Eina_Bool _vc_elm_click_matched_object_vt_auto(const char* cmd, int click_method) +{ + VC_ELM_LOG_DBG("inside _vc_elm_click_matched_object_vt_auto()"); + VC_ELM_LOG_DBG("cmd(%s), click_method(%d)", cmd, click_method); + + Eina_List *dump_iter = NULL; + void *data = NULL; + Eina_Bool text_found = EINA_FALSE; + EINA_LIST_FOREACH(g_dump_list, dump_iter, data) { + Object_Info* info = (Object_Info*)data; + + if (NULL != info && NULL != info->text /*&& NULL != info->part_name*/) { + VC_ELM_LOG_DBG("info->text(%s)", info->text); +// Eina_List *iter = NULL; +// char *part_name = NULL; +// EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) { +// if (NULL != part_name && !strcmp(part_name, info->part_name)) { + if (!strcmp(info->text, cmd)) { + int x = info->geometry_info.x; + int y = info->geometry_info.y; + int w = info->geometry_info.w; + int h = info->geometry_info.h; + VC_ELM_LOG_DBG("Click event : %s x(%d) y(%d) w(%d) h(%d), address(%p) type(%s)", info->text, x, y, w, h, info->address, info->type); + if (0 == click_method) { + evas_event_feed_mouse_move(evas_object_evas_get((Evas_Object*)(info->address)), x + w/2, y + h/2, 0, NULL); + evas_event_feed_mouse_down(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 1, NULL); + evas_event_feed_mouse_up(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 2, NULL); + VC_ELM_LOG_INFO("click!!!!!"); + } else if (1 == click_method) { + VC_ELM_LOG_DBG("click method - focus/key"); + bool clicked = false; + if (0 != strcmp(evas_object_type_get((Evas_Object*)info->address), "text") && 0 != strcmp(evas_object_type_get((Evas_Object*)info->address), "textblock")) { + VC_ELM_LOG_DBG("Click event"); + if (EINA_TRUE == elm_object_focus_get((Evas_Object*)info->address)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(g_click_time, __click_event, NULL); + } else { + evas_object_smart_callback_add((Evas_Object*)(info->address), "focused", __focused_cb, "focused"); + elm_object_focus_set((Evas_Object*)(info->address), EINA_TRUE); + } + clicked = true; + } + + if (false == clicked) { + Object_Info* parent_info = ea_object_dump_parent_widget_data_get(info); + if (NULL != parent_info) { + if (EINA_TRUE == parent_info->focusable) { + VC_ELM_LOG_DBG("Focusable Parent"); + VC_ELM_LOG_DBG("Click event"); + if (EINA_TRUE == elm_object_focus_get((Evas_Object*)parent_info->address)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(g_click_time, __click_event, NULL); + } else { + evas_object_smart_callback_add((Evas_Object*)(parent_info->address), "focused", __focused_cb, "focused"); + elm_object_focus_set((Evas_Object*)(parent_info->address), EINA_TRUE); + } + clicked = true; + } + } + + if (false == clicked && NULL != parent_info) { + parent_info = ea_object_dump_parent_widget_data_get(parent_info); + while (NULL != parent_info) { + if (EINA_TRUE == parent_info->focusable) { + VC_ELM_LOG_DBG("Focusable Parent"); + const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address)); + VC_ELM_LOG_DBG("type (%s)", widget_type); + Elm_Object_Item* item = NULL; + if (NULL != widget_type && !strcmp(widget_type, "Elm_Genlist")) { + item = elm_genlist_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, NULL); + if (NULL == item) { + item = elm_genlist_at_xy_item_get((Evas_Object*)(parent_info->address), x + w + w/2, y + h/2, NULL); + } + } else if (NULL != widget_type && !strcmp(widget_type, "Elm_List")) { + item = elm_list_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, NULL); + if (NULL == item) { + item = elm_list_at_xy_item_get((Evas_Object*)(parent_info->address), x + w + w/2, y + h/2, NULL); + } + } else if (NULL != widget_type && !strcmp(widget_type, "Elm_Gengrid")) { + int xposret, yposret; + item = elm_gengrid_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, &xposret, &yposret); + } + VC_ELM_LOG_DBG("item(%p)(%d)", item, elm_object_item_disabled_get(item)); + + if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { + VC_ELM_LOG_DBG("Click event"); + if (EINA_TRUE == elm_object_item_focus_get(item)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(g_click_time, __click_event, NULL); + } else { + evas_object_smart_callback_add((Evas_Object*)(parent_info->address), "item,focused", __focused_cb, "item,focused"); + elm_object_item_focus_set(item, EINA_TRUE); + elm_object_focus_set((Evas_Object*)(parent_info->address), EINA_TRUE); + } + text_found = EINA_TRUE; + break; + } + } + parent_info = ea_object_dump_parent_widget_data_get(parent_info); + } + } + } + } else { + VC_ELM_LOG_DBG("Invalid click method"); + } + + /* Propagation */ + //return EINA_TRUE; + text_found = EINA_TRUE; + } + // } + // } + } + } + ea_object_dump_list_clear(); + g_dump_list = NULL; + + return text_found; +} + + + /** * @brief Function that matches recognition result to the registered actions * and calls for action execution @@ -388,10 +510,18 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa int auto_mode = 0; int click_method = 0; _vc_elm_get_auto_register_mode(&auto_mode, &click_method); + + Eina_Bool ret; if (1 == auto_mode) { - Eina_Bool ret = _vc_elm_click_matched_object(cmd, click_method); - return ret; + /* for Apps */ + VC_ELM_LOG_DBG("for App : vt_auto is FALSE"); + ret = _vc_elm_click_matched_object(cmd, click_method); + } else if (2 == auto_mode) { + /* for App FW */ + VC_ELM_LOG_DBG("for AppFW : vt_auto is TRUE"); + ret = _vc_elm_click_matched_object_vt_auto(cmd, click_method); } + return ret; } return EINA_FALSE; @@ -1053,6 +1183,8 @@ void _vc_elm_core_register_action(struct vc_elm_core_widget_info *info, const ch static int __vc_add_commands_for_automode() { + VC_ELM_LOG_DBG("inside __vc_add_commands_for_automode()"); + if (NULL != g_dump_list) { ea_object_dump_list_clear(); g_dump_list = NULL; @@ -1080,8 +1212,40 @@ static int __vc_add_commands_for_automode() return 0; } +static int __vc_add_commands_for_automode_vt_auto() +{ + VC_ELM_LOG_DBG("inside __vc_add_commands_for_automode_vt_auto()"); + if (NULL != g_dump_list) { + ea_object_dump_list_clear(); + g_dump_list = NULL; + } + g_dump_list = ea_object_dump_full_list_get(EINA_TRUE); + VC_ELM_LOG_DBG("Count (%d)", eina_list_count(g_dump_list)); + + Eina_List *dump_iter = NULL; + void *data = NULL; + EINA_LIST_FOREACH(g_dump_list, dump_iter, data) { + Object_Info* info = (Object_Info*)data; + + if (NULL != info && NULL != info->text /*&& NULL != info->part_name*/) { +// Eina_List *iter = NULL; +// char *part_name = NULL; +// EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) { +// if (NULL != part_name && !strcmp(part_name, info->part_name)) { + VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name); + VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h); + _vc_elm_widget_wrapper_add_command(info->text, NULL); +// } +// } + } + } + return 0; +} + static void __vc_add_commands() { + VC_ELM_LOG_DBG("inside __vc_add_commands()"); + Eina_List *_l; Evas_Object *obj; size_t idx; @@ -1200,10 +1364,17 @@ static void __vc_add_commands() _vc_elm_get_auto_register_mode(&auto_mode, &click_method); VC_ELM_LOG_DBG("Auto mode (%d) Click method (%d)", auto_mode, click_method); if (1 == auto_mode) { - if (0 != __vc_add_commands_for_automode()) { - VC_ELM_LOG_ERR("Fail to add command in auto mode"); - } + /* for Apps */ + VC_ELM_LOG_DBG("for App : vt_auto is FALSE"); + __vc_add_commands_for_automode(); + } else if (2 == auto_mode) { + /* for App FW */ + VC_ELM_LOG_DBG("for AppFW : vt_auto is TRUE"); + __vc_add_commands_for_automode_vt_auto(); } +// if (0 != __vc_add_commands_for_automode()) { +// VC_ELM_LOG_ERR("Fail to add command in auto mode"); +// } _vc_elm_widget_wrapper_commit_commands(&__result_cb, NULL); } -- 2.7.4 From 4590b7158613ef0175cd893089c7b11e8be8a394 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 22 Mar 2017 17:33:24 +0900 Subject: [PATCH 02/16] Update coverage for voice touch Change-Id: Ia42851acdc60b20717816995da3edf0c2bd2a3a3 Signed-off-by: Wonnam Jang --- src/vc_elm_efl_dump.c | 155 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 131 insertions(+), 24 deletions(-) diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index 03d4e4b..c4f6b36 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -23,6 +23,13 @@ #include "vc_elm_tools.h" #include "vc_elm_efl_dump.h" +#define EVAS_OBJECT_DUMP_DEBUG +#ifdef EVAS_OBJECT_DUMP_DEBUG +#define VC_ELM_LOG_DUMP(fmt, ...) SLOGD("\033[0;32m" fmt "\033[m", ## __VA_ARGS__) +#else +#define VC_ELM_LOG_DUMP(fmt, ...) +#endif + typedef struct _Ea_Util_Mgr { Evas *evas; FILE *fp; @@ -40,7 +47,7 @@ typedef struct _Edje_Info { } Edje_Info; #define SPANS_COMMON(x1, w1, x2, w2) \ - (!(((int)((x2) + (int)(w2)) <= (int)(x1)) || (int)((x2) >= (int)((x1) + (int)(w1))))) + (!(((int)((x2) + (int)(w2)) < (int)(x1)) || (int)((x2) > (int)((x1) + (int)(w1))))) #define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ ((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) @@ -53,6 +60,17 @@ static int g_geo_x = 0, g_geo_y = 0, g_geo_w = 0, g_geo_h = 0; static int find_popup = 0; static int skip_text = 0; +bool vc_elm_efl_dump_is_vt_auto_enabled() +{ + bool is_vt_automode = false; + int ret = vc_elm_is_supported_vt_auto(&is_vt_automode); + if (0 != ret) { + VC_ELM_LOG_DUMP("Fail to check vt auto mode"); + } + + return is_vt_automode; +} + static Eina_Bool evas_object_is_visible_get(Evas_Object *obj) { @@ -308,8 +326,49 @@ next: } } +static Eina_Bool _is_clickable_object(Evas_Object *obj) +{ + if (!strcmp(evas_object_type_get(obj), "elm_win") || !strcmp(evas_object_type_get(obj), "elm_naviframe") || !strcmp(evas_object_type_get(obj), "elm_label") + || !strcmp(evas_object_type_get(obj), "elm_ctxpopup") || !strcmp(evas_object_type_get(obj), "elm_popup")) { + VC_ELM_LOG_DUMP("Not clickable object(%s)", evas_object_type_get(obj)); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +static Eina_Bool _is_descendant_of_list(Object_Info *object_info) +{ + Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info); + while (NULL != parent_info) { + const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address)); + if (NULL != widget_type) { + VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type); + if (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List") || !strcmp(widget_type, "Elm_Ctxpopup") || !strcmp(widget_type, "Elm_Index")) + return EINA_TRUE; + } + parent_info = ea_object_dump_parent_widget_data_get(parent_info); + } + return EINA_FALSE; +} + +static Eina_Bool _is_descendant_of_toolbar(Object_Info *object_info) +{ + Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info); + while (NULL != parent_info) { + const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address)); + if (NULL != widget_type) { + VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type); + if (!strcmp(widget_type, "Elm_Toolbar")) + return EINA_TRUE; + } + parent_info = ea_object_dump_parent_widget_data_get(parent_info); + } + return EINA_FALSE; +} + static void -_obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent, Eina_Bool parent_widget_focusable, Eina_Bool list_type) +_obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent, Eina_Bool parent_widget_focusable, Eina_Bool list_type, int cnt) { Eina_List *children = NULL, *l = NULL; Evas_Object *child, *smart_parent_obj = NULL; @@ -323,30 +382,51 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj Object_Info *object_info = NULL; char* temp = NULL; + VC_ELM_LOG_DUMP("[%d] Object(%s), text(%s)(%s)", cnt, evas_object_type_get(obj), (!evas_object_text_text_get(obj)) ? " " : evas_object_text_text_get(obj), !elm_atspi_accessible_name_get(obj) ? " " : elm_atspi_accessible_name_get(obj)); + // visible check - if (!evas_object_is_visible_get(obj)) return; + if (!evas_object_is_visible_get(obj)) { + VC_ELM_LOG_DUMP(" [%d] Object(%s) : Invisible)", cnt, evas_object_type_get(obj)); + return; + } - if (evas_object_type_match(obj, "elm_popup")) { + if (evas_object_type_match(obj, "elm_popup") || evas_object_type_match(obj, "elm_ctxpopup")) { if (elm_object_part_text_get(obj, "title,text")) skip_text = 1; eina_list_free(ret_list); + ret_list = NULL; find_popup = 0; } - if (find_popup) return; + if (find_popup) { + VC_ELM_LOG_DUMP(" [%d] Object(%s) : Find_popup", cnt, evas_object_type_get(obj)); + return; + } // viewport check evas_object_geometry_get(obj, &x, &y, &w, &h); - if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) return; + if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) { + VC_ELM_LOG_DUMP("## x(%d), y(%d), w(%d), h(%d), util_mgr->x(%d), util_mgr->y(%d), util_mgr->w(%d), util_mgr->h(%d)", x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h); + VC_ELM_LOG_DUMP("## RECTS_INTERSECT(%d), SPANS_COMMON_X(%d), SPANS_COMMON_Y(%d)", RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h), + SPANS_COMMON(x, w, util_mgr->x, util_mgr->w), SPANS_COMMON(y, h, util_mgr->y, util_mgr->h)); + return; + } // clipper check if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; - if (is_clip) goto next; + if (is_clip) { + VC_ELM_LOG_DUMP("is_clip(%d)", is_clip); + goto next; + } if (!strcmp(evas_object_type_get(obj), "text") || !strcmp(evas_object_type_get(obj), "textblock")) { - if (!parent_widget_focusable && !list_type) goto next; + if (!parent_widget_focusable && !list_type) { + VC_ELM_LOG_DUMP("## parent_widget_focusable(%d), list_type(%d)", parent_widget_focusable, list_type); + goto next; + } if (skip_text) { skip_text = 0; + VC_ELM_LOG_DUMP(" [%d] Object(%s) : Skip_text", cnt, evas_object_type_get(obj)); return; } } @@ -377,7 +457,7 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj } } if (!list_type) { - if (evas_object_type_match(obj, "elm_genlist") || evas_object_type_match(obj, "elm_gengrid") || evas_object_type_match(obj, "elm_list")) + if (evas_object_type_match(obj, "elm_genlist") || evas_object_type_match(obj, "elm_gengrid") || evas_object_type_match(obj, "elm_list") || evas_object_type_match(obj, "elm_ctxpopup") || evas_object_type_match(obj, "elm_index")) list_type = EINA_TRUE; } @@ -455,31 +535,56 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj } text = NULL; - if (!strcmp(evas_object_type_get(obj), "text")) - text = eina_stringshare_add(evas_object_text_text_get(obj)); - else if (!strcmp(evas_object_type_get(obj), "textblock")) { - ret = evas_object_textblock_text_markup_get(obj); - temp = evas_textblock_text_markup_to_utf8(obj, ret); - text = eina_stringshare_add(temp); - - if (NULL != temp) { - free(temp); - temp = NULL; + if (false == vc_elm_efl_dump_is_vt_auto_enabled()) { + if (!strcmp(evas_object_type_get(obj), "text")) + text = eina_stringshare_add(evas_object_text_text_get(obj)); + else if (!strcmp(evas_object_type_get(obj), "textblock")) { + ret = evas_object_textblock_text_markup_get(obj); + temp = evas_textblock_text_markup_to_utf8(obj, ret); + text = eina_stringshare_add(temp); + + if (NULL != temp) { + free(temp); + temp = NULL; + } + } + } else { + if (!strcmp(evas_object_type_get(obj), "text") && EINA_TRUE == _is_descendant_of_list(object_info)) { + text = eina_stringshare_add(evas_object_text_text_get(obj)); + VC_ELM_LOG_DUMP("####### [DEBUG] text(%s), atspi_text(%s)", text, elm_atspi_accessible_name_get(obj)); + } else if (!strcmp(evas_object_type_get(obj), "textblock") && EINA_TRUE == _is_descendant_of_list(object_info)) { + ret = evas_object_textblock_text_markup_get(obj); + temp = evas_textblock_text_markup_to_utf8(obj, ret); + text = eina_stringshare_add(temp); + + if (NULL != temp) { + free(temp); + temp = NULL; + } + VC_ELM_LOG_DUMP("####### [DEBUG] textblock(%s), atspi_text(%s)", text, elm_atspi_accessible_name_get(obj)); + } else if (elm_atspi_accessible_name_get(obj) && EINA_TRUE == object_info->focusable && EINA_TRUE == _is_clickable_object(obj)) { + text = elm_atspi_accessible_name_get(obj); + VC_ELM_LOG_DUMP("####### [DEBUG] atspi_text(%s)", text); + } else if (elm_atspi_accessible_name_get(obj) && !strcmp(evas_object_type_get(obj), "elm_layout") && EINA_TRUE == _is_descendant_of_toolbar(object_info)) { + text = elm_atspi_accessible_name_get(obj); + VC_ELM_LOG_DUMP("####### [DEBUG] toolbar(%s)", text); } } if (text && strlen(text) > 0) { object_info->text = calloc(1, strlen(text) + 1); strncpy(object_info->text, text, strlen(text) + 1); + + ret_list = eina_list_append(ret_list, object_info); } - ret_list = eina_list_append(ret_list, object_info); next: if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) { children = evas_object_smart_members_get(obj); EINA_LIST_FREE(children, child) - _obj_tree_items_exclude_unfocusable_text(util_mgr, child, object_info, parent_widget_focusable, list_type); - if (evas_object_type_match(obj, "elm_popup")) find_popup = 1; + _obj_tree_items_exclude_unfocusable_text(util_mgr, child, object_info, parent_widget_focusable, list_type, cnt + 1); + if (evas_object_type_match(obj, "elm_popup") || evas_object_type_match(obj, "elm_ctxpopup")) find_popup = 1; } + VC_ELM_LOG_DUMP(" [%d] %s : return", cnt, evas_object_type_get(obj)); } static void @@ -613,8 +718,10 @@ _object_tree(Ea_Util_Mgr *util_mgr, int val, Eina_Bool exclude_unfocusable_text) if (val == 1) { if (exclude_unfocusable_text) { - EINA_LIST_FREE(objs, obj) - _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE, EINA_FALSE); + EINA_LIST_FREE(objs, obj) { + VC_ELM_LOG_DUMP("###################### start ########################"); + _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE, EINA_FALSE, 0); + } } else { EINA_LIST_FREE(objs, obj) _obj_tree_items(util_mgr, obj, NULL); -- 2.7.4 From 761fbde52473812d5cb699e86c0b9eb34bb06c0c Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Thu, 23 Mar 2017 17:53:04 +0900 Subject: [PATCH 03/16] Fix logic about auto registered object list to handle with manual registered Change-Id: I02f9773dca1f1b603d2ef62b23eca6b4398aa3f3 --- include/voice_control_elm_private.h | 1 + src/vc_elm_core.c | 184 +++++++++++++++++++++++++++++++----- src/vc_elm_core.h | 1 + src/vc_elm_core_default_widgets.c | 83 +++++++++++++++- 4 files changed, 241 insertions(+), 28 deletions(-) diff --git a/include/voice_control_elm_private.h b/include/voice_control_elm_private.h index 5b55088..e8e1287 100644 --- a/include/voice_control_elm_private.h +++ b/include/voice_control_elm_private.h @@ -18,6 +18,7 @@ #ifndef VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ #define VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ +#include /** * @internal diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 581efb3..119bec5 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -72,13 +72,17 @@ static Eina_List *g_dump_list = NULL; static Eina_List *g_allowed_text_part_list = NULL; #define DEFAULT_CLICK_TIME 0.5 -static float g_click_time = DEFAULT_CLICK_TIME; +float g_click_time = DEFAULT_CLICK_TIME; #define HIDE 0xa #define X_VISIBILITY_TOLERANCE 32.0 #define Y_VISIBILITY_TOLERANCE 54.0 +static Eina_Bool _vc_elm_core_set_auto_object_command(Evas_Object *obj, const char *_command); +static Eina_Bool _vc_elm_core_set_auto_item_object_command(Elm_Object_Item *obj, const char *_command); + static void __idle_changed(Ecore_Evas *ee); + const Eina_Hash *_vc_elm_core_get_config_action_map() { return g_config_action_map; @@ -462,8 +466,6 @@ static Eina_Bool _vc_elm_click_matched_object_vt_auto(const char* cmd, int click return text_found; } - - /** * @brief Function that matches recognition result to the registered actions * and calls for action execution @@ -493,17 +495,22 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa } } if (found) { - char *tmp_buf = NULL; - char *tmp_cmd = strdup(cmd); - char *command = strtok_r(tmp_cmd, " ", &tmp_buf); - char *param = strtok_r(NULL, "'", &tmp_buf); - found->cmd = command; + char* temp = evas_object_data_get(found->obj, VC_ELM_CMD_DATA_KEY); - VC_ELM_LOG_DBG("unwrapping %s %s for %s", param1, param2, _get_ui_object_name(found->obj)); - found->unwrap_callback(found, param, param2); + if (NULL == temp) { + VC_ELM_LOG_ERR("[ERROR] evas_object_data_get"); + return EINA_FALSE; + } - if (NULL != tmp_cmd) - free(tmp_cmd); + VC_ELM_LOG_DBG("command(%s)", temp); + char* action = NULL; + if (strlen(cmd) > strlen(temp)) { + action = &cmd[strlen(temp) + 1]; + VC_ELM_LOG_DBG("action(%s)", &cmd[strlen(temp) + 1]); + } + found->cmd = temp; + VC_ELM_LOG_DBG("unwrapping %s %s for %s", param1, param2, _get_ui_object_name(found->obj)); + found->unwrap_callback(found, action, param2); return EINA_TRUE; } else { @@ -511,7 +518,7 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa int click_method = 0; _vc_elm_get_auto_register_mode(&auto_mode, &click_method); - Eina_Bool ret; + Eina_Bool ret = EINA_FALSE; if (1 == auto_mode) { /* for Apps */ VC_ELM_LOG_DBG("for App : vt_auto is FALSE"); @@ -524,6 +531,11 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa return ret; } + if (NULL != g_dump_list) { + ea_object_dump_list_clear(); + g_dump_list = NULL; + } + return EINA_FALSE; } @@ -717,7 +729,7 @@ static Eina_List *__get_objects_of_visible_items(Evas_Object *parent, Elm_Object _vc_elm_core_register_default_widget(name, EINA_TRUE, eina_hash_find(g_config_widget_map, name)); eina_hash_add(registered_item_map, name, strdup("1")); } - VC_ELM_LOG_DBG("have a visible item %d %d %d %d", x_1, y_1, w_1, h_1); + VC_ELM_LOG_DBG("have a visible item %s %p %s %d %d %d %d", name, (void*)item, item_command, x_1, y_1, w_1, h_1); if ((NULL == name) || (!strcmp("Elm_Layout", name))) evas_object_data_set(obj, "special_item", item); ret = eina_list_append(ret, obj); @@ -893,12 +905,15 @@ static void __elm_widget_foreach_in_tree(Evas_Object *widget, Eina_Bool(*cb)(Eva } else if (obj_name != NULL && !strcmp("Elm_Genlist", obj_name)) { VC_ELM_LOG_DBG(":: %s", obj_name); + VC_ELM_LOG_DBG("count(%d)", elm_genlist_items_count(widget)); if (NULL == eina_hash_find(registered_item_map, "elm_item") && NULL != eina_hash_find(g_config_widget_map, "Elm_Genlist")) { _vc_elm_core_register_default_widget("elm_item", EINA_TRUE, NULL); eina_hash_add(registered_item_map, "elm_item", strdup("1")); } list = __get_objects_of_visible_items(widget, &elm_genlist_first_item_get, &elm_genlist_item_next_get); + VC_ELM_LOG_DBG("visible count(%d)", eina_list_count(list)); constant_list = elm_widget_can_focus_child_list_get(widget); + VC_ELM_LOG_DBG("focusable count(%d)", eina_list_count(constant_list)); EINA_LIST_FOREACH(constant_list, l, obj) { if (NULL == eina_list_data_find(list, obj)) list = eina_list_append(list, obj); @@ -1220,6 +1235,21 @@ static int __vc_add_commands_for_automode() return 0; } +static Elm_Object_Item* __vc_elm_core_get_object_item_from_geometry_info(Evas_Object* parent, const char* widget_type, int x, int y, int w, int h) +{ + if (NULL == widget_type) + return NULL; + + if (!strcmp(widget_type, "Elm_Genlist")) { + return elm_genlist_at_xy_item_get(parent, x + w/2, y + h/2, NULL); + } else if (!strcmp(widget_type, "Elm_Gengrid")) { + return elm_gengrid_at_xy_item_get(parent, x + w/2, y + h/2, NULL, NULL); + } else if (!strcmp(widget_type, "Elm_List")) { + return elm_list_at_xy_item_get(parent, x + w/2, y + h/2, NULL); + } + return NULL; +} + static int __vc_add_commands_for_automode_vt_auto() { VC_ELM_LOG_DBG("inside __vc_add_commands_for_automode_vt_auto()"); @@ -1242,7 +1272,36 @@ static int __vc_add_commands_for_automode_vt_auto() // if (NULL != part_name && !strcmp(part_name, info->part_name)) { VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name); VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h); - _vc_elm_widget_wrapper_add_command(info->text, NULL); + Object_Info* parent = ea_object_dump_parent_widget_data_get(info); + Object_Info* grand = ea_object_dump_parent_widget_data_get(parent); + + char *widget_type = NULL; + widget_type = elm_widget_type_get((Evas_Object*)grand->address); + VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), elm_widget_type_get((Evas_Object*)grand->address)); + if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) { + int x = info->geometry_info.x; + int y = info->geometry_info.y; + int w = info->geometry_info.w; + int h = info->geometry_info.h; + Elm_Object_Item *it = __vc_elm_core_get_object_item_from_geometry_info((Evas_Object*)grand->address, widget_type, x, y, w, h); + if (NULL != it) { + _vc_elm_core_set_auto_item_object_command(it, info->text); + VC_ELM_LOG_DBG("Get object from geometry(%p)", it); + } + } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Toolbar"))) { + Elm_Object_Item *it = elm_toolbar_item_find_by_label((Evas_Object*)grand->address, info->text); + if (NULL != it) { + _vc_elm_core_set_auto_item_object_command(it, info->text); + VC_ELM_LOG_DBG("Get object from label(%p)", it); + } + } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Ctxpopup"))) { + /* TODO */ + } else { + if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) { + VC_ELM_LOG_ERR("Not supported widget"); + } + _vc_elm_core_set_auto_object_command((Evas_Object*)info->address, info->text); + } // } // } } @@ -1281,6 +1340,7 @@ static void __vc_add_commands() g_wrapped_commands = NULL; } + VC_ELM_LOG_DBG("currene objects(%d)", eina_list_count(g_current_ui_objects)); EINA_LIST_FOREACH(g_current_ui_objects, _l, obj) { struct vc_elm_core_widget_info *info = NULL; const char *obj_name = _get_ui_object_name(obj); @@ -1289,6 +1349,8 @@ static void __vc_add_commands() int ret; obj_name = eina_stringshare_add(obj_name); registered = 0; + + VC_ELM_LOG_DBG("obj(%p), command %s", (void*)obj, evas_object_data_get(obj, VC_ELM_CMD_DATA_KEY)); if (obj_name) VC_ELM_LOG_DBG("Adding command for %s", obj_name); if ((!obj_name && evas_object_data_get(obj, "special_item")) || (obj_name && (!strcmp(obj_name, "Elm_Layout") && evas_object_data_get(obj, "special_item")))) @@ -1367,6 +1429,7 @@ static void __vc_add_commands() eina_stringshare_del(obj_name); } +#if 0 int auto_mode = -1; int click_method = -1; _vc_elm_get_auto_register_mode(&auto_mode, &click_method); @@ -1383,6 +1446,7 @@ static void __vc_add_commands() // if (0 != __vc_add_commands_for_automode()) { // VC_ELM_LOG_ERR("Fail to add command in auto mode"); // } +#endif _vc_elm_widget_wrapper_commit_commands(&__result_cb, NULL); } @@ -1598,6 +1662,18 @@ Eina_Bool _vc_elm_core_set_object_command(Evas_Object *obj, const char *_command return EINA_TRUE; } +static Eina_Bool _vc_elm_core_set_auto_object_command(Evas_Object *obj, const char *_command) +{ + char *temp = NULL; + temp = evas_object_data_get(obj, VC_ELM_CMD_DATA_KEY); + if (NULL != temp) { + VC_ELM_LOG_DBG("obj(%p) already has command(%s)", (void*)obj, temp); + return EINA_FALSE; + } + + return _vc_elm_core_set_object_command(obj, _command); +} + Eina_Bool _vc_elm_core_unset_object_command(Evas_Object *obj) { evas_object_data_del(obj, VC_ELM_CMD_DATA_KEY); @@ -1627,12 +1703,25 @@ Eina_Bool _vc_elm_core_set_item_object_command(Elm_Object_Item *obj, const char const char *command = eina_stringshare_add(_command); if (NULL == command) return EINA_FALSE; + VC_ELM_LOG_DBG("Add item object(%p) command(%s)", (void*)obj, _command); eina_hash_add(item_command_map, &obj, command); eina_hash_add(command_item_map, command, obj); elm_object_item_del_cb_set(obj, __item__object_del_callback); return EINA_TRUE; } +static Eina_Bool _vc_elm_core_set_auto_item_object_command(Elm_Object_Item *obj, const char *_command) +{ + char *temp = NULL; + temp = eina_hash_find(item_command_map, &obj); + if (NULL != temp) { + VC_ELM_LOG_DBG("obj item(%p) already has command(%s)", (void*)obj, temp); + return EINA_FALSE; + } + + return _vc_elm_core_set_item_object_command(obj, _command); +} + Eina_Bool _vc_elm_core_unset_item_object_command(Elm_Object_Item *obj) { eina_hash_free_cb_set(item_command_map, __hash_entry_dummy_cb); @@ -1962,6 +2051,26 @@ static Eina_Bool __idle_enter(void *data) Eina_Bool is_focused = elm_win_focus_get(g_default_window); (void)data; +#if 1 + int auto_mode = -1; + int click_method = -1; + _vc_elm_get_auto_register_mode(&auto_mode, &click_method); + VC_ELM_LOG_DBG("Auto mode (%d) Click method (%d)", auto_mode, click_method); + if (1 == auto_mode) { + /* for Apps */ + VC_ELM_LOG_DBG("for App : vt_auto is FALSE"); + __vc_add_commands_for_automode(); + } else if (2 == auto_mode) { + /* for App FW */ + VC_ELM_LOG_DBG("for AppFW : vt_auto is TRUE"); + __vc_add_commands_for_automode_vt_auto(); + } +// if (0 != __vc_add_commands_for_automode()) { +// VC_ELM_LOG_ERR("Fail to add command in auto mode"); +// } +#endif + + if (NULL != g_default_window) { evas_object_smart_callback_del(g_default_window, "focused", __vc_elm_event_window_focus_in); evas_object_smart_callback_del(g_default_window, "unfocused", __vc_elm_event_window_focus_out); @@ -1970,15 +2079,39 @@ static Eina_Bool __idle_enter(void *data) VC_ELM_LOG_DBG("Focused g_default %ud", elm_win_xwindow_get(g_default_window)); if (!is_focused) { /* window changed, we need to get new one */ - VC_ELM_LOG_DBG("list count %d", eina_list_count(ui_objects_list)); - EINA_LIST_FOREACH(ui_objects_list, l, obj) { + int count = eina_list_count(ui_objects_list); + VC_ELM_LOG_DBG("list count %d", count); + if (0 == count) { + /* TODO - get window object */ + Eina_List *ecore_evas_list = ecore_evas_ecore_evas_list_get(); + Ecore_Evas *ee = NULL; + Evas *evas = NULL; + Eina_List *objs = NULL; + Evas_Object *obj = NULL; Evas_Object *window = NULL; - VC_ELM_LOG_DBG("foreach obj %p", (void*)obj); - window = elm_object_top_widget_get(obj); - if (window && elm_win_focus_get(window) == EINA_TRUE) { - VC_ELM_LOG_DBG("NEW Focused g_default %ud", elm_win_xwindow_get(window)); - g_default_window = window; - break; + EINA_LIST_FREE(ecore_evas_list, ee) { + evas = ecore_evas_get(ee); + ecore_wl_sync(); + objs = evas_objects_in_rectangle_get(evas, SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE); + EINA_LIST_FREE(objs, obj) { + VC_ELM_LOG_DBG("foreach obj %p", (void*)obj); + window = elm_object_top_widget_get(obj); + if (window && EINA_TRUE == elm_win_focus_get(window)) { + VC_ELM_LOG_DBG("NEW Focused g_default %ud", elm_win_xwindow_get(window)); + g_default_window = window; + } + } + } + } else { + EINA_LIST_FOREACH(ui_objects_list, l, obj) { + Evas_Object *window = NULL; + VC_ELM_LOG_DBG("foreach obj %p", (void*)obj); + window = elm_object_top_widget_get(obj); + if (window && elm_win_focus_get(window) == EINA_TRUE) { + VC_ELM_LOG_DBG("NEW Focused g_default %ud", elm_win_xwindow_get(window)); + g_default_window = window; + break; + } } } } @@ -2303,3 +2436,8 @@ int _vc_elm_core_unset_click_time() VC_ELM_LOG_INFO("Unset click time, time will be (%f) sec", DEFAULT_CLICK_TIME); return 0; } + +Elm_Object_Item* _vc_elm_core_get_item_object_by_command(const char* command) +{ + return (Elm_Object_Item *)eina_hash_find(command_item_map, command); +} \ No newline at end of file diff --git a/src/vc_elm_core.h b/src/vc_elm_core.h index f2ca41a..0b5de30 100644 --- a/src/vc_elm_core.h +++ b/src/vc_elm_core.h @@ -521,6 +521,7 @@ int _vc_elm_core_set_click_time(float time); int _vc_elm_core_unset_click_time(); +Elm_Object_Item* _vc_elm_core_get_item_object_by_command(const char* command); #ifdef __cplusplus } diff --git a/src/vc_elm_core_default_widgets.c b/src/vc_elm_core_default_widgets.c index 9c8306a..73ed5c2 100644 --- a/src/vc_elm_core_default_widgets.c +++ b/src/vc_elm_core_default_widgets.c @@ -20,6 +20,8 @@ #include #include +#include + #include "vc_elm.h" #include "vc_elm_core.h" #include "vc_elm_tools.h" @@ -62,6 +64,8 @@ enum SCROLL_DIRECTION { TO_END }; +extern float g_click_time; + static void __set_tooltips_position_on_visible_items(Evas_Object *parent, Elm_Object_Item *(*get_first)(const Evas_Object *obj, void *user_data), Elm_Object_Item *(*get_next)(const Elm_Object_Item *item, void *user_data), void *user_data); /** @@ -165,11 +169,80 @@ static void __emulate_mouse_click_full(const Evas_Object *object, char xpercent, } /** - * @brief Emulate mouse click function + * @brief Emulate click function */ -static void __emulate_mouse_click(const Evas_Object *obj) +static Eina_Bool __click_event(void *data) +{ + (void)data; + efl_util_inputgen_h input_h; + input_h = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD); + if (NULL != input_h) { + efl_util_input_generate_key(input_h, "Return", 1); + efl_util_input_generate_key(input_h, "Return", 0); + efl_util_input_deinitialize_generator(input_h); + } + + VC_ELM_LOG_INFO("click!!!!!"); + + return EINA_FALSE; +} + +static void __focused_cb(void *data, Evas_Object *obj, void *event_info) +{ + (void)event_info; + char* event = (char*)data; + + if (NULL != event) { + if (!strcmp("focused", event)) { + evas_object_smart_callback_del(obj, "focused", __focused_cb); + } else if (!strcmp("item,focused", event)) { + evas_object_smart_callback_del(obj, "item,focused", __focused_cb); + } + ecore_timer_add(g_click_time, __click_event, NULL); + } +} + +static void __vc_elm_click_by_focus(Evas_Object *obj) +{ + VC_ELM_LOG_DBG("obj(%p)", (void*)obj); + + if (NULL != elm_widget_type_get(obj)) { + if (EINA_TRUE == elm_object_focus_get(obj)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(g_click_time, __click_event, NULL); + } else { + evas_object_smart_callback_add(obj, "focused", __focused_cb, "focused"); + elm_object_focus_set(obj, EINA_TRUE); + } + } else { + Elm_Object_Item* item = _vc_elm_core_get_item_object_by_command(evas_object_data_get((Elm_Object_Item*)obj, VC_ELM_CMD_DATA_KEY)); + VC_ELM_LOG_DBG("item(%p)(%d)", item, elm_object_item_disabled_get(item)); + Evas_Object *parent = elm_object_item_widget_get(item); + if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { + VC_ELM_LOG_DBG("Click event"); + if (EINA_TRUE == elm_object_item_focus_get(item)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(g_click_time, __click_event, NULL); + } else { + evas_object_smart_callback_add(parent, "item,focused", __focused_cb, "item,focused"); + elm_object_item_focus_set(item, EINA_TRUE); + elm_object_focus_set(parent, EINA_TRUE); + } + } + + } +} + +static void __emulate_click(const Evas_Object *obj) { - __emulate_mouse_click_full(obj, 10, 75); + int auto_mode = 0; + int click_method = 0; + _vc_elm_get_auto_register_mode(&auto_mode, &click_method); + if (0 == click_method) { + __emulate_mouse_click_full(obj, 10, 75); + } else { + __vc_elm_click_by_focus(obj); + } /* because items with two line style are clickable on: - text only in first line - the whole second line */ @@ -190,7 +263,7 @@ static void __button_activator_func(Evas_Object *obj, void *data, const char *ac if (!action_name || (0 == strcmp(action_name, _VC_ELM(CLICK)))) { VC_ELM_LOG_INFO("clicking down %s (%p)", elm_widget_type_get(obj), (void*)obj); - __emulate_mouse_click(obj); + __emulate_click(obj); } else { VC_ELM_LOG_INFO("bad action (%s) for %s", action_name, elm_widget_type_get(obj)); } @@ -1191,7 +1264,7 @@ static void __entry_activator_func(Evas_Object *obj, void *data, const char *act (void)data; if (!action_name || 0 == strcmp(_VC_ELM(CLICK), action_name)) { - __emulate_mouse_click(obj); + __emulate_click(obj); elm_entry_select_all(obj); elm_entry_select_none(obj); elm_entry_input_panel_show(obj); -- 2.7.4 From e1f1210410817f0f57a96ea119efd22cc47f6ba9 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Mon, 27 Mar 2017 17:13:09 +0900 Subject: [PATCH 04/16] Fix memory leak of object dump list Change-Id: I1400d2816da12b302694e6a890bdd6f52f16308b Signed-off-by: Suyeon Hwang --- src/vc_elm_core.c | 5 +++++ src/vc_elm_efl_dump.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 581efb3..a7525a3 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -637,6 +637,11 @@ void _vc_elm_core_fini() } _vc_elm_core_destroy_xml_data(); + if (NULL != g_dump_list) { + ea_object_dump_list_clear(); + g_dump_list = NULL; + } + #ifndef SRPOL_DEBUG _vc_elm_widget_wrapper_deinitialize(); #endif diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index c4f6b36..8cdfc20 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -741,12 +741,21 @@ void ea_object_dump_list_clear(void) { Object_Info *obj_info = NULL; - EINA_LIST_FREE(ret_list, obj_info) + EINA_LIST_FREE(ret_list, obj_info) { + if (!obj_info->type) free(obj_info->type); + if (!obj_info->edje_file) free(obj_info->edje_file); + if (!obj_info->group) free(obj_info->group); + if (!obj_info->image_name) free(obj_info->image_name); + if (!obj_info->color_class) free(obj_info->color_class); + if (!obj_info->part_name) free(obj_info->part_name); + if (!obj_info->part_state) free(obj_info->part_state); + if (!obj_info->text) free(obj_info->text); free(obj_info); - + } ret_list = NULL; } + Eina_List* ea_object_dump_full_list_get(Eina_Bool exclude_unfocusable_text) { -- 2.7.4 From 2d8a7f771873d9b3522ecd6bbe63ceb625b1c4da Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 5 Apr 2017 18:27:22 +0900 Subject: [PATCH 05/16] Update url link Change-Id: I7790b5d71ced3f32bad51e5c484f9195eec6bcc3 Signed-off-by: Wonnam Jang (cherry picked from commit e749ebb6f7710fbf65229fe2c69c47ca8357df0a) --- doc/uix_voice_control_elm_doc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/uix_voice_control_elm_doc.h b/doc/uix_voice_control_elm_doc.h index cf9bfe9..f9ee1e2 100644 --- a/doc/uix_voice_control_elm_doc.h +++ b/doc/uix_voice_control_elm_doc.h @@ -122,7 +122,7 @@ * It is recommended to design feature related codes in your application for reliability.
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
- * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature Element. */ -- 2.7.4 From c990386b79c15057d6b22dda8bd39ba11c92d386 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 11 Apr 2017 15:42:19 +0900 Subject: [PATCH 06/16] Use license macro in .spec file Change-Id: I0edfe7bfcd61cd5de4049eb9abdb4fe91c2abdb6 Signed-off-by: Suyeon Hwang --- packaging/voice-control-elm.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packaging/voice-control-elm.spec b/packaging/voice-control-elm.spec index 00a4ed5..285c3ea 100644 --- a/packaging/voice-control-elm.spec +++ b/packaging/voice-control-elm.spec @@ -72,8 +72,6 @@ mkdir objdir %install rm -rf %{buildroot} -mkdir -p %{buildroot}%{TZ_SYS_RO_SHARE}/license -install LICENSE %{buildroot}%{TZ_SYS_RO_SHARE}/license/%{name} (cd objdir && %make_install) @@ -86,6 +84,7 @@ rm -rf %{buildroot} mkdir -p %{TZ_SYS_RO_SHARE}/voice %files +%license LICENSE %manifest %{name}.manifest %attr(644,root,root) %defattr(-,root,root,-) -- 2.7.4 From e8e98bb851fc7ecc23c4e97eab83ea0e90192522 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Fri, 24 Mar 2017 11:31:56 +0900 Subject: [PATCH 07/16] Add widget type check for support list Change-Id: I5190bf60207d5e0c82c22856d36901d094261d6f --- src/vc_elm_core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index a303273..3c32ce7 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -1282,7 +1282,17 @@ static int __vc_add_commands_for_automode_vt_auto() char *widget_type = NULL; widget_type = elm_widget_type_get((Evas_Object*)grand->address); - VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), elm_widget_type_get((Evas_Object*)grand->address)); + while (NULL == widget_type) { + grand = ea_object_dump_parent_widget_data_get(grand); + if (NULL == grand) { + break; + } + widget_type = elm_widget_type_get((Evas_Object*)grand->address); + } + + VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type); + // VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", evas_object_type_get((Evas_Object*)info->address), evas_object_type_get((Evas_Object*)parent->address), evas_object_type_get((Evas_Object*)grand->address)); + if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) { int x = info->geometry_info.x; int y = info->geometry_info.y; -- 2.7.4 From d9d8cc63f7a660eda9579afdc35a1cc8445635ce Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 17 May 2017 18:41:24 +0900 Subject: [PATCH 08/16] Remove appcore-efl for resolving cyclic dependency Change-Id: Ia48aeaf1012f48e92bc26ff49abfc56b445e8bb7 Signed-off-by: sooyeon.kim --- packaging/voice-control-elm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/voice-control-elm.spec b/packaging/voice-control-elm.spec index 285c3ea..f9c5aeb 100644 --- a/packaging/voice-control-elm.spec +++ b/packaging/voice-control-elm.spec @@ -10,7 +10,7 @@ Source1001: %{name}.manifest Source1002: %{name}-devel.manifest BuildRequires: cmake BuildRequires: edje-tools -BuildRequires: pkgconfig(appcore-efl) +#BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(cynara-client) -- 2.7.4 From 141dd383a51391155b753da85a646ce73c722f96 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 26 May 2017 10:27:22 +0900 Subject: [PATCH 09/16] Move .so file to devel package Change-Id: I5407f039cbac6130bd08f25c159656c6f049cba5 Signed-off-by: Suyeon Hwang --- packaging/voice-control-elm.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packaging/voice-control-elm.spec b/packaging/voice-control-elm.spec index f9c5aeb..c94c824 100644 --- a/packaging/voice-control-elm.spec +++ b/packaging/voice-control-elm.spec @@ -10,7 +10,6 @@ Source1001: %{name}.manifest Source1002: %{name}-devel.manifest BuildRequires: cmake BuildRequires: edje-tools -#BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(cynara-client) @@ -88,7 +87,6 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice %manifest %{name}.manifest %attr(644,root,root) %defattr(-,root,root,-) -%{_libdir}/*.so %{_libdir}/*.so.* %{_datadir}/* %{TZ_SYS_RO_SHARE}/locale/* @@ -96,6 +94,7 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice %files devel %manifest %{name}-devel.manifest +%{_libdir}/*.so %{_includedir}/voice_control_elm.h %{_includedir}/voice_control_elm_private.h %{_libdir}/pkgconfig/%{name}.pc -- 2.7.4 From b77449b33b138f83d698a6986fa53ef53e5326fd Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 29 May 2017 18:40:46 +0900 Subject: [PATCH 10/16] Add vconf changed callback and Fix warning Change-Id: I416ca7e72cd1d7116f80abc6bf05dd631f984302 Signed-off-by: sooyeon.kim --- include/voice_control_elm_private.h | 2 +- src/vc_elm.c | 88 ++++++++++++++++++------------------- src/vc_elm_core.c | 17 ++++--- src/vc_elm_core_default_widgets.c | 10 ++--- src/vc_elm_efl_dump.c | 12 ++--- 5 files changed, 64 insertions(+), 65 deletions(-) diff --git a/include/voice_control_elm_private.h b/include/voice_control_elm_private.h index e8e1287..e9d680a 100644 --- a/include/voice_control_elm_private.h +++ b/include/voice_control_elm_private.h @@ -116,7 +116,7 @@ int vc_elm_unset_click_time(); * @brief Function that check whether voice touch is set as auto mode or not * @param[out] is_vt_automode a parameter for checking whether voice touch is set as auto mode or not */ -int vc_elm_is_supported_vt_auto(bool* is_vt_automode); +int vc_elm_is_supported_vt_auto(int* is_vt_automode); #ifdef __cplusplus } diff --git a/src/vc_elm.c b/src/vc_elm.c index 19fd3ec..12ba992 100644 --- a/src/vc_elm.c +++ b/src/vc_elm.c @@ -44,6 +44,11 @@ static unsigned is_vc_elm_initialized = false; /** +* @brief An internal variable for checking whether voice touch's auto mode is ON or not. +*/ +static int g_is_vt_automode = 0; + +/** * @brief App domain name of the current app. */ static char *g_app_domain = NULL; @@ -109,7 +114,7 @@ static int __check_privilege_initialize() int ret = cynara_initialize(&p_cynara, NULL); if (CYNARA_API_SUCCESS != ret) VC_ELM_LOG_ERR("[ERROR] fail to initialize"); - + return ret == CYNARA_API_SUCCESS; } @@ -172,7 +177,17 @@ static int __vc_elm_check_privilege() } g_privilege_allowed = 1; - return VC_ELM_ERROR_NONE; + return VC_ELM_ERROR_NONE; +} + +void __vc_config_vtauto_changed_cb(keynode_t *key, void *data) +{ + int ret = vconf_get_bool(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, &g_is_vt_automode); + if (0 != ret) { + VC_ELM_LOG_ERR("Fail to get vconfkey(%s), current voice touch mode(%d)", key, g_is_vt_automode); + } + + return; } int vc_elm_initialize() @@ -196,6 +211,11 @@ int vc_elm_initialize() is_vc_elm_initialized = true; + /* Initialize voice touch's automode and Register to detect voice touch automode change */ + vconf_get_bool(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, &g_is_vt_automode); + + vconf_notify_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, __vc_config_vtauto_changed_cb, NULL); + VC_ELM_LOG_DBG("vc elm is initialized"); return VC_ELM_ERROR_NONE; } @@ -223,10 +243,14 @@ int vc_elm_deinitialize() eina_list_free(g_handlers_list); } + vconf_ignore_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, __vc_config_vtauto_changed_cb); + _vc_elm_core_fini(); - if (NULL != g_app_domain) + if (NULL != g_app_domain) { free(g_app_domain); + g_app_domain = NULL; + } is_vc_elm_initialized = false; VC_ELM_LOG_DBG("shutting down vc_elm"); @@ -938,32 +962,16 @@ int _vc_elm_get_text_domain(char **domain) return VC_ELM_ERROR_NONE; } -int _vc_elm_is_supported_vt_auto(bool* is_vt_automode) +int vc_elm_is_supported_vt_auto(int* is_vt_automode) { if (0 != __vc_elm_get_feature_enabled()) { return VC_ELM_ERROR_NOT_SUPPORTED; } - int ret = -1; - ret = vconf_get_bool(VC_VOICE_TOUCH_AUTOMODE, is_vt_automode); - - if (0 != ret) { - VC_ELM_LOG_DBG("Fail to get vconfkey"); - return VC_ELM_ERROR_OPERATION_FAILED; - } - - VC_ELM_LOG_DBG("Success to get vconfkey(%d)", (int)(*is_vt_automode)); - - return ret; -} - -int vc_elm_is_supported_vt_auto(bool* is_vt_automode) -{ - if (0 != __vc_elm_get_feature_enabled()) { - return VC_ELM_ERROR_NOT_SUPPORTED; - } + *is_vt_automode = g_is_vt_automode; + VC_ELM_LOG_DBG("Success to get vconfkey(%d)", *is_vt_automode); - return _vc_elm_is_supported_vt_auto(is_vt_automode); + return VC_ELM_ERROR_NONE; } int _vc_elm_set_auto_register_mode(int mode, int click_method) @@ -978,19 +986,14 @@ int _vc_elm_set_auto_register_mode(int mode, int click_method) int _vc_elm_get_auto_register_mode(int* mode, int* click_method) { - bool is_vt_auto; - if (0 != _vc_elm_is_supported_vt_auto(&is_vt_auto)) { - return VC_ELM_ERROR_OPERATION_FAILED; + if (0 == g_is_vt_automode) { + VC_ELM_LOG_DBG("vt_automode is FALSE"); + *mode = g_auto_mode; + *click_method = g_click_method; } else { - if (false == is_vt_auto) { - VC_ELM_LOG_DBG("vt_automode is FALSE"); - *mode = g_auto_mode; - *click_method = g_click_method; - } else { - VC_ELM_LOG_DBG("vt_automode is TRUE"); - *mode = (int)VC_ELM_MODE_AUTO_APPFW; - *click_method = g_click_method; - } + VC_ELM_LOG_DBG("vt_automode is TRUE"); + *mode = (int)VC_ELM_MODE_AUTO_APPFW; + *click_method = g_click_method; } VC_ELM_LOG_DBG("mode: %d, click_method: %d", *mode, *click_method); @@ -1004,17 +1007,12 @@ int vc_elm_set_auto_register_mode(int mode, int click_method) return VC_ELM_ERROR_NOT_SUPPORTED; } - bool is_vt_auto; - if (0 != _vc_elm_is_supported_vt_auto(&is_vt_auto)) { - return VC_ELM_ERROR_OPERATION_FAILED; + if (0 == g_is_vt_automode) { + VC_ELM_LOG_DBG("vt_automode is FALSE"); + return _vc_elm_set_auto_register_mode(mode, click_method); } else { - if (false == is_vt_auto) { - VC_ELM_LOG_DBG("vt_automode is FALSE"); - return _vc_elm_set_auto_register_mode(mode, click_method); - } else { - VC_ELM_LOG_DBG("vt_automode is TRUE"); - return _vc_elm_set_auto_register_mode((int)VC_ELM_MODE_AUTO_APPFW, click_method); - } + VC_ELM_LOG_DBG("vt_automode is TRUE"); + return _vc_elm_set_auto_register_mode((int)VC_ELM_MODE_AUTO_APPFW, click_method); } return _vc_elm_set_auto_register_mode(mode, click_method); diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 3c32ce7..d0cab60 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -299,7 +299,7 @@ static Eina_Bool _vc_elm_click_matched_object(const char* cmd, int click_method) while (NULL != parent_info) { if (EINA_TRUE == parent_info->focusable) { VC_ELM_LOG_DBG("Focusable Parent"); - char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address)); + const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address)); VC_ELM_LOG_DBG("type (%s)", widget_type); Elm_Object_Item* item = NULL; if (NULL != widget_type && !strcmp(widget_type, "Elm_Genlist")) { @@ -411,7 +411,7 @@ static Eina_Bool _vc_elm_click_matched_object_vt_auto(const char* cmd, int click while (NULL != parent_info) { if (EINA_TRUE == parent_info->focusable) { VC_ELM_LOG_DBG("Focusable Parent"); - const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address)); + const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address)); VC_ELM_LOG_DBG("type (%s)", widget_type); Elm_Object_Item* item = NULL; if (NULL != widget_type && !strcmp(widget_type, "Elm_Genlist")) { @@ -503,7 +503,7 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa } VC_ELM_LOG_DBG("command(%s)", temp); - char* action = NULL; + const char* action = NULL; if (strlen(cmd) > strlen(temp)) { action = &cmd[strlen(temp) + 1]; VC_ELM_LOG_DBG("action(%s)", &cmd[strlen(temp) + 1]); @@ -727,7 +727,7 @@ static Eina_List *__get_objects_of_visible_items(Evas_Object *parent, Elm_Object } evas_object_geometry_get(obj, &x_1, &y_1, &w_1, &h_1); - name = elm_widget_type_get(obj); + name = elm_widget_type_get((const Evas_Object *)obj); if (NULL != name && NULL == eina_hash_find(registered_item_map, name) && NULL != eina_hash_find(g_config_widget_map, name)) { Eina_List *list2 = eina_hash_find(g_config_widget_map, name); VC_ELM_LOG_DBG("CORE LIST action size %u", eina_list_count(list2)); @@ -1280,14 +1280,14 @@ static int __vc_add_commands_for_automode_vt_auto() Object_Info* parent = ea_object_dump_parent_widget_data_get(info); Object_Info* grand = ea_object_dump_parent_widget_data_get(parent); - char *widget_type = NULL; - widget_type = elm_widget_type_get((Evas_Object*)grand->address); + const char *widget_type = NULL; + widget_type = elm_widget_type_get((const Evas_Object*)grand->address); while (NULL == widget_type) { grand = ea_object_dump_parent_widget_data_get(grand); if (NULL == grand) { break; } - widget_type = elm_widget_type_get((Evas_Object*)grand->address); + widget_type = elm_widget_type_get((const Evas_Object*)grand->address); } VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type); @@ -2094,7 +2094,7 @@ static Eina_Bool __idle_enter(void *data) VC_ELM_LOG_DBG("Focused g_default %ud", elm_win_xwindow_get(g_default_window)); if (!is_focused) { /* window changed, we need to get new one */ - int count = eina_list_count(ui_objects_list); + unsigned int count = eina_list_count(ui_objects_list); VC_ELM_LOG_DBG("list count %d", count); if (0 == count) { /* TODO - get window object */ @@ -2102,7 +2102,6 @@ static Eina_Bool __idle_enter(void *data) Ecore_Evas *ee = NULL; Evas *evas = NULL; Eina_List *objs = NULL; - Evas_Object *obj = NULL; Evas_Object *window = NULL; EINA_LIST_FREE(ecore_evas_list, ee) { evas = ecore_evas_get(ee); diff --git a/src/vc_elm_core_default_widgets.c b/src/vc_elm_core_default_widgets.c index 73ed5c2..bdd95b0 100644 --- a/src/vc_elm_core_default_widgets.c +++ b/src/vc_elm_core_default_widgets.c @@ -206,7 +206,7 @@ static void __vc_elm_click_by_focus(Evas_Object *obj) { VC_ELM_LOG_DBG("obj(%p)", (void*)obj); - if (NULL != elm_widget_type_get(obj)) { + if (NULL != elm_widget_type_get((const Evas_Object *)obj)) { if (EINA_TRUE == elm_object_focus_get(obj)) { VC_ELM_LOG_DBG("Already focused"); ecore_timer_add(g_click_time, __click_event, NULL); @@ -233,7 +233,7 @@ static void __vc_elm_click_by_focus(Evas_Object *obj) } } -static void __emulate_click(const Evas_Object *obj) +static void __emulate_click(Evas_Object *obj) { int auto_mode = 0; int click_method = 0; @@ -694,7 +694,7 @@ static void __set_tooltips_position_on_visible_items(Evas_Object *parent, Elm_Ob evas_object_geometry_get(obj, &x_1, &y_1, &w_1, &h_1); if (x_1 + (w_1 / 2) >= x && y_1 + (h_1 / 2) >= y && (x_1 + (w_1 / 2)) <= (x + w) && (y_1 + (h_1 / 2)) <= (y + h)) { - const char *name = elm_widget_type_get(obj); + const char *name = elm_widget_type_get((const Evas_Object *)obj); if (name == NULL) { char *item_string = NULL; if (NULL != (item_string = evas_object_data_get(obj, VC_ELM_HINT_DATA_KEY))) @@ -1037,7 +1037,7 @@ static void __sub_layout_inspect(Eina_List *ret, Evas_Object *widget) (void)widget; EINA_LIST_FOREACH(list, l, obj) { - const char *type = elm_widget_type_get(obj); + const char *type = elm_widget_type_get((const Evas_Object *)obj); if (type && !strcmp(type, "Elm_Layout")) { evas_object_data_set(obj, VC_ELM_COLORSELECTOR_PARENT, widget); evas_object_data_set(obj, _vc_elm_get_custom_widget_name(), "Elm_Button"); @@ -1341,7 +1341,7 @@ static Eina_List *__entry_get_subwidgets(const Evas_Object *entry, void *user_da list = elm_widget_can_focus_child_list_get(entry); EINA_LIST_FOREACH(list, l, obj) { - const char *type = elm_widget_type_get(obj); + const char *type = elm_widget_type_get((const Evas_Object *)obj); const char *part = elm_object_part_text_get(obj, "mbe.label"); if (part) continue; diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index 8cdfc20..04604f1 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -23,6 +23,8 @@ #include "vc_elm_tools.h" #include "vc_elm_efl_dump.h" +#include + #define EVAS_OBJECT_DUMP_DEBUG #ifdef EVAS_OBJECT_DUMP_DEBUG #define VC_ELM_LOG_DUMP(fmt, ...) SLOGD("\033[0;32m" fmt "\033[m", ## __VA_ARGS__) @@ -60,9 +62,9 @@ static int g_geo_x = 0, g_geo_y = 0, g_geo_w = 0, g_geo_h = 0; static int find_popup = 0; static int skip_text = 0; -bool vc_elm_efl_dump_is_vt_auto_enabled() +int vc_elm_efl_dump_is_vt_auto_enabled() { - bool is_vt_automode = false; + int is_vt_automode = 0; int ret = vc_elm_is_supported_vt_auto(&is_vt_automode); if (0 != ret) { VC_ELM_LOG_DUMP("Fail to check vt auto mode"); @@ -341,7 +343,7 @@ static Eina_Bool _is_descendant_of_list(Object_Info *object_info) { Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info); while (NULL != parent_info) { - const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address)); + const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address)); if (NULL != widget_type) { VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type); if (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List") || !strcmp(widget_type, "Elm_Ctxpopup") || !strcmp(widget_type, "Elm_Index")) @@ -356,7 +358,7 @@ static Eina_Bool _is_descendant_of_toolbar(Object_Info *object_info) { Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info); while (NULL != parent_info) { - const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address)); + const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address)); if (NULL != widget_type) { VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type); if (!strcmp(widget_type, "Elm_Toolbar")) @@ -535,7 +537,7 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj } text = NULL; - if (false == vc_elm_efl_dump_is_vt_auto_enabled()) { + if (0 == vc_elm_efl_dump_is_vt_auto_enabled()) { if (!strcmp(evas_object_type_get(obj), "text")) text = eina_stringshare_add(evas_object_text_text_get(obj)); else if (!strcmp(evas_object_type_get(obj), "textblock")) { -- 2.7.4 From da9bfe306c042f201c8cafb0fc8a1f6f6e2fb98f Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Thu, 13 Jul 2017 15:20:13 +0900 Subject: [PATCH 11/16] Fix dlog level Change-Id: Ic55607abd7db392396a4bb47610747e998a3ea16 Signed-off-by: sooyeon.kim --- src/vc_elm_tools.h | 2 +- src/vc_elm_widget_wrapper.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vc_elm_tools.h b/src/vc_elm_tools.h index 7fa360a..68ff5a4 100644 --- a/src/vc_elm_tools.h +++ b/src/vc_elm_tools.h @@ -28,7 +28,7 @@ extern "C" { #define LOG_TAG "VC_ELM" -#define VC_ELM_LOG_DBG(fmt, ...) SLOGI("\033[0;32m" fmt "\033[m", ## __VA_ARGS__) +#define VC_ELM_LOG_DBG(fmt, ...) SLOGD("\033[0;32m" fmt "\033[m", ## __VA_ARGS__) #define VC_ELM_LOG_INFO(fmt, ...) SLOGI("\033[0;32m" fmt "\033[m", ## __VA_ARGS__) #define VC_ELM_LOG_ERR(fmt, ...) SLOGE("\033[0;32m" fmt "\033[m", ## __VA_ARGS__) #define VC_ELM_LOG_WARN(fmt, ...) SLOGW("\033[0;32m" fmt "\033[m", ## __VA_ARGS__) diff --git a/src/vc_elm_widget_wrapper.c b/src/vc_elm_widget_wrapper.c index 26258ce..a8f828c 100644 --- a/src/vc_elm_widget_wrapper.c +++ b/src/vc_elm_widget_wrapper.c @@ -68,7 +68,6 @@ static void __vc_language_changed_cb(const char *previous, const char *current, VC_CMD_ERROR_CHECK_CASE(VC_ERROR_ITERATION_END); \ VC_CMD_ERROR_CHECK_CASE(VC_ERROR_EMPTY); \ case VC_ERROR_NONE: \ - VC_ELM_LOG_DBG("NO error in (%s)", msg); \ break; \ default: \ VC_ELM_LOG_ERR("Unkown error in (%s)", msg); \ @@ -447,4 +446,4 @@ int _vc_elm_widget_wrapper_get_current_language(char** language) VC_ELM_LOG_ERR("[ERROR] Fail to get current language(%d)", ret); } return ret; -} \ No newline at end of file +} -- 2.7.4 From 2c9245c3e53836c8893bd372ca7bc1f35f4ad605 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 24 Jul 2017 13:00:38 +0900 Subject: [PATCH 12/16] Fix error level Change-Id: I2c1b8ef8a2286911bcb27a5b5b2bf890680fd3bc Signed-off-by: sooyeon.kim --- src/vc_elm_core.c | 20 +++++++------------- src/vc_elm_tooltip.c | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index d0cab60..b23aec2 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -225,7 +225,7 @@ static Eina_Bool __click_event(void *data) efl_util_input_deinitialize_generator(input_h); } - VC_ELM_LOG_INFO("click!!!!!"); + VC_ELM_LOG_INFO("clicked"); return EINA_FALSE; } @@ -273,7 +273,7 @@ static Eina_Bool _vc_elm_click_matched_object(const char* cmd, int click_method) evas_event_feed_mouse_move(evas_object_evas_get((Evas_Object*)(info->address)), x + w/2, y + h/2, 0, NULL); evas_event_feed_mouse_down(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 1, NULL); evas_event_feed_mouse_up(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 2, NULL); - VC_ELM_LOG_INFO("click!!!!!"); + VC_ELM_LOG_INFO("clicked"); } else if (1 == click_method) { VC_ELM_LOG_DBG("click method - focus/key"); bool clicked = false; @@ -530,13 +530,6 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa } return ret; } - - if (NULL != g_dump_list) { - ea_object_dump_list_clear(); - g_dump_list = NULL; - } - - return EINA_FALSE; } /* implementation */ @@ -1168,7 +1161,7 @@ struct vc_elm_core_widget_info *_vc_elm_core_register_widget(const char *widget_ struct vc_elm_core_widget_info *info = NULL; void *found = eina_hash_find(g_widget_info_hash, widget_name); if (found) { - VC_ELM_LOG_ERR("Widget already registered: %s", widget_name); + VC_ELM_LOG_DBG("Widget already registered: %s", widget_name); } else { info = malloc(sizeof(struct vc_elm_core_widget_info)); if (info != NULL) { @@ -1211,8 +1204,6 @@ void _vc_elm_core_register_action(struct vc_elm_core_widget_info *info, const ch static int __vc_add_commands_for_automode() { - VC_ELM_LOG_DBG("inside __vc_add_commands_for_automode()"); - if (NULL != g_dump_list) { ea_object_dump_list_clear(); g_dump_list = NULL; @@ -1237,6 +1228,8 @@ static int __vc_add_commands_for_automode() } } } + + VC_ELM_LOG_DBG("Finish to add commands for automode"); return 0; } @@ -1257,7 +1250,6 @@ static Elm_Object_Item* __vc_elm_core_get_object_item_from_geometry_info(Evas_Ob static int __vc_add_commands_for_automode_vt_auto() { - VC_ELM_LOG_DBG("inside __vc_add_commands_for_automode_vt_auto()"); if (NULL != g_dump_list) { ea_object_dump_list_clear(); g_dump_list = NULL; @@ -1321,6 +1313,8 @@ static int __vc_add_commands_for_automode_vt_auto() // } } } + + VC_ELM_LOG_DBG("Finish to add commands for automode when voice touch is set as auto"); return 0; } diff --git a/src/vc_elm_tooltip.c b/src/vc_elm_tooltip.c index 9c7fe78..3232d63 100644 --- a/src/vc_elm_tooltip.c +++ b/src/vc_elm_tooltip.c @@ -65,7 +65,7 @@ void _vc_elm_set_tooltips_window(Evas_Object *win) { g_win = win; evas_object_geometry_get(win, NULL, NULL, &win_width, &win_heigh); - VC_ELM_LOG_ERR("init %p %p", (void*)win, (void*)g_grid); + VC_ELM_LOG_DBG("init %p %p", (void*)win, (void*)g_grid); } static void __turn_on_tooltips() -- 2.7.4 From 28566a027dfd7e6ca7fa6fa0213edc403dc141b4 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 8 Aug 2017 16:55:45 +0900 Subject: [PATCH 13/16] Fix segmentation fault Change-Id: I9e4b841f310bed8d9964c873d96866e97524de82 Signed-off-by: sooyeon.kim --- src/vc_elm_core.c | 64 ++++++++++++++++++++++++++++----------------------- src/vc_elm_efl_dump.c | 21 ++++++++++++++--- 2 files changed, 53 insertions(+), 32 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index b23aec2..3bdc4e5 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -1271,38 +1271,44 @@ static int __vc_add_commands_for_automode_vt_auto() VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h); Object_Info* parent = ea_object_dump_parent_widget_data_get(info); Object_Info* grand = ea_object_dump_parent_widget_data_get(parent); - - const char *widget_type = NULL; - widget_type = elm_widget_type_get((const Evas_Object*)grand->address); - while (NULL == widget_type) { - grand = ea_object_dump_parent_widget_data_get(grand); - if (NULL == grand) { - break; - } + if (NULL != parent && NULL != grand) { + const char *widget_type = NULL; widget_type = elm_widget_type_get((const Evas_Object*)grand->address); - } - - VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type); - // VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", evas_object_type_get((Evas_Object*)info->address), evas_object_type_get((Evas_Object*)parent->address), evas_object_type_get((Evas_Object*)grand->address)); - - if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) { - int x = info->geometry_info.x; - int y = info->geometry_info.y; - int w = info->geometry_info.w; - int h = info->geometry_info.h; - Elm_Object_Item *it = __vc_elm_core_get_object_item_from_geometry_info((Evas_Object*)grand->address, widget_type, x, y, w, h); - if (NULL != it) { - _vc_elm_core_set_auto_item_object_command(it, info->text); - VC_ELM_LOG_DBG("Get object from geometry(%p)", it); + while (NULL == widget_type) { + grand = ea_object_dump_parent_widget_data_get(grand); + if (NULL == grand) { + break; + } + widget_type = elm_widget_type_get((const Evas_Object*)grand->address); } - } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Toolbar"))) { - Elm_Object_Item *it = elm_toolbar_item_find_by_label((Evas_Object*)grand->address, info->text); - if (NULL != it) { - _vc_elm_core_set_auto_item_object_command(it, info->text); - VC_ELM_LOG_DBG("Get object from label(%p)", it); + + VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type); + // VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", evas_object_type_get((Evas_Object*)info->address), evas_object_type_get((Evas_Object*)parent->address), evas_object_type_get((Evas_Object*)grand->address)); + + if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) { + int x = info->geometry_info.x; + int y = info->geometry_info.y; + int w = info->geometry_info.w; + int h = info->geometry_info.h; + Elm_Object_Item *it = __vc_elm_core_get_object_item_from_geometry_info((Evas_Object*)grand->address, widget_type, x, y, w, h); + if (NULL != it) { + _vc_elm_core_set_auto_item_object_command(it, info->text); + VC_ELM_LOG_DBG("Get object from geometry(%p)", it); + } + } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Toolbar"))) { + Elm_Object_Item *it = elm_toolbar_item_find_by_label((Evas_Object*)grand->address, info->text); + if (NULL != it) { + _vc_elm_core_set_auto_item_object_command(it, info->text); + VC_ELM_LOG_DBG("Get object from label(%p)", it); + } + } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Ctxpopup"))) { + /* TODO */ + } else { + if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) { + VC_ELM_LOG_ERR("Not supported widget"); + } + _vc_elm_core_set_auto_object_command((Evas_Object*)info->address, info->text); } - } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Ctxpopup"))) { - /* TODO */ } else { if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) { VC_ELM_LOG_ERR("Not supported widget"); diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index 04604f1..a3bafef 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -160,6 +160,10 @@ _edje_file_info_save(Ea_Util_Mgr *util_mgr, const Evas_Object *obj) EINA_LIST_FOREACH(parts, l, pname) { if ((pobj = edje_object_part_object_get(obj, pname))) { edje_info = malloc(sizeof(Edje_Info)); + if (!edje_info) { + VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory"); + return; + } edje_info->obj = pobj; edje_info->part_name = strdup(pname); ret = edje_object_part_state_get(obj, edje_info->part_name, &val); @@ -206,6 +210,10 @@ _obj_tree_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent) if (is_clip) goto next; object_info = calloc(1, sizeof(Object_Info)); + if (!object_info) { + VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory"); + return; + } object_info->parent = parent; @@ -434,6 +442,10 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj } object_info = calloc(1, sizeof(Object_Info)); + if (!object_info) { + VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory"); + return; + } object_info->parent = parent; @@ -575,10 +587,9 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj if (text && strlen(text) > 0) { object_info->text = calloc(1, strlen(text) + 1); strncpy(object_info->text, text, strlen(text) + 1); - - ret_list = eina_list_append(ret_list, object_info); } - +` + ret_list = eina_list_append(ret_list, object_info); next: if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) { children = evas_object_smart_members_get(obj); @@ -897,6 +908,10 @@ ea_object_dump_find_data(Eina_List *list, const char *str1, const char *str2) Object_Info* ea_object_dump_parent_widget_data_get(const Object_Info *obj_info) { + if (NULL == obj_info) { + return NULL; + } + Object_Info *parent_info = NULL; parent_info = obj_info->parent; -- 2.7.4 From 9e1a2a05eba7a9679493abdee6687defb4dc1a94 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Thu, 17 Aug 2017 19:33:06 +0900 Subject: [PATCH 14/16] Fix errata Change-Id: Iecc49533ecb7dc2b226435f71b39bcee4460037e Signed-off-by: sooyeon.kim --- src/vc_elm_efl_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index a3bafef..b71ec35 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -588,7 +588,7 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj object_info->text = calloc(1, strlen(text) + 1); strncpy(object_info->text, text, strlen(text) + 1); } -` + ret_list = eina_list_append(ret_list, object_info); next: if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) { -- 2.7.4 From 0eafc83d1f1875b0a2ba0c635b9fa55cb3601d35 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 25 Sep 2017 20:08:29 +0900 Subject: [PATCH 15/16] Add to register allowed part as candidate cmd Change-Id: Ibb786944b0f6fbc280f7fc6e2b24168e38fd6bb0 Signed-off-by: Wonnam Jang (cherry picked from commit 36e7a11f05fe9a14f7bee293685f72ccccd38110) --- src/vc_elm_core.c | 122 ++++++++++++++++++++++++++++---------------------- src/vc_elm_core.h | 2 +- src/vc_elm_efl_dump.c | 44 ++++++++++++++++++ 3 files changed, 113 insertions(+), 55 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 3bdc4e5..1ac1d9e 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -307,6 +307,11 @@ static Eina_Bool _vc_elm_click_matched_object(const char* cmd, int click_method) if (NULL == item) { item = elm_genlist_at_xy_item_get((Evas_Object*)(parent_info->address), x + w + w/2, y + h/2, NULL); } + } else if (NULL != widget_type && !strcmp(widget_type, "Elm_List")) { + item = elm_list_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, NULL); + if (NULL == item) { + item = elm_list_at_xy_item_get((Evas_Object*)(parent_info->address), x + w + w/2, y + h/2, NULL); + } } else if (NULL != widget_type && !strcmp(widget_type, "Elm_Gengrid")) { int xposret, yposret; item = elm_gengrid_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, &xposret, &yposret); @@ -1262,61 +1267,70 @@ static int __vc_add_commands_for_automode_vt_auto() EINA_LIST_FOREACH(g_dump_list, dump_iter, data) { Object_Info* info = (Object_Info*)data; - if (NULL != info && NULL != info->text /*&& NULL != info->part_name*/) { -// Eina_List *iter = NULL; -// char *part_name = NULL; -// EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) { -// if (NULL != part_name && !strcmp(part_name, info->part_name)) { - VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name); - VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h); - Object_Info* parent = ea_object_dump_parent_widget_data_get(info); - Object_Info* grand = ea_object_dump_parent_widget_data_get(parent); - if (NULL != parent && NULL != grand) { - const char *widget_type = NULL; - widget_type = elm_widget_type_get((const Evas_Object*)grand->address); - while (NULL == widget_type) { - grand = ea_object_dump_parent_widget_data_get(grand); - if (NULL == grand) { - break; - } - widget_type = elm_widget_type_get((const Evas_Object*)grand->address); - } + if (NULL != info && NULL != info->text) { + VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name); + VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h); + Object_Info* parent = ea_object_dump_parent_widget_data_get(info); + Object_Info* grand = ea_object_dump_parent_widget_data_get(parent); + + const char *widget_type = NULL; + if (NULL != parent && NULL != grand) { + widget_type = elm_widget_type_get((const Evas_Object*)grand->address); + while (NULL == widget_type) { + grand = ea_object_dump_parent_widget_data_get(grand); + if (NULL == grand) { + break; + } + widget_type = elm_widget_type_get((const Evas_Object*)grand->address); + } + } + VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), (!parent) ? "NULL" : elm_widget_type_get((Evas_Object*)parent->address), widget_type); + // VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", evas_object_type_get((Evas_Object*)info->address), evas_object_type_get((Evas_Object*)parent->address), evas_object_type_get((Evas_Object*)grand->address)); - VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type); - // VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", evas_object_type_get((Evas_Object*)info->address), evas_object_type_get((Evas_Object*)parent->address), evas_object_type_get((Evas_Object*)grand->address)); - - if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) { - int x = info->geometry_info.x; - int y = info->geometry_info.y; - int w = info->geometry_info.w; - int h = info->geometry_info.h; - Elm_Object_Item *it = __vc_elm_core_get_object_item_from_geometry_info((Evas_Object*)grand->address, widget_type, x, y, w, h); - if (NULL != it) { - _vc_elm_core_set_auto_item_object_command(it, info->text); - VC_ELM_LOG_DBG("Get object from geometry(%p)", it); - } - } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Toolbar"))) { - Elm_Object_Item *it = elm_toolbar_item_find_by_label((Evas_Object*)grand->address, info->text); - if (NULL != it) { - _vc_elm_core_set_auto_item_object_command(it, info->text); - VC_ELM_LOG_DBG("Get object from label(%p)", it); - } - } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Ctxpopup"))) { - /* TODO */ - } else { - if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) { - VC_ELM_LOG_ERR("Not supported widget"); - } - _vc_elm_core_set_auto_object_command((Evas_Object*)info->address, info->text); - } - } else { - if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) { - VC_ELM_LOG_ERR("Not supported widget"); - } - _vc_elm_core_set_auto_object_command((Evas_Object*)info->address, info->text); + if (NULL != widget_type && (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List"))) { + int x = info->geometry_info.x; + int y = info->geometry_info.y; + int w = info->geometry_info.w; + int h = info->geometry_info.h; + Elm_Object_Item *it = __vc_elm_core_get_object_item_from_geometry_info((Evas_Object*)grand->address, widget_type, x, y, w, h); + if (NULL != it) { + _vc_elm_core_set_auto_item_object_command(it, info->text); + VC_ELM_LOG_DBG("Get object from geometry(%p)", it); + continue; + } + } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Toolbar"))) { + Elm_Object_Item *it = elm_toolbar_item_find_by_label((Evas_Object*)grand->address, info->text); + if (NULL != it) { + _vc_elm_core_set_auto_item_object_command(it, info->text); + VC_ELM_LOG_DBG("Get object from label(%p)", it); + continue; + } + } else if (NULL != widget_type && (!strcmp(widget_type, "Elm_Ctxpopup"))) { + /* TODO */ + VC_ELM_LOG_ERR("TODO - Elm_Ctxpopup"); + } else { + VC_ELM_LOG_ERR("Not supported widget manually"); + } + } + if (NULL != info) { + if (NULL != info->text && NULL != info->part_name) { + Eina_List *iter = NULL; + char *part_name = NULL; + EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) { + if (NULL != part_name && !strcmp(part_name, info->part_name)) { + VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name); + VC_ELM_LOG_ERR("Widget is supported automatically with part name"); + _vc_elm_widget_wrapper_add_command(info->text, NULL); } -// } -// } + } + } else { + if (!_vc_elm_core_register_default_widget(_get_ui_object_name((Evas_Object*)info->address), EINA_FALSE, NULL) + || (NULL == eina_hash_find(_vc_elm_core_get_config_widget_map(), elm_widget_type_get((Evas_Object*)info->address)))) { + VC_ELM_LOG_ERR("Not supported widget"); + } + _vc_elm_core_set_auto_object_command((Evas_Object*)info->address, info->text); + continue; + } } } @@ -2189,7 +2203,7 @@ int _vc_elm_core_read_xml_data() VC_ELM_LOG_DBG("reading XML start"); doc = xmlParseFile(VC_ELM_CONFIG_XML); if (doc == NULL) { - VC_ELM_LOG_ERR("Failed to parse XML file"); + VC_ELM_LOG_ERR("Failed to parse XML file, path(%s)", VC_ELM_CONFIG_XML); return VC_ELM_ERROR_OPERATION_FAILED; } diff --git a/src/vc_elm_core.h b/src/vc_elm_core.h index 0b5de30..b241a20 100644 --- a/src/vc_elm_core.h +++ b/src/vc_elm_core.h @@ -32,7 +32,7 @@ extern "C" { */ //#define VC_ELM_CONFIG_XML VOICE_LIBDIR"/voice/vc-elm/1.0/voice-control-elm-config.xml" -#define VC_ELM_CONFIG_XML tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc-elm/1.0/voice-control-elm-config.xml") +#define VC_ELM_CONFIG_XML tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "voice/vc-elm/1.0/voice-control-elm-config.xml") #define VC_ELM_TAG_BASE_NAME "voice-control-elm-config" #define VC_ELM_TAG_ACTION_LIST "action-list" diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index b71ec35..db8ccb7 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -377,6 +377,32 @@ static Eina_Bool _is_descendant_of_toolbar(Object_Info *object_info) return EINA_FALSE; } +static Eina_Bool _has_accessible_name(Object_Info *object_info) +{ + Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info); + while (NULL != parent_info) { + char* text = NULL; + Evas_Object *obj = (Evas_Object *)(parent_info->address); + const char* widget_type = elm_widget_type_get(obj); + + if (NULL != widget_type) { + if (elm_atspi_accessible_name_get(obj) && EINA_TRUE == parent_info->focusable && EINA_TRUE == _is_clickable_object(obj)) { + text = elm_atspi_accessible_name_get(obj); + VC_ELM_LOG_DUMP("####### [DEBUG] atspi_text(%s)", text); + } else if (elm_atspi_accessible_name_get(obj) && !strcmp(widget_type, "Elm_Toolbar")) { + text = elm_atspi_accessible_name_get(obj); + VC_ELM_LOG_DUMP("####### [DEBUG] toolbar(%s)", text); + } + } + if (NULL != text) { + VC_ELM_LOG_DUMP("####### [DEBUG] widget_type(s), text(%s)", widget_type, text); + return EINA_TRUE; + } + parent_info = ea_object_dump_parent_widget_data_get(parent_info); + } + return EINA_FALSE; +} + static void _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent, Eina_Bool parent_widget_focusable, Eina_Bool list_type, int cnt) { @@ -582,6 +608,23 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj } else if (elm_atspi_accessible_name_get(obj) && !strcmp(evas_object_type_get(obj), "elm_layout") && EINA_TRUE == _is_descendant_of_toolbar(object_info)) { text = elm_atspi_accessible_name_get(obj); VC_ELM_LOG_DUMP("####### [DEBUG] toolbar(%s)", text); + } else { + if (EINA_FALSE == _has_accessible_name(object_info)) { + if (!strcmp(evas_object_type_get(obj), "text")) { + text = eina_stringshare_add(evas_object_text_text_get(obj)); + VC_ELM_LOG_DUMP("####### [DEBUG] text(%s), part_name(%s)", text, object_info->part_name); + } else if (!strcmp(evas_object_type_get(obj), "textblock")) { + ret = evas_object_textblock_text_markup_get(obj); + temp = evas_textblock_text_markup_to_utf8(obj, ret); + text = eina_stringshare_add(temp); + VC_ELM_LOG_DUMP("####### [DEBUG] textblock(%s), part_name(%s)", text, object_info->part_name); + + if (NULL != temp) { + free(temp); + temp = NULL; + } + } + } } } if (text && strlen(text) > 0) { @@ -909,6 +952,7 @@ Object_Info* ea_object_dump_parent_widget_data_get(const Object_Info *obj_info) { if (NULL == obj_info) { + VC_ELM_LOG_DUMP("obj_info is NULL"); return NULL; } -- 2.7.4 From 8dc8ada17202c9c708dfccf0d140dd893f0d6240 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Wed, 11 Oct 2017 16:34:29 +0900 Subject: [PATCH 16/16] Fix memory leaks and unreachable code Change-Id: I4b4012511474927adf9889431d6c46a67098c16f Signed-off-by: Suyeon Hwang --- src/vc_elm.c | 6 ++---- src/vc_elm_widget_wrapper.c | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vc_elm.c b/src/vc_elm.c index 12ba992..f8b6752 100644 --- a/src/vc_elm.c +++ b/src/vc_elm.c @@ -1010,12 +1010,10 @@ int vc_elm_set_auto_register_mode(int mode, int click_method) if (0 == g_is_vt_automode) { VC_ELM_LOG_DBG("vt_automode is FALSE"); return _vc_elm_set_auto_register_mode(mode, click_method); - } else { - VC_ELM_LOG_DBG("vt_automode is TRUE"); - return _vc_elm_set_auto_register_mode((int)VC_ELM_MODE_AUTO_APPFW, click_method); } - return _vc_elm_set_auto_register_mode(mode, click_method); + VC_ELM_LOG_DBG("vt_automode is TRUE"); + return _vc_elm_set_auto_register_mode((int)VC_ELM_MODE_AUTO_APPFW, click_method); } int vc_elm_get_auto_register_mode(int* mode, int* click_method) diff --git a/src/vc_elm_widget_wrapper.c b/src/vc_elm_widget_wrapper.c index a8f828c..235e720 100644 --- a/src/vc_elm_widget_wrapper.c +++ b/src/vc_elm_widget_wrapper.c @@ -134,6 +134,10 @@ static bool __cb(vc_cmd_h vc_command, void *user_data) vc_cmd_get_format(vc_command, &type); vc_cmd_get_command(vc_command, &cmd); VC_ELM_LOG_DBG("cmd: %s %d", cmd, type); + + if (NULL != cmd) { + free(cmd); + } return 1; } -- 2.7.4