From 578a1de645d220d39507aac1360e9a5fb4c828b0 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Thu, 2 Feb 2017 17:34:56 +0900 Subject: [PATCH 01/16] Fix object dump logic for popup Change-Id: I5b22b2ef482ed0808dffaf8a3e226e9de12ab5ea (cherry picked from commit 3e61aa680152704e50f262981dae461f4d0e6c83) --- src/vc_elm_efl_dump.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index 59d04f3..03d4e4b 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -326,6 +326,12 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj // visible check if (!evas_object_is_visible_get(obj)) return; + if (evas_object_type_match(obj, "elm_popup")) { + if (elm_object_part_text_get(obj, "title,text")) skip_text = 1; + eina_list_free(ret_list); + find_popup = 0; + } + if (find_popup) return; // viewport check @@ -337,11 +343,6 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; if (is_clip) goto next; - if (evas_object_type_match(obj, "elm_popup")) { - if (elm_object_part_text_get(obj, "title,text")) skip_text = 1; - eina_list_free(ret_list); - } - if (!strcmp(evas_object_type_get(obj), "text") || !strcmp(evas_object_type_get(obj), "textblock")) { if (!parent_widget_focusable && !list_type) goto next; if (skip_text) { -- 2.7.4 From 2abc7fee0954875dde6b036a83fb101d987d32ef Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Tue, 7 Feb 2017 15:18:00 +0900 Subject: [PATCH 02/16] Make function to simplify Change-Id: I751a1412b2657738f178beb39a5e93dde14161be Signed-off-by: Wonnam Jang (cherry picked from commit 11993207ffaa39f13e91734d7d42ac1018c9a04a) --- src/vc_elm_core.c | 244 +++++++++++++++++++++++++++++------------------------- 1 file changed, 133 insertions(+), 111 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index c442fb0..26c6f85 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -242,6 +242,106 @@ static void __focused_cb(void *data, Evas_Object *obj, void *event_info) } } +static Eina_Bool _vc_elm_click_matched_object(const char* cmd, int click_method) +{ + + 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; + 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; + break; + } + } + + if (false == clicked) { + 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"); + 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_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); + } + 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 @@ -289,94 +389,8 @@ 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); if (1 == auto_mode) { - 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) { - 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(%d) 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); - } else if (1 == click_method) { - VC_ELM_LOG_DBG("click method - focus/key"); - bool clicked = false; - 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) { - 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"); - 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_Gengrid")) { - int xposret, yposret; - item = elm_gengrid_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, &xposret, &yposret); - } - 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); - } - 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; + Eina_Bool ret = _vc_elm_click_matched_object(cmd, click_method); + return ret; } } @@ -1037,6 +1051,35 @@ void _vc_elm_core_register_action(struct vc_elm_core_widget_info *info, const ch } } +static int __vc_add_commands_for_automode() +{ + 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() { Eina_List *_l; @@ -1157,29 +1200,8 @@ 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 (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); - } - } - } + if (0 != __vc_add_commands_for_automode()) { + VC_ELM_LOG_ERR("Fail to add command in auto mode"); } } -- 2.7.4 From 1494bbc81258b45f903e8b478c85354b17112b88 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Wed, 15 Feb 2017 16:47:55 +0900 Subject: [PATCH 03/16] Update header and doc files written in English Change-Id: Iab290457fffb2a77281036bbfc74f4a0f9859c82 Signed-off-by: Suyeon Hwang (cherry picked from commit 4686c1f270ef7ca31203e36367e44fdb25bc09ca) --- doc/uix_voice_control_elm_doc.h | 14 +-- include/voice_control_elm.h | 257 +++++++++++++++++----------------------- 2 files changed, 112 insertions(+), 159 deletions(-) diff --git a/doc/uix_voice_control_elm_doc.h b/doc/uix_voice_control_elm_doc.h index f725d57..cf9bfe9 100644 --- a/doc/uix_voice_control_elm_doc.h +++ b/doc/uix_voice_control_elm_doc.h @@ -16,22 +16,19 @@ /** - * @defgroup VOICE_CONTROL_ELEMENTARY_MODULE Voice control elementary * @ingroup CAPI_UIX_FRAMEWORK + * @defgroup VOICE_CONTROL_ELEMENTARY_MODULE Voice control elementary * @brief The @ref VOICE_CONTROL_ELEMENTARY_MODULE API provides functions to control widget by voice commands. - * * @section VOICE_CONTROL_ELEMENTARY_MODULE_HEADER Required Header - * \#include + * \#include * * @section VOICE_CONTROL_ELEMENTARY_MODULE_OVERVIEW Overview * The voice control elementary API is provided for controlling widgets by voice commands. * The voice UI control provided by voice control elementary is done the following way: - * * - Each widget supported and currently visible in the application is given a text hint.
* - Widget hints are shown on the User's wish.
* - User speaks the hint name of the widget he/she wants to trigger and the action he/she wants to perform on that widget.
* - The voice command is interpreted and the requested action on the widget is performed.
- * * To use of voice control elementary, use the following steps:
* 1. Initialize voice control elementary
* 2. Register callback functions for notifications
@@ -41,7 +38,6 @@ * 6. Run action mapped widget which is spoken by user
* 7. Destroy handle
* 8. Uninitialize voice control elementary
- * * When window is updated by user's operation with touch, key or etc, it is needed to set command and hint creating evas object or elementary object item.
* And the callback function of action related to widget is called internally, when user speaks a particular widget's hint. * @@ -121,14 +117,12 @@ * * @section VOICE_CONTROL_ELEMENTARY_MODULE_FEATURE Related Features * This API is related with the following features:
- * - http://tizen.org/feature/microphone
- * - http://tizen.org/feature/speech.control
- * + * - http://tizen.org/feature/microphone
+ * - http://tizen.org/feature/speech.control
* 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. - * */ diff --git a/include/voice_control_elm.h b/include/voice_control_elm.h index 5b02ac8..e11ea7d 100644 --- a/include/voice_control_elm.h +++ b/include/voice_control_elm.h @@ -23,117 +23,116 @@ #include #include + /** * @addtogroup VOICE_CONTROL_ELEMENTARY_MODULE * @{ */ + #ifdef __cplusplus extern "C" { #endif + /** * @file voice_control_elm.h * @brief This file contains the voice control elementary API and related handle definitions and enums. */ + /** -* @brief This enum describes status of voice control elementary after API call +* @brief Enumeration for status of voice control elementary after API call. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { - VC_ELM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - VC_ELM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */ - VC_ELM_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ - VC_ELM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - VC_ELM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - VC_ELM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< voice control elementary NOT supported */ - VC_ELM_ERROR_INVALID_STATE = TIZEN_ERROR_VOICE_CONTROL | 0x021, /**< Invalid state */ - VC_ELM_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_VOICE_CONTROL | 0x022, /**< Invalid language */ - VC_ELM_ERROR_OPERATION_FAILED = TIZEN_ERROR_VOICE_CONTROL | 0x023, /**< Operation failed */ + VC_ELM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + VC_ELM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */ + VC_ELM_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ + VC_ELM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + VC_ELM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + VC_ELM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< voice control elementary NOT supported */ + VC_ELM_ERROR_INVALID_STATE = TIZEN_ERROR_VOICE_CONTROL | 0x021, /**< Invalid state */ + VC_ELM_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_VOICE_CONTROL | 0x022, /**< Invalid language */ + VC_ELM_ERROR_OPERATION_FAILED = TIZEN_ERROR_VOICE_CONTROL | 0x023, /**< Operation failed */ VC_ELM_ERROR_OPERATION_REJECTED = TIZEN_ERROR_VOICE_CONTROL | 0x024 /**< Operation rejected */ } vc_elm_error_e; + /** -* @brief This enum describes directions of the widget hints. +* @brief Enumeration for directions of the widget hints. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif -* * @see vc_elm_set_command_hint_direction() -* * @image html hints_orientation.png Example: various hints orientations. */ typedef enum { - VC_ELM_DIRECTION_CENTER = 0, /**< Direction displayed to the center of the widget */ - VC_ELM_DIRECTION_LEFT = 1, /**< Direction displayed to the left of the widget */ - VC_ELM_DIRECTION_RIGHT = 2, /**< Direction displayed to the right of the widget */ - VC_ELM_DIRECTION_TOP = 3, /**< Direction displayed to the top of the widget */ - VC_ELM_DIRECTION_BOTTOM = 4, /**< Direction displayed to the bottom of the widget */ - VC_ELM_DIRECTION_LEFT_TOP = 5, /**< Direction displayed to the top left corner of the widget */ - VC_ELM_DIRECTION_LEFT_BOTTOM = 6, /**< Direction displayed to the bottom left corner of the widget */ - VC_ELM_DIRECTION_RIGHT_TOP = 7, /**< Direction displayed to the top right corner of the widget */ - VC_ELM_DIRECTION_RIGHT_BOTTOM = 8 /**< Direction displayed to the bottom right corner of the widget */ + VC_ELM_DIRECTION_CENTER = 0, /**< Direction displayed to the center of the widget */ + VC_ELM_DIRECTION_LEFT = 1, /**< Direction displayed to the left of the widget */ + VC_ELM_DIRECTION_RIGHT = 2, /**< Direction displayed to the right of the widget */ + VC_ELM_DIRECTION_TOP = 3, /**< Direction displayed to the top of the widget */ + VC_ELM_DIRECTION_BOTTOM = 4, /**< Direction displayed to the bottom of the widget */ + VC_ELM_DIRECTION_LEFT_TOP = 5, /**< Direction displayed to the top left corner of the widget */ + VC_ELM_DIRECTION_LEFT_BOTTOM = 6, /**< Direction displayed to the bottom left corner of the widget */ + VC_ELM_DIRECTION_RIGHT_TOP = 7, /**< Direction displayed to the top right corner of the widget */ + VC_ELM_DIRECTION_RIGHT_BOTTOM = 8 /**< Direction displayed to the bottom right corner of the widget */ } vc_elm_direction_e; + /** -* @brief A handle to the voice control elementary for object or item object +* @brief The voice control elementary for object or item object handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef struct vc_elm_s* vc_elm_h; + /** * @brief Called to retrieve supported language. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif -* -* @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n -* followed by ISO 639-1 for the two-letter language code \n -* For example, "ko_KR" for Korean, "en_US" for American English +* @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code +* followed by ISO 639-1 for the two-letter language code +* For example, "ko_KR" for Korean, "en_US" for American English * @param[in] user_data The user data passed from the foreach function -* -* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop +* @return @c true to continue with the next iteration of the loop, +* @c false to break out of the loop * @pre The function will invoke this callback. -* * @see vc_elm_foreach_supported_languages() */ typedef bool (*vc_elm_supported_language_cb)(const char* language, void* user_data); + /** * @brief Called when default language is changed. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif -* * @param[in] previous Previous language * @param[in] current Current language * @param[in] user_data The user data passed from the callback registration function -* * @pre An application registers this callback to detect changing language. -* * @see vc_elm_set_current_language_changed_cb() */ typedef void (*vc_elm_current_language_changed_cb)(const char* previous, const char* current, void* user_data); + /** * @brief Called to retrieve supported widget. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif -* * @param[in] widget Widget name * @param[in] user_data The user data passed from the callback registration function -* -* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop +* @return @c true to continue with the next iteration of the loop, +* @c false to break out of the loop * @pre The function will invoke this callback. -* * @see vc_elm_foreach_supported_widgets() */ typedef bool (*vc_elm_widget_cb)(const char* widget, void* user_data); + /** * @brief Called to retrieve supported action. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif -* * @param[in] action Action name * @param[in] user_data The user data passed from the callback registration function -* -* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop +* @return @c true to continue with the next iteration of the loop, +* @c false to break out of the loop * @pre The function will invoke this callback. -* * @see vc_elm_foreach_supported_actions() */ typedef bool (*vc_elm_action_cb)(const char* action, void* user_data); @@ -142,75 +141,69 @@ typedef bool (*vc_elm_action_cb)(const char* action, void* user_data); /** * @brief Initializes voice control elementary module. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif -* * @remarks If the function succeeds, the voice control elementary must be released with vc_elm_deinitialize(). -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_OUT_OF_MEMORY Out of memory * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @see vc_elm_deinitialize() */ int vc_elm_initialize(void); + /** * @brief Deinitializes voice control elementary module. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_OUT_OF_MEMORY Out of memory * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. -* * @see vc_elm_initialize() */ int vc_elm_deinitialize(void); + /** * @brief Retrieves all supported languages using callback function. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] callback Callback function to invoke * @param[in] user_data The user data to be passed to the callback function -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. * @post This function invokes vc_supported_language_cb() repeatedly for getting languages. -* * @see vc_elm_supported_language_cb() * @see vc_elm_get_current_language() */ int vc_elm_foreach_supported_languages(vc_elm_supported_language_cb callback, void* user_data); + /** * @brief Gets current language. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @remark If the function succeeds, @a language must be released with free() by you when you no longer need it. -* -* @param[out] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n -* followed by ISO 639-1 for the two-letter language code \n -* For example, "ko_KR" for Korean, "en_US" for American English -* -* @return 0 on success, otherwise a negative error value +* @param[out] language A language is specified as an ISO 3166 alpha-2 two letter country-code +* followed by ISO 639-1 for the two-letter language code +* For example, "ko_KR" for Korean, "en_US" for American English +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OUT_OF_MEMORY Out of memory @@ -218,75 +211,69 @@ int vc_elm_foreach_supported_languages(vc_elm_supported_language_cb callback, vo * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. */ int vc_elm_get_current_language(char** language); + /** * @brief Retrieves all supported widget using callback function. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] callback Callback function to invoke * @param[in] user_data The user data to be passed to the callback function -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. * @post This function invokes vc_elm_widget_cb() repeatedly for getting widgets. -* * @see vc_elm_widget_cb() * @see vc_elm_foreach_supported_actions() */ int vc_elm_foreach_supported_widgets(vc_elm_widget_cb callback, void* user_data); + /** * @brief Retrieves all supported actions of widget using callback function. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] widget Widget name * @param[in] callback Callback function to invoke * @param[in] user_data The user data to be passed to the callback function -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful and widget name can get from vc_elm_foreach_supported_widgets(). * @post This function invokes vc_elm_action_cb() repeatedly for getting actions. -* * @see vc_elm_action_cb() * @see vc_elm_foreach_supported_widgets() */ int vc_elm_foreach_supported_actions(const char* widget, vc_elm_action_cb callback, void* user_data); + /** * @brief Gets action command of action. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* -* @remark If the function succeeds, @a command must be released with free() by you when you no longer need it. \n -* If command is NULL, the action is default action. The default action works by only command of widget. -* +* @remark If the function succeeds, @a command must be released with free() by you when you no longer need it. +* If command is NULL, the action is default action. The default action works by only command of widget. * @param[in] action Action name * @param[out] command Command for action -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OUT_OF_MEMORY Out of memory @@ -294,23 +281,21 @@ int vc_elm_foreach_supported_actions(const char* widget, vc_elm_action_cb callba * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. */ int vc_elm_get_action_command(const char* action, char** command); + /** -* @brief Creates vc elm handle for evas object. +* @brief Creates vc elm handle for Evas object. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @remarks If the function succeeds, The vc elm handle must be released with vc_elm_destroy(). -* * @param[in] object Evas object included in handle * @param[out] vc_elm The voice control elementary handle -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_OUT_OF_MEMORY Out of memory * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter @@ -318,244 +303,220 @@ int vc_elm_get_action_command(const char* action, char** command); * @retval #VC_ELM_ERROR_OPERATION_REJECTED Operation rejected when widget is not supported * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. -* * @see vc_elm_destroy() */ int vc_elm_create_object(Evas_Object* object, vc_elm_h* vc_elm); + /** * @brief Creates vc elm handle for elm object item. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @remarks If the function succeeds, The vc elm handle must be released with vc_elm_destroy(). -* * @param[in] item The elm Object item included in handle * @param[out] vc_elm Handle containing pointer to widget -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_OUT_OF_MEMORY Out of memory * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. -* * @see vc_elm_destroy() */ int vc_elm_create_item(Elm_Object_Item* item, vc_elm_h* vc_elm); + /** * @brief Destroys the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle containing pointer to widget -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_create_object() * @see vc_elm_create_item() */ int vc_elm_destroy(vc_elm_h vc_elm); + /** * @brief Sets command to the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle containing pointer to widget * @param[in] command Command's text -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful. * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_unset_command() */ int vc_elm_set_command(vc_elm_h vc_elm, const char* command); + /** * @brief Unsets command from the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle to include pointer to widget -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_set_command() */ int vc_elm_unset_command(vc_elm_h vc_elm); + /** -* @brief Set command hint for the handle. +* @brief Sets command hint for the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle containing pointer to widget * @param[in] hint Hint's text -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_unset_command_hint() */ int vc_elm_set_command_hint(vc_elm_h vc_elm, const char* hint); + /** -* @brief Unset command hint for the handle. +* @brief Unsets command hint for the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle containing pointer to widget -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_set_command_hint() */ int vc_elm_unset_command_hint(vc_elm_h vc_elm); + /** * @brief Sets the direction of hint to the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @remarks If direction is not set, default direction is pre-configured will be used. -* * @param[in] vc_elm Handle containing pointer to widget * @param[in] direction Direction of hint defined by #vc_elm_direction_e -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_set_command_hint() * @see vc_elm_get_command_hint_direction() */ int vc_elm_set_command_hint_direction(vc_elm_h vc_elm, vc_elm_direction_e direction); + /** * @brief Unsets the direction of hint from the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle containing pointer to widget * @param[out] direction Direction of hint defined by #vc_elm_direction_e -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_set_command_hint_direction() */ int vc_elm_get_command_hint_direction(vc_elm_h vc_elm, vc_elm_direction_e* direction); + /** * @brief Sets command hint's x,y position to the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle containing pointer to widget * @param[in] pos_x The x position of hint * @param[in] pos_y The y position of hint -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_set_command_hint() * @see vc_elm_get_command_hint_offset() */ int vc_elm_set_command_hint_offset(vc_elm_h vc_elm, int pos_x, int pos_y); + /** * @brief Gets command hint's x,y position from the handle. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] vc_elm Handle containing pointer to widget * @param[out] pos_x The x position of hint * @param[out] pos_y The y position of hint -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre The vc_elm handle should be valid with vc_elm_create_object() or vc_elm_create_item(). -* * @see vc_elm_set_command_hint_offset() */ int vc_elm_get_command_hint_offset(vc_elm_h vc_elm, int* pos_x, int* pos_y); @@ -566,37 +527,33 @@ int vc_elm_get_command_hint_offset(vc_elm_h vc_elm, int* pos_x, int* pos_y); * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* * @param[in] callback Callback function to register * @param[in] user_data The user data to be passed to the callback function -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. -* * @see vc_elm_unset_current_language_changed_cb() */ int vc_elm_set_current_language_changed_cb(vc_elm_current_language_changed_cb callback, void* user_data); + /** * @brief Unregisters the callback function. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder -* -* @return 0 on success, otherwise a negative error value +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_INVALID_STATE Invalid state * @retval #VC_ELM_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ELM_ERROR_NOT_SUPPORTED Not supported -* * @pre vc_elm_initialize() should be successful. -* * @see vc_elm_set_current_language_changed_cb() */ int vc_elm_unset_current_language_changed_cb(void); @@ -606,8 +563,10 @@ int vc_elm_unset_current_language_changed_cb(void); } #endif + /** * @}@} */ + #endif /* VOICE_CONTROL_ELEMENTARY_H_ */ -- 2.7.4 From f366adffe27825e6b8d9cd8930efb089a0d6b87f Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 23 Feb 2017 17:33:21 +0900 Subject: [PATCH 04/16] Add null check Change-Id: I797b00c8c9c3632ffb9876d618b6da586fd74ee1 Signed-off-by: Suyeon Hwang (cherry picked from commit 3d606974ada9a1dac33c299c7918f13b78fc75f2) --- src/vc_elm_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 26c6f85..0990910 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -290,7 +290,7 @@ static Eina_Bool _vc_elm_click_matched_object(const char* cmd, int click_method) } } - if (false == clicked) { + 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) { -- 2.7.4 From 6e631c114463242852d744ce58c619c597318fcf Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 20 Mar 2017 15:31:07 +0900 Subject: [PATCH 05/16] check eina_hash is empty Change-Id: I5992f81a0ac91dda34dd5ea3264766ba0a97c600 Signed-off-by: Wonnam Jang --- src/vc_elm_core.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 0990910..c1130ac 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -486,17 +486,25 @@ void _vc_elm_core_fini() g_allowed_text_part_list = NULL; } - eina_hash_free(g_widget_info_hash); - g_widget_info_hash = NULL; + if (0 != eina_hash_population(g_widget_info_hash)) { + eina_hash_free(g_widget_info_hash); + g_widget_info_hash = NULL; + } - eina_hash_free_buckets(registered_item_map); - eina_hash_free(registered_item_map); - registered_item_map = NULL; + if (0 != eina_hash_population(registered_item_map)) { + eina_hash_free_buckets(registered_item_map); + eina_hash_free(registered_item_map); + registered_item_map = NULL; + } - eina_hash_free(g_config_action_map); - g_config_action_map = NULL; - eina_hash_free(g_config_widget_map); - g_config_widget_map = NULL; + if (0 != eina_hash_population(g_config_action_map)) { + eina_hash_free(g_config_action_map); + g_config_action_map = NULL; + } + if (0 != eina_hash_population(g_config_widget_map)) { + eina_hash_free(g_config_widget_map); + g_config_widget_map = NULL; + } _vc_elm_core_destroy_xml_data(); #ifndef SRPOL_DEBUG -- 2.7.4 From df19dd7f8eeeac9a6ce4757df5e72ef1449faff6 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 15 Mar 2017 19:40:38 +0900 Subject: [PATCH 06/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 07/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 08/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 09/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 10/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 11/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 12/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 13/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 14/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 15/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 16/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