From 088577ae9848ddb82e11b3845adc4bbde8ef8ded Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 5 Jul 2016 19:42:23 +0900 Subject: [PATCH 01/16] Remove gcov option Change-Id: I7d6fa8ac1f0327c1c2e35d0cc2a253a841c52756 Signed-off-by: sooyeon.kim --- CMakeLists.txt | 2 +- packaging/voice-control-elm.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a07200..264dfba 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ INCLUDE(FindPkgConfig) # Build type SET(CMAKE_BUILD_TYPE "Release") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g -fprofile-arcs -ftest-coverage -D_GNU_SOURCE") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g -D_GNU_SOURCE") ADD_DEFINITIONS("-DVOICE_LIBDIR=\"${LIBDIR}\"") diff --git a/packaging/voice-control-elm.spec b/packaging/voice-control-elm.spec index 53bb2c9..d4ffdc3 100644 --- a/packaging/voice-control-elm.spec +++ b/packaging/voice-control-elm.spec @@ -42,7 +42,7 @@ voice-control-elm library development headers cp %{SOURCE1001} %{SOURCE1002} . %build -export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed,-lgcov" +export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed" rm -rf objdir mkdir objdir -- 2.7.4 From c332d968a38ee83cd14bb0791694eae56f7c78ac Mon Sep 17 00:00:00 2001 From: "stom.hwang" Date: Thu, 14 Jul 2016 17:08:44 +0900 Subject: [PATCH 02/16] Fix - Coding rule Change-Id: I846c6228dbe1f2331840a2a5fb8f77cf6a0f6f21 Signed-off-by: stom.hwang --- src/vc_elm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vc_elm.c b/src/vc_elm.c index 4c07845..ccd174a 100644 --- a/src/vc_elm.c +++ b/src/vc_elm.c @@ -144,7 +144,7 @@ static int __vc_elm_check_privilege() VC_ELM_LOG_ERR("[ERROR] Permission is denied"); return VC_ELM_ERROR_PERMISSION_DENIED; } else if (-1 == g_privilege_allowed) { - if (false == __check_privilege_initialize()){ + if (false == __check_privilege_initialize()) { VC_ELM_LOG_ERR("[ERROR] privilege initialize is failed"); return VC_ELM_ERROR_PERMISSION_DENIED; } -- 2.7.4 From bfb1d8f2065269a3cbc1ca7dd8b654bbd9c0bb4d Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Thu, 4 Aug 2016 17:07:47 +0900 Subject: [PATCH 03/16] Fix build bug for C++ Change-Id: Id96defc1fca75d34cdbeb78daa4a8cbc423f9f12 --- include/voice_control_elm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 include/voice_control_elm.h diff --git a/include/voice_control_elm.h b/include/voice_control_elm.h old mode 100755 new mode 100644 index 243e941..253bacc --- a/include/voice_control_elm.h +++ b/include/voice_control_elm.h @@ -608,7 +608,7 @@ int vc_elm_set_current_language_changed_cb(vc_elm_current_language_changed_cb ca int vc_elm_unset_current_language_changed_cb(void); -#ifdef _cplusplus +#ifdef __cplusplus } #endif -- 2.7.4 From f7cc5621ea36004021d65ccebe9f90b0ce6ff0ce Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Wed, 7 Sep 2016 18:36:08 +0900 Subject: [PATCH 04/16] Support internal method to set auto mode Change-Id: Icd1cc5412dce5f77eb3ea19816918797b5997c85 Signed-off-by: Kwangyoun Kim --- CMakeLists.txt | 2 +- data/po/CMakeLists.txt | 0 include/voice_control_elm_private.h | 47 +++ packaging/voice-control-elm.spec | 4 +- src/CMakeLists.txt | 1 + src/vc_elm.c | 70 ++++- src/vc_elm.h | 4 +- src/vc_elm_core.c | 190 +++++++++++- src/vc_elm_core.h | 6 +- src/vc_elm_core_default_widgets.c | 2 +- src/vc_elm_efl_dump.c | 578 ++++++++++++++++++++++++++++++++++++ src/vc_elm_efl_dump.h | 84 ++++++ src/vc_elm_main.h | 2 +- src/vc_elm_rectangle.c | 2 +- src/vc_elm_rectangle.h | 2 +- src/vc_elm_tools.h | 2 +- src/vc_elm_tooltip.c | 2 +- src/vc_elm_tooltip.h | 2 +- src/vc_elm_widget_wrapper.c | 2 +- src/vc_elm_widget_wrapper.h | 2 +- voice-control-elm-config.xml | 0 21 files changed, 989 insertions(+), 15 deletions(-) mode change 100755 => 100644 CMakeLists.txt mode change 100755 => 100644 data/po/CMakeLists.txt create mode 100644 include/voice_control_elm_private.h create mode 100644 src/vc_elm_efl_dump.c create mode 100644 src/vc_elm_efl_dump.h mode change 100755 => 100644 voice-control-elm-config.xml diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index 264dfba..f124b6e --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,7 @@ MESSAGE(STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB}) MESSAGE(STATUS "========================================") # Warning flags -ADD_DEFINITIONS("-Werror") # Generate all warnings as errors +#ADD_DEFINITIONS("-Werror") # Generate all warnings as errors ADD_DEFINITIONS("-Wall") # Generate all warnings ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings #ADD_DEFINITIONS("-pedantic") # Accept only pedantic code diff --git a/data/po/CMakeLists.txt b/data/po/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/include/voice_control_elm_private.h b/include/voice_control_elm_private.h new file mode 100644 index 0000000..2628fbe --- /dev/null +++ b/include/voice_control_elm_private.h @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2011-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +#ifndef VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ +#define VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ + +/** +* @internal +* @addtogroup VOICE_CONTROL_ELEMENTARY_PRIVATE_MODULE +* @{ +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +int vc_elm_set_auto_register_mode(int mode, int click_method); + +int vc_elm_get_auto_register_mode(int* mode, int* click_method); + +int vc_elm_add_allowed_text_part(const char* text_part); + +int vc_elm_remove_allowed_text_part(void); + +#ifdef __cplusplus +} +#endif + +/** + * @}@} + */ + +#endif /* VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ */ diff --git a/packaging/voice-control-elm.spec b/packaging/voice-control-elm.spec index d4ffdc3..2b498ba 100644 --- a/packaging/voice-control-elm.spec +++ b/packaging/voice-control-elm.spec @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(eina) BuildRequires: pkgconfig(edje) +BuildRequires: pkgconfig(capi-ui-efl-util) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(libtzplatform-config) @@ -96,4 +97,5 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice %files devel %manifest %{name}-devel.manifest %{_includedir}/voice_control_elm.h -%{_libdir}/pkgconfig/%{name}.pc +%{_includedir}/voice_control_elm_private.h +%{_libdir}/pkgconfig/%{name}.pc \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index acd0ead..c00e5ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,7 @@ SET(VC_ELM_PKGS evas eina ecore + capi-ui-efl-util elementary dlog libxml-2.0 diff --git a/src/vc_elm.c b/src/vc_elm.c index ccd174a..dfda5c1 100644 --- a/src/vc_elm.c +++ b/src/vc_elm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include "vc_elm_main.h" #include +#include #include "vc_elm.h" #include "vc_elm_core.h" @@ -62,6 +63,9 @@ static int g_feature_enabled = -1; static int g_privilege_allowed = -1; static cynara *p_cynara = NULL; +static int g_auto_mode = 0; +static int g_click_method = 0; + static int __vc_elm_get_feature_enabled() { if (0 == g_feature_enabled) { @@ -185,6 +189,7 @@ int vc_elm_initialize() _vc_elm_core_load(); is_vc_elm_initialized = true; + VC_ELM_LOG_DBG("vc elm is initialized"); return VC_ELM_ERROR_NONE; } @@ -961,6 +966,69 @@ int _vc_elm_get_text_domain(char **domain) return VC_ELM_ERROR_NONE; } +int _vc_elm_set_auto_register_mode(int mode, int click_method) +{ + g_auto_mode = mode; + g_click_method = 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; + + return 0; +} + +int vc_elm_set_auto_register_mode(int mode, int click_method) +{ + if (0 != __vc_elm_get_feature_enabled()) { + return VC_ELM_ERROR_NOT_SUPPORTED; + } + if (0 != __vc_elm_check_privilege()) { + return VC_ELM_ERROR_PERMISSION_DENIED; + } + + return _vc_elm_set_auto_register_mode(mode, click_method); +} + +int vc_elm_get_auto_register_mode(int* mode, int* click_method) +{ + if (0 != __vc_elm_get_feature_enabled()) { + return VC_ELM_ERROR_NOT_SUPPORTED; + } + if (0 != __vc_elm_check_privilege()) { + return VC_ELM_ERROR_PERMISSION_DENIED; + } + + return _vc_elm_get_auto_register_mode(mode, click_method); +} + +int vc_elm_add_allowed_text_part(const char* text_part) +{ + if (0 != __vc_elm_get_feature_enabled()) { + return VC_ELM_ERROR_NOT_SUPPORTED; + } + if (0 != __vc_elm_check_privilege()) { + return VC_ELM_ERROR_PERMISSION_DENIED; + } + + return _vc_elm_core_add_allowed_text_part(text_part); +} + +int vc_elm_remove_allowed_text_part(void) +{ + if (0 != __vc_elm_get_feature_enabled()) { + return VC_ELM_ERROR_NOT_SUPPORTED; + } + if (0 != __vc_elm_check_privilege()) { + return VC_ELM_ERROR_PERMISSION_DENIED; + } + + return _vc_elm_core_remove_allowed_text_part(); +} + #ifdef SRPOL_DEBUG /** * @brief Wrapper for making internal function public - for automated test purposes diff --git a/src/vc_elm.h b/src/vc_elm.h index 586b7f5..3e9db17 100644 --- a/src/vc_elm.h +++ b/src/vc_elm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -56,6 +56,8 @@ int _vc_elm_set_text_domain(const char *domain, const char *locale_dir); */ int _vc_elm_get_text_domain(char **domain); +int _vc_elm_set_auto_register_mode(int mode, int click_method); +int _vc_elm_get_auto_register_mode(int* mode, int* click_method); #ifdef __cplusplus } diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 6b08e1d..6001b57 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -31,6 +32,8 @@ #include "vc_elm_tooltip.h" #include "vc_elm_rectangle.h" +#include "vc_elm_efl_dump.h" + #ifdef _ #undef _ #endif @@ -64,6 +67,10 @@ static char *g_tooltips_show = NULL; static Ecore_Timer *g_animation_view_idler = NULL; static Eina_Bool g_view_changed = EINA_FALSE; +static Eina_List *g_dump_list = NULL; + +static Eina_List *g_allowed_text_part_list = NULL; + #define HIDE 0xa #define X_VISIBILITY_TOLERANCE 32.0 #define Y_VISIBILITY_TOLERANCE 54.0 @@ -201,6 +208,38 @@ const char *_get_ui_object_name(const Evas_Object *obj) return ret; } +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(0.5, __click_event, NULL); + } +} + /** * @brief Function that matches recognition result to the registered actions * and calls for action execution @@ -237,6 +276,84 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa free(tmp_cmd); return EINA_TRUE; + } else { + int auto_mode = 0; + 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"); + Object_Info* parent_info = ea_object_dump_parent_widget_data_get(info); + + if (NULL != parent_info && EINA_TRUE == parent_info->focusable) { + VC_ELM_LOG_DBG("Focusable Parent"); + VC_ELM_LOG_DBG("Click event"); + 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); + } else { + Object_Info* grand_info = ea_object_dump_parent_widget_data_get(parent_info); + while (NULL != grand_info) { + if (EINA_TRUE == grand_info->focusable) { + VC_ELM_LOG_DBG("Focusable Grand parent"); + Elm_Object_Item* item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w/2, y + h/2, NULL); + if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { + VC_ELM_LOG_DBG("Click event"); + evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); + elm_object_item_focus_set(item, EINA_TRUE); + elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + } else { + item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w + w/2, y + h/2, NULL); + if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { + VC_ELM_LOG_DBG("Click event 2"); + evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); + elm_object_item_focus_set(item, EINA_TRUE); + elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + } + } + break; + } else { + grand_info = ea_object_dump_parent_widget_data_get(grand_info); + } + } + } + VC_ELM_LOG_DBG("Nothing"); + } 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; + } } return EINA_FALSE; @@ -308,6 +425,11 @@ void _vc_elm_core_init() g_config_action_map = eina_hash_string_superfast_new(__hash_entry_stringshare_free_cb); g_config_widget_map = eina_hash_string_superfast_new(__hash_entry_eina_list_free_cb); + + if (NULL == g_allowed_text_part_list) { + g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, "elm.text"); + } + ret = _vc_elm_core_read_xml_data(); g_view_changed = EINA_FALSE; VC_ELM_LOG_DBG("XML RETURNED %d", ret); @@ -315,6 +437,16 @@ void _vc_elm_core_init() void _vc_elm_core_fini() { + if (NULL != g_allowed_text_part_list) { + char *data; + EINA_LIST_FREE(g_allowed_text_part_list, data) { + free(data); + data = NULL; + } + + g_allowed_text_part_list = NULL; + } + eina_hash_free(g_widget_info_hash); g_widget_info_hash = NULL; @@ -997,6 +1129,37 @@ static void __vc_add_commands() eina_stringshare_del(obj_name); } + 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) { + if (NULL != g_dump_list) { + ea_object_dump_list_clear(); + g_dump_list = NULL; + } + g_dump_list = ea_object_dump_full_list_get(); + 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); + } + } + } + } + } + _vc_elm_widget_wrapper_commit_commands(&__result_cb, NULL); } @@ -1861,3 +2024,28 @@ void _vc_elm_core_set_view_changed() g_view_changed = EINA_TRUE; __idle_changed(NULL); } + +int _vc_elm_core_add_allowed_text_part(const char* text_part) +{ + if (NULL == g_allowed_text_part_list) { + return -1; + } + + g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, text_part); + VC_ELM_LOG_DBG("Add Allowed text part (%s)", text_part); + return 0; +} + +int _vc_elm_core_remove_allowed_text_part() +{ + char *data; + + EINA_LIST_FREE(g_allowed_text_part_list, data) { + free(data); + data = NULL; + } + + g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, "elm.text"); + VC_ELM_LOG_DBG("Remove Allowed text part"); + return 0; +} diff --git a/src/vc_elm_core.h b/src/vc_elm_core.h index dd38b10..c014e7e 100644 --- a/src/vc_elm_core.h +++ b/src/vc_elm_core.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. @@ -509,6 +509,10 @@ void _vc_elm_core_unregister_view_change_detection(); void _vc_elm_core_set_view_changed(); +int _vc_elm_core_add_allowed_text_part(const char* text_part); + +int _vc_elm_core_remove_allowed_text_part(); + #ifdef __cplusplus } #endif diff --git a/src/vc_elm_core_default_widgets.c b/src/vc_elm_core_default_widgets.c index 22d60b0..9c8306a 100644 --- a/src/vc_elm_core_default_widgets.c +++ b/src/vc_elm_core_default_widgets.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c new file mode 100644 index 0000000..936af61 --- /dev/null +++ b/src/vc_elm_efl_dump.c @@ -0,0 +1,578 @@ +/* + * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file vc_elm_efl_dump.c + * @brief The private module for efl object dump. + * @author Jaeyong Hwang + */ + +#include "vc_elm_efl_dump.h" + +typedef struct _Ea_Util_Mgr +{ + Evas *evas; + FILE *fp; + + Eina_List *edje_part_name_list; + int x,y,w,h; +} Ea_Util_Mgr; + +typedef struct _Edje_Info +{ + const Evas_Object *obj; + + char *part_name; + const char *image_name; + const char *color_class; + +} Edje_Info; + +#define SPANS_COMMON(x1, w1, x2, w2) \ + (!(( (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)))) + +Eina_List *ret_list = NULL; +Eina_List *ret_text_list = NULL; + +static Eina_Bool +evas_object_is_visible_get(Evas_Object *obj) +{ + int r = 0, g = 0, b = 0, a = 0; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Evas_Object *clip = NULL; + int vis = 0; + + evas_object_color_get(obj, &r, &g, &b, &a); + evas_object_geometry_get(obj, &x, &y, &w, &h); + + if (evas_object_visible_get(obj)) vis = 1; + clip = evas_object_clip_get(obj); + if (clip) evas_object_color_get(obj, &r, &g, &b, &a); + if (clip && !evas_object_visible_get(clip)) vis = 0; + + if (clip && a == 0) vis = 0; + + if (0 == vis) + return EINA_FALSE; + else + return EINA_TRUE; +} + +static Eina_Bool +evas_object_type_match(const Evas_Object *obj, const char *type) +{ + int ret = strcmp(evas_object_type_get(obj), type); + + if (!ret) return EINA_TRUE; + return EINA_FALSE; +} + +static Eina_Bool +evas_object_is_swallow_rect(const Evas_Object *obj) +{ + int r = 0, g = 0, b = 0, a = 0; + + evas_object_color_get(obj, &r, &g, &b, &a); + if (!r && !g && !b && !a + && evas_object_pointer_mode_get(obj) == EVAS_OBJECT_POINTER_MODE_NOGRAB + && evas_object_pass_events_get(obj)) + return EINA_TRUE; + + return EINA_FALSE; +} + +static void +_extract_edje_file_name(Object_Info *object_info, const char *full_path) +{ + char name[255] = {0, }; + unsigned int i, cnt = 0; + + if (!full_path) return; + + for (i = 0; i < strlen(full_path); i++) + { + if (full_path[i] == '/') + { + cnt = 0; + continue; + } + name[cnt++] = full_path[i]; + } + name[cnt] = '\0'; + object_info->edje_file = calloc(1, strlen(name) + 1); + strncpy(object_info->edje_file, name, strlen(name) + 1); +} + +static void +_edje_file_info_save(Ea_Util_Mgr *util_mgr, const Evas_Object *obj) +{ + Evas_Object *ed = NULL; + const Evas_Object *pobj = NULL; + Eina_List *parts = NULL, *l = NULL; + Edje_Info *edje_info = NULL; + const char *file = NULL, *group = NULL, *pname = NULL, *ret = NULL; + double val = 0.0; + + if(!evas_object_type_match(obj, "edje")) return; + + edje_object_file_get(obj, &file, &group); + + ed = edje_edit_object_add(util_mgr->evas); // evas new ?? + if (edje_object_file_set(ed, file, group)) + { + parts = edje_edit_parts_list_get(ed); + EINA_LIST_FOREACH(parts, l, pname) + { + if ((pobj = edje_object_part_object_get(obj, pname))) + { + edje_info = malloc(sizeof(Edje_Info)); + edje_info->obj = pobj; + edje_info->part_name = strdup(pname); + ret = edje_object_part_state_get(obj, edje_info->part_name, &val); + + if (ret) + { + edje_info->color_class = edje_edit_state_color_class_get(ed, edje_info->part_name , ret, val); + edje_info->image_name = edje_edit_state_image_get(ed, edje_info->part_name , ret, val); + } + + util_mgr->edje_part_name_list = eina_list_append(util_mgr->edje_part_name_list, edje_info); + + } + } + edje_edit_string_list_free(parts); + } + evas_object_del(ed); +} + +static void +_obj_tree_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent) +{ + Eina_List *children = NULL, *l = NULL; + Evas_Object *child, *smart_parent_obj = NULL; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + int r = 0, g = 0, b = 0, a = 0; + const char *ret = NULL; + double val = 0.0; + const char *file = NULL, *key = NULL, *group = NULL, *text = NULL; + Edje_Info *edje_info = NULL; + Object_Info *object_info = NULL; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + object_info = calloc(1, sizeof(Object_Info)); + + object_info->parent = parent; + + object_info->address = (int)obj; + object_info->geometry_info.x = x; + object_info->geometry_info.y = y; + object_info->geometry_info.w = w; + object_info->geometry_info.h = h; + + if (elm_widget_is(obj)) + { + if (elm_object_focus_get(obj)) + object_info->focus = EINA_TRUE; + else + object_info->focus = EINA_FALSE; + + if (elm_widget_can_focus_get(obj) && + (!elm_object_disabled_get(obj))) + object_info->focusable = EINA_TRUE; + else + object_info->focusable = EINA_FALSE; + } + + // evas object type check + if (evas_object_is_swallow_rect(obj)) + { + object_info->type = calloc(1, strlen("swallow") + 1); + strncpy(object_info->type, "swallow", strlen("swallow") + 1); + } + else if (evas_object_type_match(obj, "rectangle")) + { + object_info->type = calloc(1, strlen("rect") + 1); + strncpy(object_info->type, "rect", strlen("rect") + 1); + evas_object_color_get(obj, &r, &g, &b, &a); + object_info->rgb_info.r = r; + object_info->rgb_info.g = g; + object_info->rgb_info.b = b; + object_info->rgb_info.a = a; + } + else + { + object_info->type = calloc(1, strlen(evas_object_type_get(obj)) + 1); + strncpy(object_info->type, evas_object_type_get(obj), strlen(evas_object_type_get(obj)) + 1); + } + + smart_parent_obj = evas_object_smart_parent_get(obj); + + // image info save + if (!strcmp(evas_object_type_get(obj), "elm_icon") || + !strcmp(evas_object_type_get(obj), "elm_image")) + { + elm_image_file_get(obj, &file, &key); + evas_object_data_set(obj, "image_name", file); + } + + // image name check + if (smart_parent_obj && evas_object_type_match(obj, "image") + && (evas_object_type_match(smart_parent_obj, "elm_icon") + || evas_object_type_match(smart_parent_obj, "elm_image"))) + { + if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) + { + _extract_edje_file_name(object_info, ret); + evas_object_data_del(smart_parent_obj, "edje_image_name"); + } + } + + // edje info save + if(evas_object_type_match(obj, "edje")) + { + edje_object_file_get(obj, &file, &group); + if (group) + { + object_info->group = calloc(1, strlen(group) + 1); + strncpy(object_info->group, group, strlen(group) + 1); + } + + _extract_edje_file_name(object_info, file); + _edje_file_info_save(util_mgr, obj); + } + + // edje info check + if( !is_clip && smart_parent_obj + && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) + { + EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) + { + if(edje_info->obj == obj) + { + if (edje_info->color_class) + { + object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1); + strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1); + } + + ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val); + object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1); + object_info->part_state = calloc(1, strlen(ret) + 1); + strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1); + strncpy(object_info->part_state, ret, strlen(ret) + 1); + + if (edje_info->image_name) + { + object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1); + strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1); + } + break; + } + } + } + + 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); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + 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); +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(util_mgr, child, object_info); + } +} + +static void +_obj_tree_text_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj) +{ + Eina_List *children = NULL, *l = NULL; + Evas_Object *child; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + const char *ret = NULL; + const char *text = NULL; + char* data = NULL; + Eina_Bool check; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + 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); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + if (text && strlen(text) > 0) + { + check = EINA_TRUE; + EINA_LIST_FOREACH(ret_text_list, l, data) + { + if (!strcmp(data, text)) + { + check = EINA_FALSE; + break; + } + } + if (check) ret_text_list = eina_list_append(ret_text_list, text); + } + +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_text_items(util_mgr, child); + } +} + +static void +_object_tree(Ea_Util_Mgr *util_mgr, int val) +{ + Eina_List *objs = NULL; + Evas_Object *obj = NULL; + + objs = evas_objects_in_rectangle_get(util_mgr->evas, SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE); + + if (val == 1) + { + EINA_LIST_FREE(objs, obj) + _obj_tree_items(util_mgr, obj, NULL); + } + else if (val == 2) + { + EINA_LIST_FREE(objs, obj) + _obj_tree_text_items(util_mgr, obj); + } +} + +void +ea_object_dump_list_clear(void) +{ + Object_Info *obj_info = NULL; + EINA_LIST_FREE(ret_list, obj_info) + free(obj_info); + + ret_list = NULL; +} + +Eina_List* +ea_object_dump_full_list_get(void) +{ + Eina_List *ecore_evas_list = NULL; + Ecore_Evas *ee = NULL; + Evas *evas = NULL; + + if (!ret_list) + ea_object_dump_list_clear(); + + Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr)); + if (!util_mgr) + { + printf("Fail : utility manager memory alloc\n"); + goto exit; + } + + ecore_evas_list = ecore_evas_ecore_evas_list_get(); + + EINA_LIST_FREE(ecore_evas_list, ee) + { + evas = ecore_evas_get(ee); + util_mgr->evas = evas; + + ecore_wl_sync(); + util_mgr->x = 0; + util_mgr->y = 0; + ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); + + + _object_tree(util_mgr, 1); + } + +exit: + if (!util_mgr) return NULL; + if (util_mgr->edje_part_name_list) + eina_list_free(util_mgr->edje_part_name_list); // need to check + free(util_mgr); + return ret_list; +} + +Eina_List* +ea_object_dump_text_list_get(void) +{ + Eina_List *ecore_evas_list = NULL; + Ecore_Evas *ee = NULL; + Evas *evas = NULL; + + Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr)); + if (!util_mgr) + { + printf("Fail : utility manager memory alloc\n"); + goto exit; + } + + ecore_evas_list = ecore_evas_ecore_evas_list_get(); + + EINA_LIST_FREE(ecore_evas_list, ee) + { + evas = ecore_evas_get(ee); + util_mgr->evas = evas; + + ecore_wl_sync(); + util_mgr->x = 0; + util_mgr->y = 0; + ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); + + _object_tree(util_mgr, 2); + } + +exit: + if (!util_mgr) return NULL; + free(util_mgr); + return ret_text_list; +} + +Eina_List* +ea_object_dump_find_data(Eina_List *list, const char *str1, const char *str2) +{ + Eina_List *l = NULL; + Object_Info *data = NULL; + Eina_List *ret_data_list = NULL; + + if (!list) return NULL; + if (!str1 || !str2) return NULL; + + if (!strcmp(str1, "type")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->type) + if (!strcmp(data->type, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + else if (!strcmp(str1, "edje_file")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->edje_file) + if (!strcmp(data->edje_file, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + else if (!strcmp(str1, "group")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->group) + if (!strcmp(data->group, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + else if (!strcmp(str1, "image_name")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->image_name) + if (!strcmp(data->image_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + else if (!strcmp(str1, "color_class")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->color_class) + if (!strcmp(data->color_class, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + else if (!strcmp(str1, "part_name")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->part_name) + if (!strcmp(data->part_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + else if (!strcmp(str1, "part_state")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->part_state) + if (!strcmp(data->part_state, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + else if (!strcmp(str1, "text")) + { + EINA_LIST_FOREACH(list, l, data) + { + if (data->text) + if (!strcmp(data->text, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + + return ret_data_list; +} + +Object_Info* +ea_object_dump_parent_widget_data_get(const Object_Info *obj_info) +{ + Object_Info *parent_info = NULL; + + parent_info = obj_info->parent; + while (parent_info) + { + if (strstr(parent_info->type, "elm")) + return parent_info; + parent_info = parent_info->parent; + } + return NULL; +} diff --git a/src/vc_elm_efl_dump.h b/src/vc_elm_efl_dump.h new file mode 100644 index 0000000..3962b0e --- /dev/null +++ b/src/vc_elm_efl_dump.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file vc_elm_efl_dump.h + * @brief The private module for efl object dump. + * @author Jaeyong Hwang + */ + +#ifndef __VC_ELM_EFL_DUMP_H__ +#define __VC_ELM_EFL_DUMP_H__ + +#include + +#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT +#include + +#define ELM_INTERNAL_API_ARGESFSDFEFC +#include + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif +typedef struct _Object_Info Object_Info; + +struct _Object_Info +{ + Object_Info *parent; + char *type; + char *edje_file; + char *group; + char *image_name; + char *color_class; + int address; + + struct + { + Evas_Coord x; + Evas_Coord y; + Evas_Coord w; + Evas_Coord h; + }geometry_info; + char *part_name; + char *part_state; + char *text; + struct + { + Evas_Coord r; + Evas_Coord g; + Evas_Coord b; + Evas_Coord a; + }rgb_info; + Eina_Bool focusable; + Eina_Bool focus; +}; + +void ea_object_dump_list_clear(void); +Eina_List *ea_object_dump_full_list_get(void); +Eina_List *ea_object_dump_text_list_get(void); +Eina_List *ea_object_dump_find_data(Eina_List*, const char*, const char*); +Object_Info *ea_object_dump_parent_widget_data_get(const Object_Info*); + +#ifdef __cplusplus +} +#endif + +#endif /* __VC_ELM_EFL_DUMP_H__ */ diff --git a/src/vc_elm_main.h b/src/vc_elm_main.h index 4980f48..6f4dbae 100644 --- a/src/vc_elm_main.h +++ b/src/vc_elm_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_rectangle.c b/src/vc_elm_rectangle.c index 54b4aad..5d9f40c 100644 --- a/src/vc_elm_rectangle.c +++ b/src/vc_elm_rectangle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_rectangle.h b/src/vc_elm_rectangle.h index 7896483..da39d17 100644 --- a/src/vc_elm_rectangle.h +++ b/src/vc_elm_rectangle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_tools.h b/src/vc_elm_tools.h index f3d12fc..ce298f3 100644 --- a/src/vc_elm_tools.h +++ b/src/vc_elm_tools.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_tooltip.c b/src/vc_elm_tooltip.c index 961b481..9c7fe78 100644 --- a/src/vc_elm_tooltip.c +++ b/src/vc_elm_tooltip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_tooltip.h b/src/vc_elm_tooltip.h index 083eaa5..63912b3 100644 --- a/src/vc_elm_tooltip.h +++ b/src/vc_elm_tooltip.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_widget_wrapper.c b/src/vc_elm_widget_wrapper.c index b544b5e..290298e 100644 --- a/src/vc_elm_widget_wrapper.c +++ b/src/vc_elm_widget_wrapper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/src/vc_elm_widget_wrapper.h b/src/vc_elm_widget_wrapper.h index b5dd698..64f6298 100644 --- a/src/vc_elm_widget_wrapper.h +++ b/src/vc_elm_widget_wrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. diff --git a/voice-control-elm-config.xml b/voice-control-elm-config.xml old mode 100755 new mode 100644 -- 2.7.4 From 44fe1828a52b98ccfb884b25e7ce1bb947cdb89c Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Mon, 19 Sep 2016 16:24:49 +0900 Subject: [PATCH 05/16] Fix memory check bug and Add description Change-Id: I65240815e1045634612b8620d99938e388948bb8 --- include/voice_control_elm_private.h | 73 +++++++++++++++++++++++++++++++++++++ src/vc_elm_core.c | 54 ++++++++++++++------------- 2 files changed, 101 insertions(+), 26 deletions(-) diff --git a/include/voice_control_elm_private.h b/include/voice_control_elm_private.h index 2628fbe..efdd4ef 100644 --- a/include/voice_control_elm_private.h +++ b/include/voice_control_elm_private.h @@ -28,12 +28,85 @@ extern "C" { #endif +/** +* @brief Set auto command-register mode and click method for recognized object. +* @since_tizen 3.0 +* @privilege %http://tizen.org/privilege/recorder +* +* @param[in] mode The mode of auto register +* @param[in] click_method The click method for recognized object +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ELM_ERROR_NONE Successful +* @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. +* +* @see vc_elm_get_auto_register_mode() +*/ int vc_elm_set_auto_register_mode(int mode, int click_method); +/** +* @brief Get auto command-register mode and click method for recognized object. +* @since_tizen 3.0 +* @privilege %http://tizen.org/privilege/recorder +* +* @param[out] mode The mode of auto register +* @param[out] click_method The click method for recognized object +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ELM_ERROR_NONE Successful +* @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. +* +* @see vc_elm_set_auto_register_mode() +*/ int vc_elm_get_auto_register_mode(int* mode, int* click_method); +/** +* @brief Add allowed text part for auto command register. +* @since_tizen 3.0 +* @privilege %http://tizen.org/privilege/recorder +* +* @param[in] text_part The text part of elemenatry widget +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ELM_ERROR_NONE Successful +* @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. +* +* @see vc_elm_remove_allowed_text_part() +*/ int vc_elm_add_allowed_text_part(const char* text_part); +/** +* @brief Remove the list of additional allowed text part for auto command register. +* @since_tizen 3.0 +* @privilege %http://tizen.org/privilege/recorder +* +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ELM_ERROR_NONE Successful +* @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. +* +* @see vc_elm_add_allowed_text_part() +*/ int vc_elm_remove_allowed_text_part(void); #ifdef __cplusplus diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 6001b57..4ba91e0 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -305,39 +305,41 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa } else if (1 == click_method) { VC_ELM_LOG_DBG("click method - focus/key"); Object_Info* parent_info = ea_object_dump_parent_widget_data_get(info); - - if (NULL != parent_info && EINA_TRUE == parent_info->focusable) { - VC_ELM_LOG_DBG("Focusable Parent"); - VC_ELM_LOG_DBG("Click event"); - 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); - } else { - Object_Info* grand_info = ea_object_dump_parent_widget_data_get(parent_info); - while (NULL != grand_info) { - if (EINA_TRUE == grand_info->focusable) { - VC_ELM_LOG_DBG("Focusable Grand parent"); - Elm_Object_Item* item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w/2, y + h/2, NULL); - if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { - VC_ELM_LOG_DBG("Click event"); - evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); - elm_object_item_focus_set(item, EINA_TRUE); - elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); - } else { - item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w + w/2, y + h/2, NULL); + if (NULL != parent_info) { + if (EINA_TRUE == parent_info->focusable) { + VC_ELM_LOG_DBG("Focusable Parent"); + VC_ELM_LOG_DBG("Click event"); + 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); + } else { + Object_Info* grand_info = ea_object_dump_parent_widget_data_get(parent_info); + while (NULL != grand_info) { + if (EINA_TRUE == grand_info->focusable) { + VC_ELM_LOG_DBG("Focusable Grand parent"); + Elm_Object_Item* item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w/2, y + h/2, NULL); if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { - VC_ELM_LOG_DBG("Click event 2"); + VC_ELM_LOG_DBG("Click event"); evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); elm_object_item_focus_set(item, EINA_TRUE); elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + } else { + item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w + w/2, y + h/2, NULL); + if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { + VC_ELM_LOG_DBG("Click event 2"); + evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); + elm_object_item_focus_set(item, EINA_TRUE); + elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + } } + break; + } else { + grand_info = ea_object_dump_parent_widget_data_get(grand_info); } - break; - } else { - grand_info = ea_object_dump_parent_widget_data_get(grand_info); } } + } else { + VC_ELM_LOG_DBG("No parent info"); } - VC_ELM_LOG_DBG("Nothing"); } else { VC_ELM_LOG_DBG("Invalid click method"); } @@ -427,7 +429,7 @@ void _vc_elm_core_init() if (NULL == g_allowed_text_part_list) { - g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, "elm.text"); + g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, strdup("elm.text")); } ret = _vc_elm_core_read_xml_data(); @@ -2045,7 +2047,7 @@ int _vc_elm_core_remove_allowed_text_part() data = NULL; } - g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, "elm.text"); + g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, strdup("elm.text")); VC_ELM_LOG_DBG("Remove Allowed text part"); return 0; } -- 2.7.4 From bda4e7eebf9e4bfef605ead9f9d83e023d505eb1 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Mon, 19 Sep 2016 21:45:12 +0900 Subject: [PATCH 06/16] Fix bug about already focused item click Change-Id: I292657fb4ce8025d2d9cc6c43b0c00c4ef313f6e --- src/vc_elm_core.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 4ba91e0..284ad3d 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -309,8 +309,13 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa if (EINA_TRUE == parent_info->focusable) { VC_ELM_LOG_DBG("Focusable Parent"); VC_ELM_LOG_DBG("Click event"); - 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); + if (EINA_TRUE == elm_object_focus_get((Evas_Object*)parent_info->address)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(0.5, __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); + } } else { Object_Info* grand_info = ea_object_dump_parent_widget_data_get(parent_info); while (NULL != grand_info) { @@ -319,16 +324,26 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa Elm_Object_Item* item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w/2, y + h/2, NULL); if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { VC_ELM_LOG_DBG("Click event"); - evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); - elm_object_item_focus_set(item, EINA_TRUE); - elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + if (EINA_TRUE == elm_object_item_focus_get((Evas_Object*)grand_info->address)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(0.5, __click_event, NULL); + } else { + evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); + elm_object_item_focus_set(item, EINA_TRUE); + elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + } } else { item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w + w/2, y + h/2, NULL); if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { VC_ELM_LOG_DBG("Click event 2"); - evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); - elm_object_item_focus_set(item, EINA_TRUE); - elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + if (EINA_TRUE == elm_object_item_focus_get((Evas_Object*)grand_info->address)) { + VC_ELM_LOG_DBG("Already focused"); + ecore_timer_add(0.5, __click_event, NULL); + } else { + evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); + elm_object_item_focus_set(item, EINA_TRUE); + elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); + } } } break; -- 2.7.4 From 407c4a89f82cd1daf39b4a7a4fdd591450dcfb77 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Tue, 20 Sep 2016 13:33:11 +0900 Subject: [PATCH 07/16] Fix bug for click event Change-Id: I0445c7e7171bd914bb2d03c28957cf24157a9293 --- src/vc_elm_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 284ad3d..fd7c2d9 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -324,7 +324,7 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa Elm_Object_Item* item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w/2, y + h/2, NULL); 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((Evas_Object*)grand_info->address)) { + if (EINA_TRUE == elm_object_item_focus_get(item)) { VC_ELM_LOG_DBG("Already focused"); ecore_timer_add(0.5, __click_event, NULL); } else { @@ -336,7 +336,7 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w + w/2, y + h/2, NULL); if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { VC_ELM_LOG_DBG("Click event 2"); - if (EINA_TRUE == elm_object_item_focus_get((Evas_Object*)grand_info->address)) { + if (EINA_TRUE == elm_object_item_focus_get(item)) { VC_ELM_LOG_DBG("Already focused"); ecore_timer_add(0.5, __click_event, NULL); } else { -- 2.7.4 From 24934132add1094aacf3fe12b711b49c9b9f241a Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 21 Sep 2016 17:13:33 +0900 Subject: [PATCH 08/16] Check passing parameter is null Change-Id: I90fb9d7f6aa835522f6f238c75850185d05289b2 Signed-off-by: Wonnam Jang --- src/vc_elm_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index fd7c2d9..91f96dc 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -252,6 +252,12 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa const Eina_List *l; struct Wrapped_Command *wrapped; struct Wrapped_Command *found = NULL; + + if (NULL == cmd) { + VC_ELM_LOG_ERR("Invalid parameter, cmd is null"); + return EINA_FALSE; + } + VC_ELM_LOG_INFO("Trying to recognize %s %s %s", cmd, param1, param2); EINA_LIST_FOREACH(g_wrapped_commands, l, wrapped) { -- 2.7.4 From bf0c3c37cc9db3c62eb804c328cd7ab2f9642e4b Mon Sep 17 00:00:00 2001 From: "stom.hwang" Date: Thu, 29 Sep 2016 18:51:44 +0900 Subject: [PATCH 09/16] Fix svace issues Change-Id: I46458eec46811d738673a69b193ad3f4dcf30841 Signed-off-by: stom.hwang --- src/vc_elm_core.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) mode change 100644 => 100755 src/vc_elm_core.c diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c old mode 100644 new mode 100755 index 91f96dc..c35866e --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -904,7 +904,6 @@ void _show_tooltips() Eina_List *_l; Evas_Object *obj = NULL; Evas_Object *parent = NULL; - struct vc_elm_core_widget_info *info = NULL; const char *obj_name = NULL; const char *parent_obj_name = NULL; Evas_Coord x; @@ -921,7 +920,6 @@ void _show_tooltips() VC_ELM_LOG_DBG("show_tooltips"); EINA_LIST_FOREACH(g_current_ui_objects, _l, obj) { parent = elm_object_parent_widget_get(obj); - info = NULL; obj_name = _get_ui_object_name(obj); parent_obj_name = _get_ui_object_name(parent); @@ -954,7 +952,7 @@ void _show_tooltips() if ((y < y_p - Y_VISIBILITY_TOLERANCE) || (y + h > y_p + h_p + Y_VISIBILITY_TOLERANCE) || (x < x_p - X_VISIBILITY_TOLERANCE) || (x + w > y_p + w_p + X_VISIBILITY_TOLERANCE)) continue; } - } else if (NULL == (info = eina_hash_find(g_widget_info_hash, obj_name))) { + } else if (NULL == eina_hash_find(g_widget_info_hash, obj_name)) { VC_ELM_LOG_DBG("[TOOLTIP] Widget type '%s' not supported", obj_name); continue; } else if (!strcmp(obj_name, "Elm_Naviframe")) { @@ -1851,7 +1849,7 @@ int _vc_elm_core_read_xml_data() } root = main_node->xmlChildrenNode; - do { + while (root != NULL) { VC_ELM_LOG_DBG("Root nodes mames %s", root->name); if (0 == xmlStrcmp(root->name, XML_CAST VC_ELM_TAG_BASE_NAME)) { cur = root->xmlChildrenNode; @@ -1865,11 +1863,11 @@ int _vc_elm_core_read_xml_data() if (0 == xmlStrcmp(cur->name, XML_CAST VC_ELM_TAG_ACTION_LIST)) { child = cur->xmlChildrenNode; VC_ELM_LOG_DBG("xml pointer last %s %p", cur->last->name, (void *)cur->last); - do { + while (child != NULL) { if (0 == xmlStrcmp(child->name, XML_CAST VC_ELM_TAG_ACTION_GROUP)) { const char *action_name = NULL; tmp = child->xmlChildrenNode; - do { + while (tmp != NULL) { if (0 == xmlStrcmp(tmp->name, XML_CAST VC_ELM_TAG_ACTION_NAME)) { key = xmlNodeGetContent(tmp); VC_ELM_LOG_DBG("action name %s", (char *)key); @@ -1886,17 +1884,17 @@ int _vc_elm_core_read_xml_data() xmlFree(key); } tmp = tmp->next; - } while (tmp != NULL); + } } child = child->next; - } while (child != NULL); + } } else if (0 == xmlStrcmp(cur->name, XML_CAST VC_ELM_TAG_WIDGET_LIST)) { child = cur->xmlChildrenNode; - do { + while (child != NULL) { if (0 == xmlStrcmp(child->name, XML_CAST VC_ELM_TAG_WIDGET_GROUP)) { const char *widget_name = NULL; tmp = child->xmlChildrenNode; - do { + while (tmp != NULL) { if (0 == xmlStrcmp(tmp->name, XML_CAST VC_ELM_TAG_WIDGET_NAME)) { key = xmlNodeGetContent(tmp); VC_ELM_LOG_DBG("widget name %s", (char *)key); @@ -1905,7 +1903,7 @@ int _vc_elm_core_read_xml_data() } else if (0 == xmlStrcmp(tmp->name, XML_CAST VC_ELM_TAG_WIDGET_ACTIONS)) { xmlNodePtr actions = tmp->xmlChildrenNode; Eina_List *actions_list = NULL; - do { + while (actions != NULL) { if (0 == xmlStrcmp(actions->name, XML_CAST VC_ELM_TAG_ACTION_NAME)) { const char *action_tag = NULL; key = xmlNodeGetContent(actions); @@ -1915,18 +1913,18 @@ int _vc_elm_core_read_xml_data() xmlFree(key); } actions = actions->next; - } while (actions != NULL); + } if (widget_name != NULL && actions_list != NULL) eina_hash_add(g_config_widget_map, widget_name, actions_list); } tmp = tmp->next; - } while (tmp != NULL); + } } child = child->next; - } while (child != NULL); + } } else if (0 == xmlStrcmp(cur->name, XML_CAST VC_ELM_TAG_HINT_GROUP)) { child = cur->xmlChildrenNode; - do { + while (child != NULL) { if (0 == xmlStrcmp(child->name, XML_CAST VC_ELM_TAG_HINT_SHOW)) { key = xmlNodeGetContent(child); VC_ELM_LOG_DBG("hint show %s", (char*)key); @@ -1951,13 +1949,13 @@ int _vc_elm_core_read_xml_data() xmlFree(key); } child = child->next; - } while (child != NULL); + } } cur = cur->next; } while (cur != NULL); } else if (0 == xmlStrcmp(root->name, XML_CAST VC_ELM_TAG_BASE_INFO)) { cur = root->xmlChildrenNode; - do { + while (cur != NULL) { if (0 == xmlStrcmp(cur->name, XML_CAST VC_ELM_TAG_TIZEN_VERSION)) { key = xmlNodeGetContent(cur); VC_ELM_LOG_DBG("hint direction %s", (char*)key); @@ -1972,10 +1970,10 @@ int _vc_elm_core_read_xml_data() xmlFree(key); } cur = cur->next; - } while (cur != NULL); + } } root = root->next; - } while (root != NULL); + } xmlFreeDoc(doc); -- 2.7.4 From 53334f80f694a046ec94ec5d4a3bb2c9a33f2883 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Tue, 4 Oct 2016 14:22:16 +0900 Subject: [PATCH 10/16] Fix duplicated command and invalid memory access Change-Id: Icda3505c49bca006d02d7bac145d81838ab850fd --- include/voice_control_elm_private.h | 1 + src/vc_elm.c | 17 +++++++++++++++-- src/vc_elm_core.c | 6 ++++-- src/vc_elm_efl_dump.c | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) mode change 100755 => 100644 src/vc_elm_core.c diff --git a/include/voice_control_elm_private.h b/include/voice_control_elm_private.h index efdd4ef..494d612 100644 --- a/include/voice_control_elm_private.h +++ b/include/voice_control_elm_private.h @@ -80,6 +80,7 @@ int vc_elm_get_auto_register_mode(int* mode, int* click_method); * @return 0 on success, otherwise a negative error value * @retval #VC_ELM_ERROR_NONE Successful * @retval #VC_ELM_ERROR_OPERATION_FAILED Operation failed +* @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 diff --git a/src/vc_elm.c b/src/vc_elm.c index dfda5c1..18acf2f 100644 --- a/src/vc_elm.c +++ b/src/vc_elm.c @@ -1014,7 +1014,16 @@ int vc_elm_add_allowed_text_part(const char* text_part) return VC_ELM_ERROR_PERMISSION_DENIED; } - return _vc_elm_core_add_allowed_text_part(text_part); + if (NULL == text_part) { + VC_ELM_LOG_ERR("Invalid parameter"); + return VC_ELM_ERROR_INVALID_PARAMETER; + } + + if (0 != _vc_elm_core_add_allowed_text_part(text_part)) { + return VC_ELM_ERROR_OPERATION_FAILED; + } + + return VC_ELM_ERROR_NONE; } int vc_elm_remove_allowed_text_part(void) @@ -1026,7 +1035,11 @@ int vc_elm_remove_allowed_text_part(void) return VC_ELM_ERROR_PERMISSION_DENIED; } - return _vc_elm_core_remove_allowed_text_part(); + if (0 != _vc_elm_core_remove_allowed_text_part()) { + return VC_ELM_ERROR_OPERATION_FAILED; + } + + return VC_ELM_ERROR_NONE; } #ifdef SRPOL_DEBUG diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c old mode 100755 new mode 100644 index c35866e..31e506e --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -1655,8 +1655,10 @@ static void __show_or_hide_tooltips_callback(bool show_or_hide) { VC_ELM_LOG_DBG("tooltips %d", show_or_hide); g_tooltips_displayed = show_or_hide; - if (show_or_hide) + if (show_or_hide) { + _vc_elm_widget_wrapper_clear_commands(); _show_tooltips(); + } else _hide_tooltips(); } @@ -2052,7 +2054,7 @@ int _vc_elm_core_add_allowed_text_part(const char* text_part) return -1; } - g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, text_part); + g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, strdup(text_part)); VC_ELM_LOG_DBG("Add Allowed text part (%s)", text_part); return 0; } diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index 936af61..f59c03e 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -20,6 +20,7 @@ * @author Jaeyong Hwang */ +#include "vc_elm_tools.h" #include "vc_elm_efl_dump.h" typedef struct _Ea_Util_Mgr -- 2.7.4 From 2ad301356bcd3ddb43cc88069d6b3047a93d9f2c Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Fri, 28 Oct 2016 21:42:11 +0900 Subject: [PATCH 11/16] Update dump method for get only focusable text list Change-Id: I1a316d6257731545446dcfb92e0de18b6f189c95 --- src/vc_elm_core.c | 6 +- src/vc_elm_efl_dump.c | 272 ++++++++++++++++++++++++++++++++++++++++++-- src/vc_elm_efl_dump.h | 4 +- src/vc_elm_widget_wrapper.c | 2 +- 4 files changed, 269 insertions(+), 15 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 31e506e..594198b 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -1159,7 +1159,7 @@ static void __vc_add_commands() ea_object_dump_list_clear(); g_dump_list = NULL; } - g_dump_list = ea_object_dump_full_list_get(); + 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; @@ -1717,7 +1717,7 @@ static void __vc_elm_event_window_focus_in(void *data, Evas_Object *obj, void *e (void)obj; (void)event_info; - vc_widget_set_foreground(EINA_TRUE); + //vc_widget_set_foreground(EINA_TRUE); VC_ELM_LOG_DBG("Focus in"); } @@ -1731,7 +1731,7 @@ static void __vc_elm_event_window_focus_out(void *data, Evas_Object *obj, void * (void)obj; (void)event_info; - vc_widget_set_foreground(EINA_FALSE); + //vc_widget_set_foreground(EINA_FALSE); _vc_elm_turn_off_tooltips(); diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index f59c03e..74a7aa2 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -325,6 +325,179 @@ next: } 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_List *children = NULL, *l = NULL; + Evas_Object *child, *smart_parent_obj = NULL; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + int r = 0, g = 0, b = 0, a = 0; + const char *ret = NULL; + double val = 0.0; + const char *file = NULL, *key = NULL, *group = NULL, *text = NULL; + Edje_Info *edje_info = NULL; + Object_Info *object_info = NULL; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + if (!strcmp(evas_object_type_get(obj), "text") || !strcmp(evas_object_type_get(obj), "textblock")) + { + if (!parent_widget_focusable) goto next; + } + + object_info = calloc(1, sizeof(Object_Info)); + + object_info->parent = parent; + + object_info->address = (int)obj; + object_info->geometry_info.x = x; + object_info->geometry_info.y = y; + object_info->geometry_info.w = w; + object_info->geometry_info.h = h; + + if (elm_widget_is(obj)) + { + if (elm_object_focus_get(obj)) + object_info->focus = EINA_TRUE; + else + object_info->focus = EINA_FALSE; + + if (elm_widget_can_focus_get(obj) && + (!elm_object_disabled_get(obj))) + { + object_info->focusable = EINA_TRUE; + parent_widget_focusable = EINA_TRUE; + } + else + { + object_info->focusable = EINA_FALSE; + parent_widget_focusable = EINA_FALSE; + } + } + + // evas object type check + if (evas_object_is_swallow_rect(obj)) + { + object_info->type = calloc(1, strlen("swallow") + 1); + strncpy(object_info->type, "swallow", strlen("swallow") + 1); + } + else if (evas_object_type_match(obj, "rectangle")) + { + object_info->type = calloc(1, strlen("rect") + 1); + strncpy(object_info->type, "rect", strlen("rect") + 1); + evas_object_color_get(obj, &r, &g, &b, &a); + object_info->rgb_info.r = r; + object_info->rgb_info.g = g; + object_info->rgb_info.b = b; + object_info->rgb_info.a = a; + } + else + { + object_info->type = calloc(1, strlen(evas_object_type_get(obj)) + 1); + strncpy(object_info->type, evas_object_type_get(obj), strlen(evas_object_type_get(obj)) + 1); + } + + smart_parent_obj = evas_object_smart_parent_get(obj); + + // image info save + if (!strcmp(evas_object_type_get(obj), "elm_icon") || + !strcmp(evas_object_type_get(obj), "elm_image")) + { + elm_image_file_get(obj, &file, &key); + evas_object_data_set(obj, "image_name", file); + } + + // image name check + if (smart_parent_obj && evas_object_type_match(obj, "image") + && (evas_object_type_match(smart_parent_obj, "elm_icon") + || evas_object_type_match(smart_parent_obj, "elm_image"))) + { + if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) + { + _extract_edje_file_name(object_info, ret); + evas_object_data_del(smart_parent_obj, "edje_image_name"); + } + } + + // edje info save + if(evas_object_type_match(obj, "edje")) + { + edje_object_file_get(obj, &file, &group); + if (group) + { + object_info->group = calloc(1, strlen(group) + 1); + strncpy(object_info->group, group, strlen(group) + 1); + } + + _extract_edje_file_name(object_info, file); + _edje_file_info_save(util_mgr, obj); + } + + // edje info check + if( !is_clip && smart_parent_obj + && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) + { + EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) + { + if(edje_info->obj == obj) + { + if (edje_info->color_class) + { + object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1); + strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1); + } + + ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val); + object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1); + object_info->part_state = calloc(1, strlen(ret) + 1); + strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1); + strncpy(object_info->part_state, ret, strlen(ret) + 1); + + if (edje_info->image_name) + { + object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1); + strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1); + } + break; + } + } + } + + 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); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + 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); +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); + } +} + +static void _obj_tree_text_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj) { Eina_List *children = NULL, *l = NULL; @@ -380,7 +553,72 @@ next: } static void -_object_tree(Ea_Util_Mgr *util_mgr, int val) +_obj_tree_text_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Eina_Bool parent_widget_focusable) +{ + Eina_List *children = NULL, *l = NULL; + Evas_Object *child; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + const char *ret = NULL; + const char *text = NULL; + char* data = NULL; + Eina_Bool check; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + if (elm_widget_is(obj)) + { + if (elm_widget_can_focus_get(obj)) parent_widget_focusable = EINA_TRUE; + else parent_widget_focusable = EINA_FALSE; + } + + text = NULL; + if (!strcmp(evas_object_type_get(obj), "text")) + { + if (!parent_widget_focusable) goto next; + text = eina_stringshare_add(evas_object_text_text_get(obj)); + } + else if (!strcmp(evas_object_type_get(obj), "textblock")) + { + if (!parent_widget_focusable) goto next; + ret = evas_object_textblock_text_markup_get(obj); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + if (text && strlen(text) > 0) + { + check = EINA_TRUE; + EINA_LIST_FOREACH(ret_text_list, l, data) + { + if (!strcmp(data, text)) + { + check = EINA_FALSE; + break; + } + } + if (check) ret_text_list = eina_list_append(ret_text_list, text); + } + +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_text_items_exclude_unfocusable_text(util_mgr, child, parent_widget_focusable); + } +} + +static void +_object_tree(Ea_Util_Mgr *util_mgr, int val, Eina_Bool exclude_unfocusable_text) { Eina_List *objs = NULL; Evas_Object *obj = NULL; @@ -389,13 +627,29 @@ _object_tree(Ea_Util_Mgr *util_mgr, int val) if (val == 1) { - EINA_LIST_FREE(objs, obj) - _obj_tree_items(util_mgr, obj, NULL); + if (exclude_unfocusable_text) + { + EINA_LIST_FREE(objs, obj) + _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE); + } + else + { + EINA_LIST_FREE(objs, obj) + _obj_tree_items(util_mgr, obj, NULL); + } } else if (val == 2) { - EINA_LIST_FREE(objs, obj) - _obj_tree_text_items(util_mgr, obj); + if (exclude_unfocusable_text) + { + EINA_LIST_FREE(objs, obj) + _obj_tree_text_items_exclude_unfocusable_text(util_mgr, obj, EINA_FALSE); + } + else + { + EINA_LIST_FREE(objs, obj) + _obj_tree_text_items(util_mgr, obj); + } } } @@ -410,7 +664,7 @@ ea_object_dump_list_clear(void) } Eina_List* -ea_object_dump_full_list_get(void) +ea_object_dump_full_list_get(Eina_Bool exclude_unfocusable_text) { Eina_List *ecore_evas_list = NULL; Ecore_Evas *ee = NULL; @@ -439,7 +693,7 @@ ea_object_dump_full_list_get(void) ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); - _object_tree(util_mgr, 1); + _object_tree(util_mgr, 1, exclude_unfocusable_text); } exit: @@ -451,7 +705,7 @@ exit: } Eina_List* -ea_object_dump_text_list_get(void) +ea_object_dump_text_list_get(Eina_Bool exclude_unfocusable_text) { Eina_List *ecore_evas_list = NULL; Ecore_Evas *ee = NULL; @@ -476,7 +730,7 @@ ea_object_dump_text_list_get(void) util_mgr->y = 0; ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); - _object_tree(util_mgr, 2); + _object_tree(util_mgr, 2, exclude_unfocusable_text); } exit: diff --git a/src/vc_elm_efl_dump.h b/src/vc_elm_efl_dump.h index 3962b0e..e51dacb 100644 --- a/src/vc_elm_efl_dump.h +++ b/src/vc_elm_efl_dump.h @@ -72,8 +72,8 @@ struct _Object_Info }; void ea_object_dump_list_clear(void); -Eina_List *ea_object_dump_full_list_get(void); -Eina_List *ea_object_dump_text_list_get(void); +Eina_List *ea_object_dump_full_list_get(Eina_Bool); +Eina_List *ea_object_dump_text_list_get(Eina_Bool); Eina_List *ea_object_dump_find_data(Eina_List*, const char*, const char*); Object_Info *ea_object_dump_parent_widget_data_get(const Object_Info*); diff --git a/src/vc_elm_widget_wrapper.c b/src/vc_elm_widget_wrapper.c index 290298e..2841c84 100644 --- a/src/vc_elm_widget_wrapper.c +++ b/src/vc_elm_widget_wrapper.c @@ -219,7 +219,7 @@ static void __vc_state_changed_cb(vc_state_e previous, vc_state_e current, void break; case VC_STATE_READY: curr = "VC_STATE_READY"; - vc_widget_set_foreground(EINA_TRUE); + //vc_widget_set_foreground(EINA_TRUE); vc_widget_get_current_language(&tmp_lang); if (NULL != tmp_lang) { int ret = asprintf(&lang, "%s.UTF-8", tmp_lang); -- 2.7.4 From a7d087d22c0af5e0e8d8fa09b5c42cd6fb6a07b5 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 2 Nov 2016 18:02:48 +0900 Subject: [PATCH 12/16] Fix memory leak Change-Id: I6e72255dd1741c1c77ac1f5a2c174c2402a884e2 Signed-off-by: Wonnam Jang --- src/vc_elm_core.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 594198b..706ec14 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -192,6 +192,7 @@ static void __rotation(void *data, Evas_Object *obj, void *event_info); static int __is_hidden_widget(Evas_Object *obj); +static void __vc_elm_core_free_default_actions(); /** * @brief Function that returns the name of the widget @@ -470,6 +471,8 @@ void _vc_elm_core_fini() g_allowed_text_part_list = NULL; } + __vc_elm_core_free_default_actions(); + eina_hash_free(g_widget_info_hash); g_widget_info_hash = NULL; @@ -1014,6 +1017,45 @@ struct vc_elm_core_widget_info *_vc_elm_core_register_widget(const char *widget_ return info; } +static void __vc_elm_core_free_action(const char* widget_name) +{ + struct vc_elm_core_widget_info *info = NULL; + info = eina_hash_find(g_widget_info_hash, widget_name); + + if (!info) { + VC_ELM_LOG_ERR("Widget was not registered: %s", widget_name); + } else { + free(info->actions); + info->actions = NULL; + VC_ELM_LOG_ERR("Widget action is freed: %s", widget_name); + } +} + +static void __vc_elm_core_free_default_actions() +{ + __vc_elm_core_free_action("Elm_Genlist"); + __vc_elm_core_free_action("Elm_Radio"); + __vc_elm_core_free_action("Elm_Bubble"); + __vc_elm_core_free_action("Elm_Check"); + __vc_elm_core_free_action("Elm_List"); + __vc_elm_core_free_action("Elm_Slider"); + __vc_elm_core_free_action("Elm_Colorselector"); + __vc_elm_core_free_action("simple_hue_colorbar_activator"); + __vc_elm_core_free_action("simple_saturation_colorbar_activator"); + __vc_elm_core_free_action("simple_value_colorbar_activator"); + __vc_elm_core_free_action("Elm_Spinner"); + __vc_elm_core_free_action("Elm_Panes"); + __vc_elm_core_free_action("Elm_Toolbar"); + __vc_elm_core_free_action("Elm_Entry"); + __vc_elm_core_free_action("Elm_Multibuttonentry"); + __vc_elm_core_free_action("elm_item"); + __vc_elm_core_free_action("Elm_Gengrid"); + __vc_elm_core_free_action("Elm_Button"); + __vc_elm_core_free_action("Elm_Scroller"); + __vc_elm_core_free_action("Elm_Hoversel"); + __vc_elm_core_free_action("Elm_Label"); +} + void _vc_elm_core_register_action(struct vc_elm_core_widget_info *info, const char *action_name, void *data, vc_elm_action_activator_cb action_activator_func) { unsigned int idx = 0; -- 2.7.4 From e4d04fcd3f55151b7ef9696d175699c4e4de96b1 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Thu, 10 Nov 2016 17:31:01 +0900 Subject: [PATCH 13/16] remove EINA log Change-Id: I84a5e4f1547bc0a789c56facf085828e30cc67ea Signed-off-by: Wonnam Jang --- src/vc_elm_tools.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vc_elm_tools.h b/src/vc_elm_tools.h index ce298f3..7fa360a 100644 --- a/src/vc_elm_tools.h +++ b/src/vc_elm_tools.h @@ -28,10 +28,10 @@ extern "C" { #define LOG_TAG "VC_ELM" -#define VC_ELM_LOG_DBG(fmt, ...) do { EINA_LOG_ERR("\033[0;32m" fmt "\033[m", ## __VA_ARGS__); SLOGI("\033[0;32m" fmt "\033[m", ## __VA_ARGS__); } while (0) -#define VC_ELM_LOG_INFO(fmt, ...) do { EINA_LOG_ERR("\033[0;35m" fmt "\033[m", ## __VA_ARGS__); SLOGI("\033[0;32m" fmt "\033[m", ## __VA_ARGS__); } while (0) -#define VC_ELM_LOG_ERR(fmt, ...) do { EINA_LOG_ERR("\033[0;31m" fmt "\033[m", ## __VA_ARGS__); SLOGE("\033[0;32m" fmt "\033[m", ## __VA_ARGS__); } while (0) -#define VC_ELM_LOG_WARN(fmt, ...) do { EINA_LOG_ERR("\033[0;36m" fmt "\033[m", ## __VA_ARGS__); SLOGW("\033[0;32m" fmt "\033[m", ## __VA_ARGS__); } while (0) +#define VC_ELM_LOG_DBG(fmt, ...) SLOGI("\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__) #ifdef __cplusplus -- 2.7.4 From 353c07844a9cb46f7ba31084dd4bc514275852a2 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 15 Nov 2016 22:31:46 +0900 Subject: [PATCH 14/16] Fix coding rule issue Change-Id: Ifc5ed53cf94049564046ee3ed18f716450fafe57 Signed-off-by: sooyeon.kim --- src/vc_elm_core.c | 16 +- src/vc_elm_efl_dump.c | 1289 +++++++++++++++++++++++-------------------------- src/vc_elm_efl_dump.h | 53 +- 3 files changed, 631 insertions(+), 727 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 706ec14..3b13c80 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -363,8 +363,8 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa VC_ELM_LOG_DBG("No parent info"); } } else { - VC_ELM_LOG_DBG("Invalid click method"); - } + VC_ELM_LOG_DBG("Invalid click method"); + } /* Propagation */ //return EINA_TRUE; @@ -465,8 +465,8 @@ void _vc_elm_core_fini() char *data; EINA_LIST_FREE(g_allowed_text_part_list, data) { free(data); - data = NULL; - } + data = NULL; + } g_allowed_text_part_list = NULL; } @@ -1700,9 +1700,9 @@ static void __show_or_hide_tooltips_callback(bool show_or_hide) if (show_or_hide) { _vc_elm_widget_wrapper_clear_commands(); _show_tooltips(); - } - else + } else { _hide_tooltips(); + } } static Eina_Bool on_idle(void *data) @@ -2107,8 +2107,8 @@ int _vc_elm_core_remove_allowed_text_part() EINA_LIST_FREE(g_allowed_text_part_list, data) { free(data); - data = NULL; - } + data = NULL; + } g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, strdup("elm.text")); VC_ELM_LOG_DBG("Remove Allowed text part"); diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index 74a7aa2..9a1fd11 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -23,30 +23,27 @@ #include "vc_elm_tools.h" #include "vc_elm_efl_dump.h" -typedef struct _Ea_Util_Mgr -{ - Evas *evas; - FILE *fp; +typedef struct _Ea_Util_Mgr { + Evas *evas; + FILE *fp; - Eina_List *edje_part_name_list; - int x,y,w,h; + Eina_List *edje_part_name_list; + int x, y, w, h; } Ea_Util_Mgr; -typedef struct _Edje_Info -{ - const Evas_Object *obj; - - char *part_name; - const char *image_name; - const char *color_class; +typedef struct _Edje_Info { + const Evas_Object *obj; + char *part_name; + const char *image_name; + const char *color_class; } 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)))) + ((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) Eina_List *ret_list = NULL; Eina_List *ret_text_list = NULL; @@ -54,780 +51,690 @@ Eina_List *ret_text_list = NULL; static Eina_Bool evas_object_is_visible_get(Evas_Object *obj) { - int r = 0, g = 0, b = 0, a = 0; - Evas_Coord x = 0, y = 0, w = 0, h = 0; - Evas_Object *clip = NULL; - int vis = 0; + int r = 0, g = 0, b = 0, a = 0; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Evas_Object *clip = NULL; + int vis = 0; - evas_object_color_get(obj, &r, &g, &b, &a); - evas_object_geometry_get(obj, &x, &y, &w, &h); + evas_object_color_get(obj, &r, &g, &b, &a); + evas_object_geometry_get(obj, &x, &y, &w, &h); - if (evas_object_visible_get(obj)) vis = 1; - clip = evas_object_clip_get(obj); - if (clip) evas_object_color_get(obj, &r, &g, &b, &a); - if (clip && !evas_object_visible_get(clip)) vis = 0; + if (evas_object_visible_get(obj)) vis = 1; + clip = evas_object_clip_get(obj); + if (clip) evas_object_color_get(obj, &r, &g, &b, &a); + if (clip && !evas_object_visible_get(clip)) vis = 0; - if (clip && a == 0) vis = 0; + if (clip && a == 0) vis = 0; - if (0 == vis) - return EINA_FALSE; - else - return EINA_TRUE; + if (0 == vis) + return EINA_FALSE; + else + return EINA_TRUE; } static Eina_Bool evas_object_type_match(const Evas_Object *obj, const char *type) { - int ret = strcmp(evas_object_type_get(obj), type); + int ret = strcmp(evas_object_type_get(obj), type); - if (!ret) return EINA_TRUE; - return EINA_FALSE; + if (!ret) return EINA_TRUE; + return EINA_FALSE; } static Eina_Bool evas_object_is_swallow_rect(const Evas_Object *obj) { - int r = 0, g = 0, b = 0, a = 0; + int r = 0, g = 0, b = 0, a = 0; - evas_object_color_get(obj, &r, &g, &b, &a); - if (!r && !g && !b && !a - && evas_object_pointer_mode_get(obj) == EVAS_OBJECT_POINTER_MODE_NOGRAB - && evas_object_pass_events_get(obj)) - return EINA_TRUE; + evas_object_color_get(obj, &r, &g, &b, &a); + if (!r && !g && !b && !a + && evas_object_pointer_mode_get(obj) == EVAS_OBJECT_POINTER_MODE_NOGRAB + && evas_object_pass_events_get(obj)) + return EINA_TRUE; - return EINA_FALSE; + return EINA_FALSE; } static void _extract_edje_file_name(Object_Info *object_info, const char *full_path) { - char name[255] = {0, }; - unsigned int i, cnt = 0; - - if (!full_path) return; - - for (i = 0; i < strlen(full_path); i++) - { - if (full_path[i] == '/') - { - cnt = 0; - continue; - } - name[cnt++] = full_path[i]; - } - name[cnt] = '\0'; - object_info->edje_file = calloc(1, strlen(name) + 1); - strncpy(object_info->edje_file, name, strlen(name) + 1); + char name[255] = {0, }; + unsigned int i, cnt = 0; + + if (!full_path) return; + + for (i = 0; i < strlen(full_path); i++) { + if (full_path[i] == '/') { + cnt = 0; + continue; + } + name[cnt++] = full_path[i]; + } + name[cnt] = '\0'; + object_info->edje_file = calloc(1, strlen(name) + 1); + strncpy(object_info->edje_file, name, strlen(name) + 1); } static void _edje_file_info_save(Ea_Util_Mgr *util_mgr, const Evas_Object *obj) { - Evas_Object *ed = NULL; - const Evas_Object *pobj = NULL; - Eina_List *parts = NULL, *l = NULL; - Edje_Info *edje_info = NULL; - const char *file = NULL, *group = NULL, *pname = NULL, *ret = NULL; - double val = 0.0; - - if(!evas_object_type_match(obj, "edje")) return; - - edje_object_file_get(obj, &file, &group); - - ed = edje_edit_object_add(util_mgr->evas); // evas new ?? - if (edje_object_file_set(ed, file, group)) - { - parts = edje_edit_parts_list_get(ed); - EINA_LIST_FOREACH(parts, l, pname) - { - if ((pobj = edje_object_part_object_get(obj, pname))) - { - edje_info = malloc(sizeof(Edje_Info)); - edje_info->obj = pobj; - edje_info->part_name = strdup(pname); - ret = edje_object_part_state_get(obj, edje_info->part_name, &val); - - if (ret) - { - edje_info->color_class = edje_edit_state_color_class_get(ed, edje_info->part_name , ret, val); - edje_info->image_name = edje_edit_state_image_get(ed, edje_info->part_name , ret, val); - } - - util_mgr->edje_part_name_list = eina_list_append(util_mgr->edje_part_name_list, edje_info); - - } - } - edje_edit_string_list_free(parts); - } - evas_object_del(ed); + Evas_Object *ed = NULL; + const Evas_Object *pobj = NULL; + Eina_List *parts = NULL, *l = NULL; + Edje_Info *edje_info = NULL; + const char *file = NULL, *group = NULL, *pname = NULL, *ret = NULL; + double val = 0.0; + + if (!evas_object_type_match(obj, "edje")) return; + + edje_object_file_get(obj, &file, &group); + + ed = edje_edit_object_add(util_mgr->evas); // evas new ?? + if (edje_object_file_set(ed, file, group)) { + parts = edje_edit_parts_list_get(ed); + EINA_LIST_FOREACH(parts, l, pname) { + if ((pobj = edje_object_part_object_get(obj, pname))) { + edje_info = malloc(sizeof(Edje_Info)); + edje_info->obj = pobj; + edje_info->part_name = strdup(pname); + ret = edje_object_part_state_get(obj, edje_info->part_name, &val); + + if (ret) { + edje_info->color_class = edje_edit_state_color_class_get(ed, edje_info->part_name , ret, val); + edje_info->image_name = edje_edit_state_image_get(ed, edje_info->part_name , ret, val); + } + + util_mgr->edje_part_name_list = eina_list_append(util_mgr->edje_part_name_list, edje_info); + + } + } + edje_edit_string_list_free(parts); + } + evas_object_del(ed); } static void _obj_tree_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent) { - Eina_List *children = NULL, *l = NULL; - Evas_Object *child, *smart_parent_obj = NULL; - Evas_Coord x = 0, y = 0, w = 0, h = 0; - Eina_Bool is_clip = EINA_FALSE; - int r = 0, g = 0, b = 0, a = 0; - const char *ret = NULL; - double val = 0.0; - const char *file = NULL, *key = NULL, *group = NULL, *text = NULL; - Edje_Info *edje_info = NULL; - Object_Info *object_info = NULL; - - // visible check - if (!evas_object_is_visible_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; - - // clipper check - if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; - if (is_clip) goto next; - - object_info = calloc(1, sizeof(Object_Info)); - - object_info->parent = parent; - - object_info->address = (int)obj; - object_info->geometry_info.x = x; - object_info->geometry_info.y = y; - object_info->geometry_info.w = w; - object_info->geometry_info.h = h; - - if (elm_widget_is(obj)) - { - if (elm_object_focus_get(obj)) - object_info->focus = EINA_TRUE; - else - object_info->focus = EINA_FALSE; - - if (elm_widget_can_focus_get(obj) && - (!elm_object_disabled_get(obj))) - object_info->focusable = EINA_TRUE; - else - object_info->focusable = EINA_FALSE; - } - - // evas object type check - if (evas_object_is_swallow_rect(obj)) - { - object_info->type = calloc(1, strlen("swallow") + 1); - strncpy(object_info->type, "swallow", strlen("swallow") + 1); - } - else if (evas_object_type_match(obj, "rectangle")) - { - object_info->type = calloc(1, strlen("rect") + 1); - strncpy(object_info->type, "rect", strlen("rect") + 1); - evas_object_color_get(obj, &r, &g, &b, &a); - object_info->rgb_info.r = r; - object_info->rgb_info.g = g; - object_info->rgb_info.b = b; - object_info->rgb_info.a = a; - } - else - { - object_info->type = calloc(1, strlen(evas_object_type_get(obj)) + 1); - strncpy(object_info->type, evas_object_type_get(obj), strlen(evas_object_type_get(obj)) + 1); - } - - smart_parent_obj = evas_object_smart_parent_get(obj); - - // image info save - if (!strcmp(evas_object_type_get(obj), "elm_icon") || - !strcmp(evas_object_type_get(obj), "elm_image")) - { - elm_image_file_get(obj, &file, &key); - evas_object_data_set(obj, "image_name", file); - } - - // image name check - if (smart_parent_obj && evas_object_type_match(obj, "image") - && (evas_object_type_match(smart_parent_obj, "elm_icon") - || evas_object_type_match(smart_parent_obj, "elm_image"))) - { - if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) - { - _extract_edje_file_name(object_info, ret); - evas_object_data_del(smart_parent_obj, "edje_image_name"); - } - } - - // edje info save - if(evas_object_type_match(obj, "edje")) - { - edje_object_file_get(obj, &file, &group); - if (group) - { - object_info->group = calloc(1, strlen(group) + 1); - strncpy(object_info->group, group, strlen(group) + 1); - } - - _extract_edje_file_name(object_info, file); - _edje_file_info_save(util_mgr, obj); - } - - // edje info check - if( !is_clip && smart_parent_obj - && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) - { - EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) - { - if(edje_info->obj == obj) - { - if (edje_info->color_class) - { - object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1); - strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1); - } - - ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val); - object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1); - object_info->part_state = calloc(1, strlen(ret) + 1); - strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1); - strncpy(object_info->part_state, ret, strlen(ret) + 1); - - if (edje_info->image_name) - { - object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1); - strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1); - } - break; - } - } - } - - 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); - text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); - } - 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); + Eina_List *children = NULL, *l = NULL; + Evas_Object *child, *smart_parent_obj = NULL; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + int r = 0, g = 0, b = 0, a = 0; + const char *ret = NULL; + double val = 0.0; + const char *file = NULL, *key = NULL, *group = NULL, *text = NULL; + Edje_Info *edje_info = NULL; + Object_Info *object_info = NULL; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + object_info = calloc(1, sizeof(Object_Info)); + + object_info->parent = parent; + + object_info->address = (int)obj; + object_info->geometry_info.x = x; + object_info->geometry_info.y = y; + object_info->geometry_info.w = w; + object_info->geometry_info.h = h; + + if (elm_widget_is(obj)) { + if (elm_object_focus_get(obj)) + object_info->focus = EINA_TRUE; + else + object_info->focus = EINA_FALSE; + + if (elm_widget_can_focus_get(obj) && + (!elm_object_disabled_get(obj))) + object_info->focusable = EINA_TRUE; + else + object_info->focusable = EINA_FALSE; + } + + // evas object type check + if (evas_object_is_swallow_rect(obj)) { + object_info->type = calloc(1, strlen("swallow") + 1); + strncpy(object_info->type, "swallow", strlen("swallow") + 1); + } else if (evas_object_type_match(obj, "rectangle")) { + object_info->type = calloc(1, strlen("rect") + 1); + strncpy(object_info->type, "rect", strlen("rect") + 1); + evas_object_color_get(obj, &r, &g, &b, &a); + object_info->rgb_info.r = r; + object_info->rgb_info.g = g; + object_info->rgb_info.b = b; + object_info->rgb_info.a = a; + } else { + object_info->type = calloc(1, strlen(evas_object_type_get(obj)) + 1); + strncpy(object_info->type, evas_object_type_get(obj), strlen(evas_object_type_get(obj)) + 1); + } + + smart_parent_obj = evas_object_smart_parent_get(obj); + + // image info save + if (!strcmp(evas_object_type_get(obj), "elm_icon") || + !strcmp(evas_object_type_get(obj), "elm_image")) { + elm_image_file_get(obj, &file, &key); + evas_object_data_set(obj, "image_name", file); + } + + // image name check + if (smart_parent_obj && evas_object_type_match(obj, "image") + && (evas_object_type_match(smart_parent_obj, "elm_icon") + || evas_object_type_match(smart_parent_obj, "elm_image"))) { + if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) { + _extract_edje_file_name(object_info, ret); + evas_object_data_del(smart_parent_obj, "edje_image_name"); + } + } + + // edje info save + if (evas_object_type_match(obj, "edje")) { + edje_object_file_get(obj, &file, &group); + if (group) { + object_info->group = calloc(1, strlen(group) + 1); + strncpy(object_info->group, group, strlen(group) + 1); + } + + _extract_edje_file_name(object_info, file); + _edje_file_info_save(util_mgr, obj); + } + + // edje info check + if (!is_clip && smart_parent_obj + && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) { + EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) { + if (edje_info->obj == obj) { + if (edje_info->color_class) { + object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1); + strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1); + } + + ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val); + object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1); + object_info->part_state = calloc(1, strlen(ret) + 1); + strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1); + strncpy(object_info->part_state, ret, strlen(ret) + 1); + + if (edje_info->image_name) { + object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1); + strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1); + } + break; + } + } + } + + 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); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + 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); 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(util_mgr, child, object_info); - } + 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(util_mgr, child, object_info); + } } 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_List *children = NULL, *l = NULL; - Evas_Object *child, *smart_parent_obj = NULL; - Evas_Coord x = 0, y = 0, w = 0, h = 0; - Eina_Bool is_clip = EINA_FALSE; - int r = 0, g = 0, b = 0, a = 0; - const char *ret = NULL; - double val = 0.0; - const char *file = NULL, *key = NULL, *group = NULL, *text = NULL; - Edje_Info *edje_info = NULL; - Object_Info *object_info = NULL; - - // visible check - if (!evas_object_is_visible_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; - - // clipper check - if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; - if (is_clip) goto next; - - if (!strcmp(evas_object_type_get(obj), "text") || !strcmp(evas_object_type_get(obj), "textblock")) - { - if (!parent_widget_focusable) goto next; - } - - object_info = calloc(1, sizeof(Object_Info)); - - object_info->parent = parent; - - object_info->address = (int)obj; - object_info->geometry_info.x = x; - object_info->geometry_info.y = y; - object_info->geometry_info.w = w; - object_info->geometry_info.h = h; - - if (elm_widget_is(obj)) - { - if (elm_object_focus_get(obj)) - object_info->focus = EINA_TRUE; - else - object_info->focus = EINA_FALSE; - - if (elm_widget_can_focus_get(obj) && - (!elm_object_disabled_get(obj))) - { - object_info->focusable = EINA_TRUE; - parent_widget_focusable = EINA_TRUE; - } - else - { - object_info->focusable = EINA_FALSE; - parent_widget_focusable = EINA_FALSE; - } - } - - // evas object type check - if (evas_object_is_swallow_rect(obj)) - { - object_info->type = calloc(1, strlen("swallow") + 1); - strncpy(object_info->type, "swallow", strlen("swallow") + 1); - } - else if (evas_object_type_match(obj, "rectangle")) - { - object_info->type = calloc(1, strlen("rect") + 1); - strncpy(object_info->type, "rect", strlen("rect") + 1); - evas_object_color_get(obj, &r, &g, &b, &a); - object_info->rgb_info.r = r; - object_info->rgb_info.g = g; - object_info->rgb_info.b = b; - object_info->rgb_info.a = a; - } - else - { - object_info->type = calloc(1, strlen(evas_object_type_get(obj)) + 1); - strncpy(object_info->type, evas_object_type_get(obj), strlen(evas_object_type_get(obj)) + 1); - } - - smart_parent_obj = evas_object_smart_parent_get(obj); - - // image info save - if (!strcmp(evas_object_type_get(obj), "elm_icon") || - !strcmp(evas_object_type_get(obj), "elm_image")) - { - elm_image_file_get(obj, &file, &key); - evas_object_data_set(obj, "image_name", file); - } - - // image name check - if (smart_parent_obj && evas_object_type_match(obj, "image") - && (evas_object_type_match(smart_parent_obj, "elm_icon") - || evas_object_type_match(smart_parent_obj, "elm_image"))) - { - if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) - { - _extract_edje_file_name(object_info, ret); - evas_object_data_del(smart_parent_obj, "edje_image_name"); - } - } - - // edje info save - if(evas_object_type_match(obj, "edje")) - { - edje_object_file_get(obj, &file, &group); - if (group) - { - object_info->group = calloc(1, strlen(group) + 1); - strncpy(object_info->group, group, strlen(group) + 1); - } - - _extract_edje_file_name(object_info, file); - _edje_file_info_save(util_mgr, obj); - } - - // edje info check - if( !is_clip && smart_parent_obj - && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) - { - EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) - { - if(edje_info->obj == obj) - { - if (edje_info->color_class) - { - object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1); - strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1); - } - - ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val); - object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1); - object_info->part_state = calloc(1, strlen(ret) + 1); - strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1); - strncpy(object_info->part_state, ret, strlen(ret) + 1); - - if (edje_info->image_name) - { - object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1); - strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1); - } - break; - } - } - } - - 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); - text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); - } - 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); + Eina_List *children = NULL, *l = NULL; + Evas_Object *child, *smart_parent_obj = NULL; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + int r = 0, g = 0, b = 0, a = 0; + const char *ret = NULL; + double val = 0.0; + const char *file = NULL, *key = NULL, *group = NULL, *text = NULL; + Edje_Info *edje_info = NULL; + Object_Info *object_info = NULL; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + if (!strcmp(evas_object_type_get(obj), "text") || !strcmp(evas_object_type_get(obj), "textblock")) { + if (!parent_widget_focusable) goto next; + } + + object_info = calloc(1, sizeof(Object_Info)); + + object_info->parent = parent; + + object_info->address = (int)obj; + object_info->geometry_info.x = x; + object_info->geometry_info.y = y; + object_info->geometry_info.w = w; + object_info->geometry_info.h = h; + + if (elm_widget_is(obj)) { + if (elm_object_focus_get(obj)) + object_info->focus = EINA_TRUE; + else + object_info->focus = EINA_FALSE; + + if (elm_widget_can_focus_get(obj) && + (!elm_object_disabled_get(obj))) { + object_info->focusable = EINA_TRUE; + parent_widget_focusable = EINA_TRUE; + } else { + object_info->focusable = EINA_FALSE; + parent_widget_focusable = EINA_FALSE; + } + } + + // evas object type check + if (evas_object_is_swallow_rect(obj)) { + object_info->type = calloc(1, strlen("swallow") + 1); + strncpy(object_info->type, "swallow", strlen("swallow") + 1); + } else if (evas_object_type_match(obj, "rectangle")) { + object_info->type = calloc(1, strlen("rect") + 1); + strncpy(object_info->type, "rect", strlen("rect") + 1); + evas_object_color_get(obj, &r, &g, &b, &a); + object_info->rgb_info.r = r; + object_info->rgb_info.g = g; + object_info->rgb_info.b = b; + object_info->rgb_info.a = a; + } else { + object_info->type = calloc(1, strlen(evas_object_type_get(obj)) + 1); + strncpy(object_info->type, evas_object_type_get(obj), strlen(evas_object_type_get(obj)) + 1); + } + + smart_parent_obj = evas_object_smart_parent_get(obj); + + // image info save + if (!strcmp(evas_object_type_get(obj), "elm_icon") || + !strcmp(evas_object_type_get(obj), "elm_image")) { + elm_image_file_get(obj, &file, &key); + evas_object_data_set(obj, "image_name", file); + } + + // image name check + if (smart_parent_obj && evas_object_type_match(obj, "image") + && (evas_object_type_match(smart_parent_obj, "elm_icon") + || evas_object_type_match(smart_parent_obj, "elm_image"))) { + if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) { + _extract_edje_file_name(object_info, ret); + evas_object_data_del(smart_parent_obj, "edje_image_name"); + } + } + + // edje info save + if (evas_object_type_match(obj, "edje")) { + edje_object_file_get(obj, &file, &group); + if (group) { + object_info->group = calloc(1, strlen(group) + 1); + strncpy(object_info->group, group, strlen(group) + 1); + } + + _extract_edje_file_name(object_info, file); + _edje_file_info_save(util_mgr, obj); + } + + // edje info check + if (!is_clip && smart_parent_obj + && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) { + EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) { + if (edje_info->obj == obj) { + if (edje_info->color_class) { + object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1); + strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1); + } + + ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val); + object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1); + object_info->part_state = calloc(1, strlen(ret) + 1); + strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1); + strncpy(object_info->part_state, ret, strlen(ret) + 1); + + if (edje_info->image_name) { + object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1); + strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1); + } + break; + } + } + } + + 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); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + 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); 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); - } + 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); + } } static void _obj_tree_text_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj) { - Eina_List *children = NULL, *l = NULL; - Evas_Object *child; - Evas_Coord x = 0, y = 0, w = 0, h = 0; - Eina_Bool is_clip = EINA_FALSE; - const char *ret = NULL; - const char *text = NULL; - char* data = NULL; - Eina_Bool check; - - // visible check - if (!evas_object_is_visible_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; - - // clipper check - if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; - if (is_clip) goto next; - - 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); - text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); - } - if (text && strlen(text) > 0) - { - check = EINA_TRUE; - EINA_LIST_FOREACH(ret_text_list, l, data) - { - if (!strcmp(data, text)) - { - check = EINA_FALSE; - break; - } - } - if (check) ret_text_list = eina_list_append(ret_text_list, text); - } + Eina_List *children = NULL, *l = NULL; + Evas_Object *child; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + const char *ret = NULL; + const char *text = NULL; + char* data = NULL; + Eina_Bool check; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + 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); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + if (text && strlen(text) > 0) { + check = EINA_TRUE; + EINA_LIST_FOREACH(ret_text_list, l, data) { + if (!strcmp(data, text)) { + check = EINA_FALSE; + break; + } + } + if (check) ret_text_list = eina_list_append(ret_text_list, text); + } 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_text_items(util_mgr, child); - } + 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_text_items(util_mgr, child); + } } static void _obj_tree_text_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Eina_Bool parent_widget_focusable) { - Eina_List *children = NULL, *l = NULL; - Evas_Object *child; - Evas_Coord x = 0, y = 0, w = 0, h = 0; - Eina_Bool is_clip = EINA_FALSE; - const char *ret = NULL; - const char *text = NULL; - char* data = NULL; - Eina_Bool check; - - // visible check - if (!evas_object_is_visible_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; - - // clipper check - if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; - if (is_clip) goto next; - - if (elm_widget_is(obj)) - { - if (elm_widget_can_focus_get(obj)) parent_widget_focusable = EINA_TRUE; - else parent_widget_focusable = EINA_FALSE; - } - - text = NULL; - if (!strcmp(evas_object_type_get(obj), "text")) - { - if (!parent_widget_focusable) goto next; - text = eina_stringshare_add(evas_object_text_text_get(obj)); - } - else if (!strcmp(evas_object_type_get(obj), "textblock")) - { - if (!parent_widget_focusable) goto next; - ret = evas_object_textblock_text_markup_get(obj); - text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); - } - if (text && strlen(text) > 0) - { - check = EINA_TRUE; - EINA_LIST_FOREACH(ret_text_list, l, data) - { - if (!strcmp(data, text)) - { - check = EINA_FALSE; - break; - } - } - if (check) ret_text_list = eina_list_append(ret_text_list, text); - } + Eina_List *children = NULL, *l = NULL; + Evas_Object *child; + Evas_Coord x = 0, y = 0, w = 0, h = 0; + Eina_Bool is_clip = EINA_FALSE; + const char *ret = NULL; + const char *text = NULL; + char* data = NULL; + Eina_Bool check; + + // visible check + if (!evas_object_is_visible_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; + + // clipper check + if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE; + if (is_clip) goto next; + + if (elm_widget_is(obj)) { + if (elm_widget_can_focus_get(obj)) parent_widget_focusable = EINA_TRUE; + else parent_widget_focusable = EINA_FALSE; + } + + text = NULL; + if (!strcmp(evas_object_type_get(obj), "text")) { + if (!parent_widget_focusable) goto next; + text = eina_stringshare_add(evas_object_text_text_get(obj)); + } else if (!strcmp(evas_object_type_get(obj), "textblock")) { + if (!parent_widget_focusable) goto next; + ret = evas_object_textblock_text_markup_get(obj); + text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret)); + } + if (text && strlen(text) > 0) { + check = EINA_TRUE; + EINA_LIST_FOREACH(ret_text_list, l, data) { + if (!strcmp(data, text)) { + check = EINA_FALSE; + break; + } + } + if (check) ret_text_list = eina_list_append(ret_text_list, text); + } 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_text_items_exclude_unfocusable_text(util_mgr, child, parent_widget_focusable); - } + 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_text_items_exclude_unfocusable_text(util_mgr, child, parent_widget_focusable); + } } static void _object_tree(Ea_Util_Mgr *util_mgr, int val, Eina_Bool exclude_unfocusable_text) { - Eina_List *objs = NULL; - Evas_Object *obj = NULL; - - objs = evas_objects_in_rectangle_get(util_mgr->evas, SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE); - - if (val == 1) - { - if (exclude_unfocusable_text) - { - EINA_LIST_FREE(objs, obj) - _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE); - } - else - { - EINA_LIST_FREE(objs, obj) - _obj_tree_items(util_mgr, obj, NULL); - } - } - else if (val == 2) - { - if (exclude_unfocusable_text) - { - EINA_LIST_FREE(objs, obj) - _obj_tree_text_items_exclude_unfocusable_text(util_mgr, obj, EINA_FALSE); - } - else - { - EINA_LIST_FREE(objs, obj) - _obj_tree_text_items(util_mgr, obj); - } - } + Eina_List *objs = NULL; + Evas_Object *obj = NULL; + + objs = evas_objects_in_rectangle_get(util_mgr->evas, SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE); + + if (val == 1) { + if (exclude_unfocusable_text) { + EINA_LIST_FREE(objs, obj) + _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE); + } else { + EINA_LIST_FREE(objs, obj) + _obj_tree_items(util_mgr, obj, NULL); + } + } else if (val == 2) { + if (exclude_unfocusable_text) { + EINA_LIST_FREE(objs, obj) + _obj_tree_text_items_exclude_unfocusable_text(util_mgr, obj, EINA_FALSE); + } else { + EINA_LIST_FREE(objs, obj) + _obj_tree_text_items(util_mgr, obj); + } + } } void ea_object_dump_list_clear(void) { - Object_Info *obj_info = NULL; - EINA_LIST_FREE(ret_list, obj_info) - free(obj_info); + Object_Info *obj_info = NULL; + EINA_LIST_FREE(ret_list, obj_info) + free(obj_info); - ret_list = NULL; + ret_list = NULL; } Eina_List* ea_object_dump_full_list_get(Eina_Bool exclude_unfocusable_text) { - Eina_List *ecore_evas_list = NULL; - Ecore_Evas *ee = NULL; - Evas *evas = NULL; + Eina_List *ecore_evas_list = NULL; + Ecore_Evas *ee = NULL; + Evas *evas = NULL; - if (!ret_list) - ea_object_dump_list_clear(); + if (!ret_list) + ea_object_dump_list_clear(); - Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr)); - if (!util_mgr) - { - printf("Fail : utility manager memory alloc\n"); - goto exit; - } + Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr)); + if (!util_mgr) { + printf("Fail : utility manager memory alloc\n"); + goto exit; + } - ecore_evas_list = ecore_evas_ecore_evas_list_get(); + ecore_evas_list = ecore_evas_ecore_evas_list_get(); - EINA_LIST_FREE(ecore_evas_list, ee) - { - evas = ecore_evas_get(ee); - util_mgr->evas = evas; + EINA_LIST_FREE(ecore_evas_list, ee) { + evas = ecore_evas_get(ee); + util_mgr->evas = evas; - ecore_wl_sync(); - util_mgr->x = 0; - util_mgr->y = 0; - ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); + ecore_wl_sync(); + util_mgr->x = 0; + util_mgr->y = 0; + ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); - _object_tree(util_mgr, 1, exclude_unfocusable_text); - } + _object_tree(util_mgr, 1, exclude_unfocusable_text); + } exit: - if (!util_mgr) return NULL; - if (util_mgr->edje_part_name_list) - eina_list_free(util_mgr->edje_part_name_list); // need to check - free(util_mgr); - return ret_list; + if (!util_mgr) return NULL; + if (util_mgr->edje_part_name_list) + eina_list_free(util_mgr->edje_part_name_list); // need to check + free(util_mgr); + return ret_list; } Eina_List* ea_object_dump_text_list_get(Eina_Bool exclude_unfocusable_text) { - Eina_List *ecore_evas_list = NULL; - Ecore_Evas *ee = NULL; - Evas *evas = NULL; + Eina_List *ecore_evas_list = NULL; + Ecore_Evas *ee = NULL; + Evas *evas = NULL; - Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr)); - if (!util_mgr) - { - printf("Fail : utility manager memory alloc\n"); - goto exit; - } + Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr)); + if (!util_mgr) { + printf("Fail : utility manager memory alloc\n"); + goto exit; + } - ecore_evas_list = ecore_evas_ecore_evas_list_get(); + ecore_evas_list = ecore_evas_ecore_evas_list_get(); - EINA_LIST_FREE(ecore_evas_list, ee) - { - evas = ecore_evas_get(ee); - util_mgr->evas = evas; + EINA_LIST_FREE(ecore_evas_list, ee) { + evas = ecore_evas_get(ee); + util_mgr->evas = evas; - ecore_wl_sync(); - util_mgr->x = 0; - util_mgr->y = 0; - ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); + ecore_wl_sync(); + util_mgr->x = 0; + util_mgr->y = 0; + ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h); - _object_tree(util_mgr, 2, exclude_unfocusable_text); - } + _object_tree(util_mgr, 2, exclude_unfocusable_text); + } exit: - if (!util_mgr) return NULL; - free(util_mgr); - return ret_text_list; + if (!util_mgr) return NULL; + free(util_mgr); + return ret_text_list; } Eina_List* ea_object_dump_find_data(Eina_List *list, const char *str1, const char *str2) { - Eina_List *l = NULL; - Object_Info *data = NULL; - Eina_List *ret_data_list = NULL; - - if (!list) return NULL; - if (!str1 || !str2) return NULL; - - if (!strcmp(str1, "type")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->type) - if (!strcmp(data->type, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - else if (!strcmp(str1, "edje_file")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->edje_file) - if (!strcmp(data->edje_file, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - else if (!strcmp(str1, "group")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->group) - if (!strcmp(data->group, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - else if (!strcmp(str1, "image_name")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->image_name) - if (!strcmp(data->image_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - else if (!strcmp(str1, "color_class")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->color_class) - if (!strcmp(data->color_class, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - else if (!strcmp(str1, "part_name")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->part_name) - if (!strcmp(data->part_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - else if (!strcmp(str1, "part_state")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->part_state) - if (!strcmp(data->part_state, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - else if (!strcmp(str1, "text")) - { - EINA_LIST_FOREACH(list, l, data) - { - if (data->text) - if (!strcmp(data->text, str2)) ret_data_list = eina_list_append(ret_data_list, data); - } - } - - return ret_data_list; + Eina_List *l = NULL; + Object_Info *data = NULL; + Eina_List *ret_data_list = NULL; + + if (!list) return NULL; + if (!str1 || !str2) return NULL; + + if (!strcmp(str1, "type")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->type) + if (!strcmp(data->type, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } else if (!strcmp(str1, "edje_file")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->edje_file) + if (!strcmp(data->edje_file, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } else if (!strcmp(str1, "group")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->group) + if (!strcmp(data->group, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } else if (!strcmp(str1, "image_name")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->image_name) + if (!strcmp(data->image_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } else if (!strcmp(str1, "color_class")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->color_class) + if (!strcmp(data->color_class, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } else if (!strcmp(str1, "part_name")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->part_name) + if (!strcmp(data->part_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } else if (!strcmp(str1, "part_state")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->part_state) + if (!strcmp(data->part_state, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } else if (!strcmp(str1, "text")) { + EINA_LIST_FOREACH(list, l, data) + { + if (data->text) + if (!strcmp(data->text, str2)) ret_data_list = eina_list_append(ret_data_list, data); + } + } + + return ret_data_list; } Object_Info* ea_object_dump_parent_widget_data_get(const Object_Info *obj_info) { - Object_Info *parent_info = NULL; - - parent_info = obj_info->parent; - while (parent_info) - { - if (strstr(parent_info->type, "elm")) - return parent_info; - parent_info = parent_info->parent; - } - return NULL; + Object_Info *parent_info = NULL; + + parent_info = obj_info->parent; + while (parent_info) { + if (strstr(parent_info->type, "elm")) + return parent_info; + parent_info = parent_info->parent; + } + return NULL; } diff --git a/src/vc_elm_efl_dump.h b/src/vc_elm_efl_dump.h index e51dacb..b0b923b 100644 --- a/src/vc_elm_efl_dump.h +++ b/src/vc_elm_efl_dump.h @@ -40,35 +40,32 @@ extern "C" { #endif typedef struct _Object_Info Object_Info; -struct _Object_Info -{ - Object_Info *parent; - char *type; - char *edje_file; - char *group; - char *image_name; - char *color_class; - int address; +struct _Object_Info { + Object_Info *parent; + char *type; + char *edje_file; + char *group; + char *image_name; + char *color_class; + int address; - struct - { - Evas_Coord x; - Evas_Coord y; - Evas_Coord w; - Evas_Coord h; - }geometry_info; - char *part_name; - char *part_state; - char *text; - struct - { - Evas_Coord r; - Evas_Coord g; - Evas_Coord b; - Evas_Coord a; - }rgb_info; - Eina_Bool focusable; - Eina_Bool focus; + struct { + Evas_Coord x; + Evas_Coord y; + Evas_Coord w; + Evas_Coord h; + } geometry_info; + char *part_name; + char *part_state; + char *text; + struct { + Evas_Coord r; + Evas_Coord g; + Evas_Coord b; + Evas_Coord a; + } rgb_info; + Eina_Bool focusable; + Eina_Bool focus; }; void ea_object_dump_list_clear(void); -- 2.7.4 From 2c8d660e4e7e8c58df260affb09206469ceb456b Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Fri, 18 Nov 2016 10:49:05 +0900 Subject: [PATCH 15/16] Fix focusable text check logic Change-Id: I3d5ba3fd53342645611348b702255fef6d057ef4 --- src/vc_elm_efl_dump.c | 36 ++++++++++++++++-------------------- src/vc_elm_widget_wrapper.c | 4 ++-- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c index 9a1fd11..e25e882 100644 --- a/src/vc_elm_efl_dump.c +++ b/src/vc_elm_efl_dump.c @@ -297,7 +297,7 @@ next: } static void -_obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent, Eina_Bool parent_widget_focusable) +_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) { Eina_List *children = NULL, *l = NULL; Evas_Object *child, *smart_parent_obj = NULL; @@ -323,7 +323,7 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj if (is_clip) goto next; if (!strcmp(evas_object_type_get(obj), "text") || !strcmp(evas_object_type_get(obj), "textblock")) { - if (!parent_widget_focusable) goto next; + if (!parent_widget_focusable && !list_type) goto next; } object_info = calloc(1, sizeof(Object_Info)); @@ -351,6 +351,10 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj parent_widget_focusable = EINA_FALSE; } } + 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")) + list_type = EINA_TRUE; + } // evas object type check if (evas_object_is_swallow_rect(obj)) { @@ -442,7 +446,7 @@ 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); + _obj_tree_items_exclude_unfocusable_text(util_mgr, child, object_info, parent_widget_focusable, list_type); } } @@ -564,7 +568,7 @@ _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); + _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE, EINA_FALSE); } else { EINA_LIST_FREE(objs, obj) _obj_tree_items(util_mgr, obj, NULL); @@ -673,50 +677,42 @@ ea_object_dump_find_data(Eina_List *list, const char *str1, const char *str2) if (!str1 || !str2) return NULL; if (!strcmp(str1, "type")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->type) if (!strcmp(data->type, str2)) ret_data_list = eina_list_append(ret_data_list, data); } } else if (!strcmp(str1, "edje_file")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->edje_file) if (!strcmp(data->edje_file, str2)) ret_data_list = eina_list_append(ret_data_list, data); } } else if (!strcmp(str1, "group")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->group) if (!strcmp(data->group, str2)) ret_data_list = eina_list_append(ret_data_list, data); } } else if (!strcmp(str1, "image_name")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->image_name) if (!strcmp(data->image_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); } } else if (!strcmp(str1, "color_class")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->color_class) if (!strcmp(data->color_class, str2)) ret_data_list = eina_list_append(ret_data_list, data); } } else if (!strcmp(str1, "part_name")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->part_name) if (!strcmp(data->part_name, str2)) ret_data_list = eina_list_append(ret_data_list, data); } } else if (!strcmp(str1, "part_state")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->part_state) if (!strcmp(data->part_state, str2)) ret_data_list = eina_list_append(ret_data_list, data); } } else if (!strcmp(str1, "text")) { - EINA_LIST_FOREACH(list, l, data) - { + EINA_LIST_FOREACH(list, l, data) { if (data->text) if (!strcmp(data->text, str2)) ret_data_list = eina_list_append(ret_data_list, data); } diff --git a/src/vc_elm_widget_wrapper.c b/src/vc_elm_widget_wrapper.c index 2841c84..b36b929 100644 --- a/src/vc_elm_widget_wrapper.c +++ b/src/vc_elm_widget_wrapper.c @@ -127,7 +127,7 @@ int _vc_elm_widget_wrapper_deinitialize() static bool __cb(vc_cmd_h vc_command, void *user_data) { char *cmd = NULL; - vc_cmd_format_e type; + int type; (void)user_data; vc_cmd_get_format(vc_command, &type); @@ -274,7 +274,7 @@ static void __vc_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, c vc_cmd_h vc_command = NULL; char *cmd_name = NULL; int ret = 0; - vc_cmd_format_e type; + int type; (void)user_data; (void)result; if (event != VC_RESULT_EVENT_RESULT_SUCCESS) -- 2.7.4 From ad3ccbff6ef8777d98b132d4657dcede93cffa0f Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Fri, 16 Dec 2016 20:24:05 +0900 Subject: [PATCH 16/16] Add gengrid auto click Change-Id: I019e6111e9da7459159365bb0e680d515a3af3ee Signed-off-by: Kwangyoun Kim --- src/vc_elm_core.c | 63 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/vc_elm_core.c b/src/vc_elm_core.c index 3b13c80..6ce2a2d 100644 --- a/src/vc_elm_core.c +++ b/src/vc_elm_core.c @@ -311,6 +311,7 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa 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) { @@ -323,44 +324,42 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa 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); } - } else { - Object_Info* grand_info = ea_object_dump_parent_widget_data_get(parent_info); - while (NULL != grand_info) { - if (EINA_TRUE == grand_info->focusable) { - VC_ELM_LOG_DBG("Focusable Grand parent"); - Elm_Object_Item* item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w/2, y + h/2, NULL); - 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(0.5, __click_event, NULL); - } else { - evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); - elm_object_item_focus_set(item, EINA_TRUE); - elm_object_focus_set((Evas_Object*)(grand_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((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"); + ecoret_timer_add(0.5, __click_event, NULL); } else { - item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w + w/2, y + h/2, NULL); - if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) { - VC_ELM_LOG_DBG("Click event 2"); - if (EINA_TRUE == elm_object_item_focus_get(item)) { - VC_ELM_LOG_DBG("Already focused"); - ecore_timer_add(0.5, __click_event, NULL); - } else { - evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused"); - elm_object_item_focus_set(item, EINA_TRUE); - elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE); - } - } + 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; - } else { - grand_info = ea_object_dump_parent_widget_data_get(grand_info); } } + parent_info = ea_object_dump_parent_widget_data_get(parent_info); } - } else { - VC_ELM_LOG_DBG("No parent info"); } } else { VC_ELM_LOG_DBG("Invalid click method"); -- 2.7.4