}
}
+static Eina_Bool _vc_elm_click_matched_object(const char* cmd, int click_method)
+{
+
+ VC_ELM_LOG_DBG("cmd(%s), click_method(%d)", cmd, click_method);
+
+ Eina_List *dump_iter = NULL;
+ void *data = NULL;
+ Eina_Bool text_found = EINA_FALSE;
+ EINA_LIST_FOREACH(g_dump_list, dump_iter, data) {
+ Object_Info* info = (Object_Info*)data;
+
+ if (NULL != info && NULL != info->text && NULL != info->part_name) {
+ VC_ELM_LOG_DBG("info->text(%s)", info->text);
+ Eina_List *iter = NULL;
+ char *part_name = NULL;
+ EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) {
+ if (NULL != part_name && !strcmp(part_name, info->part_name)) {
+ if (!strcmp(info->text, cmd)) {
+ int x = info->geometry_info.x;
+ int y = info->geometry_info.y;
+ int w = info->geometry_info.w;
+ int h = info->geometry_info.h;
+ VC_ELM_LOG_DBG("Click event : %s x(%d) y(%d) w(%d) h(%d), address(%p) type(%s)", info->text, x, y, w, h, info->address, info->type);
+ if (0 == click_method) {
+ evas_event_feed_mouse_move(evas_object_evas_get((Evas_Object*)(info->address)), x + w/2, y + h/2, 0, NULL);
+ evas_event_feed_mouse_down(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 1, NULL);
+ evas_event_feed_mouse_up(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 2, NULL);
+ VC_ELM_LOG_INFO("click!!!!!");
+ } else if (1 == click_method) {
+ VC_ELM_LOG_DBG("click method - focus/key");
+ bool clicked = false;
+ Object_Info* parent_info = ea_object_dump_parent_widget_data_get(info);
+ if (NULL != parent_info) {
+ if (EINA_TRUE == parent_info->focusable) {
+ VC_ELM_LOG_DBG("Focusable Parent");
+ VC_ELM_LOG_DBG("Click event");
+ if (EINA_TRUE == elm_object_focus_get((Evas_Object*)parent_info->address)) {
+ VC_ELM_LOG_DBG("Already focused");
+ ecore_timer_add(g_click_time, __click_event, NULL);
+ } else {
+ evas_object_smart_callback_add((Evas_Object*)(parent_info->address), "focused", __focused_cb, "focused");
+ elm_object_focus_set((Evas_Object*)(parent_info->address), EINA_TRUE);
+ }
+ clicked = true;
+ break;
+ }
+ }
+
+ if (false == clicked) {
+ parent_info = ea_object_dump_parent_widget_data_get(parent_info);
+ while (NULL != parent_info) {
+ if (EINA_TRUE == parent_info->focusable) {
+ VC_ELM_LOG_DBG("Focusable Parent");
+ char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
+ VC_ELM_LOG_DBG("type (%s)", widget_type);
+ Elm_Object_Item* item = NULL;
+ if (NULL != widget_type && !strcmp(widget_type, "Elm_Genlist")) {
+ item = elm_genlist_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, NULL);
+ if (NULL == item) {
+ item = elm_genlist_at_xy_item_get((Evas_Object*)(parent_info->address), x + w + w/2, y + h/2, NULL);
+ }
+ } else if (NULL != widget_type && !strcmp(widget_type, "Elm_Gengrid")) {
+ int xposret, yposret;
+ item = elm_gengrid_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, &xposret, &yposret);
+ }
+ VC_ELM_LOG_DBG("item(%p)(%d)", item, elm_object_item_disabled_get(item));
+
+ if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) {
+ VC_ELM_LOG_DBG("Click event");
+ if (EINA_TRUE == elm_object_item_focus_get(item)) {
+ VC_ELM_LOG_DBG("Already focused");
+ ecore_timer_add(g_click_time, __click_event, NULL);
+ } else {
+ evas_object_smart_callback_add((Evas_Object*)(parent_info->address), "item,focused", __focused_cb, "item,focused");
+ elm_object_item_focus_set(item, EINA_TRUE);
+ elm_object_focus_set((Evas_Object*)(parent_info->address), EINA_TRUE);
+ }
+ break;
+ }
+ }
+ parent_info = ea_object_dump_parent_widget_data_get(parent_info);
+ }
+ }
+ } else {
+ VC_ELM_LOG_DBG("Invalid click method");
+ }
+
+ /* Propagation */
+ //return EINA_TRUE;
+ text_found = EINA_TRUE;
+ }
+ }
+ }
+ }
+ }
+ ea_object_dump_list_clear();
+ g_dump_list = NULL;
+ return text_found;
+}
+
/**
* @brief Function that matches recognition result to the registered actions
* and calls for action execution
int click_method = 0;
_vc_elm_get_auto_register_mode(&auto_mode, &click_method);
if (1 == auto_mode) {
- Eina_List *dump_iter = NULL;
- void *data = NULL;
- Eina_Bool text_found = EINA_FALSE;
- EINA_LIST_FOREACH(g_dump_list, dump_iter, data) {
- Object_Info* info = (Object_Info*)data;
-
- if (NULL != info && NULL != info->text && NULL != info->part_name) {
- Eina_List *iter = NULL;
- char *part_name = NULL;
- EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) {
- if (NULL != part_name && !strcmp(part_name, info->part_name)) {
- if (!strcmp(info->text, cmd)) {
- int x = info->geometry_info.x;
- int y = info->geometry_info.y;
- int w = info->geometry_info.w;
- int h = info->geometry_info.h;
- VC_ELM_LOG_DBG("Click event : %s x(%d) y(%d) w(%d) h(%d), address(%d) type(%s)", info->text, x, y, w, h, info->address, info->type);
- if (0 == click_method) {
- evas_event_feed_mouse_move(evas_object_evas_get((Evas_Object*)(info->address)), x + w/2, y + h/2, 0, NULL);
- evas_event_feed_mouse_down(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 1, NULL);
- evas_event_feed_mouse_up(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 2, NULL);
- } else if (1 == click_method) {
- VC_ELM_LOG_DBG("click method - focus/key");
- bool clicked = false;
- Object_Info* parent_info = ea_object_dump_parent_widget_data_get(info);
- if (NULL != parent_info) {
- if (EINA_TRUE == parent_info->focusable) {
- VC_ELM_LOG_DBG("Focusable Parent");
- VC_ELM_LOG_DBG("Click event");
- if (EINA_TRUE == elm_object_focus_get((Evas_Object*)parent_info->address)) {
- VC_ELM_LOG_DBG("Already focused");
- ecore_timer_add(g_click_time, __click_event, NULL);
- } else {
- evas_object_smart_callback_add((Evas_Object*)(parent_info->address), "focused", __focused_cb, "focused");
- elm_object_focus_set((Evas_Object*)(parent_info->address), EINA_TRUE);
- }
- clicked = true;
- }
- }
-
- if (false == clicked) {
- parent_info = ea_object_dump_parent_widget_data_get(parent_info);
- while (NULL != parent_info) {
- if (EINA_TRUE == parent_info->focusable) {
- VC_ELM_LOG_DBG("Focusable Parent");
- char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
- VC_ELM_LOG_DBG("type (%s)", widget_type);
- Elm_Object_Item* item = NULL;
- if (NULL != widget_type && !strcmp(widget_type, "Elm_Genlist")) {
- item = elm_genlist_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, NULL);
- if (NULL == item) {
- item = elm_genlist_at_xy_item_get((Evas_Object*)(parent_info->address), x + w + w/2, y + h/2, NULL);
- }
- } else if (NULL != widget_type && !strcmp(widget_type, "Elm_Gengrid")) {
- int xposret, yposret;
- item = elm_gengrid_at_xy_item_get((Evas_Object*)(parent_info->address), x + w/2, y + h/2, &xposret, &yposret);
- }
- if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) {
- VC_ELM_LOG_DBG("Click event");
- if (EINA_TRUE == elm_object_item_focus_get(item)) {
- VC_ELM_LOG_DBG("Already focused");
- ecore_timer_add(g_click_time, __click_event, NULL);
- } else {
- evas_object_smart_callback_add((Evas_Object*)(parent_info->address), "item,focused", __focused_cb, "item,focused");
- elm_object_item_focus_set(item, EINA_TRUE);
- elm_object_focus_set((Evas_Object*)(parent_info->address), EINA_TRUE);
- }
- break;
- }
- }
- parent_info = ea_object_dump_parent_widget_data_get(parent_info);
- }
- }
- } else {
- VC_ELM_LOG_DBG("Invalid click method");
- }
-
- /* Propagation */
- //return EINA_TRUE;
- text_found = EINA_TRUE;
- }
- }
- }
- }
- }
- ea_object_dump_list_clear();
- g_dump_list = NULL;
- return text_found;
+ Eina_Bool ret = _vc_elm_click_matched_object(cmd, click_method);
+ return ret;
}
}
}
}
+static int __vc_add_commands_for_automode()
+{
+ if (NULL != g_dump_list) {
+ ea_object_dump_list_clear();
+ g_dump_list = NULL;
+ }
+ g_dump_list = ea_object_dump_full_list_get(EINA_TRUE);
+ VC_ELM_LOG_DBG("Count (%d)", eina_list_count(g_dump_list));
+
+ Eina_List *dump_iter = NULL;
+ void *data = NULL;
+ EINA_LIST_FOREACH(g_dump_list, dump_iter, data) {
+ Object_Info* info = (Object_Info*)data;
+
+ if (NULL != info && NULL != info->text && NULL != info->part_name) {
+ Eina_List *iter = NULL;
+ char *part_name = NULL;
+ EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) {
+ if (NULL != part_name && !strcmp(part_name, info->part_name)) {
+ VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name);
+ VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h);
+ _vc_elm_widget_wrapper_add_command(info->text, NULL);
+ }
+ }
+ }
+ }
+ return 0;
+}
+
static void __vc_add_commands()
{
Eina_List *_l;
_vc_elm_get_auto_register_mode(&auto_mode, &click_method);
VC_ELM_LOG_DBG("Auto mode (%d) Click method (%d)", auto_mode, click_method);
if (1 == auto_mode) {
- if (NULL != g_dump_list) {
- ea_object_dump_list_clear();
- g_dump_list = NULL;
- }
- g_dump_list = ea_object_dump_full_list_get(EINA_TRUE);
- VC_ELM_LOG_DBG("Count (%d)", eina_list_count(g_dump_list));
-
- Eina_List *dump_iter = NULL;
- void *data = NULL;
- EINA_LIST_FOREACH(g_dump_list, dump_iter, data) {
- Object_Info* info = (Object_Info*)data;
-
- if (NULL != info && NULL != info->text && NULL != info->part_name) {
- Eina_List *iter = NULL;
- char *part_name = NULL;
- EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) {
- if (NULL != part_name && !strcmp(part_name, info->part_name)) {
- VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name);
- VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h);
- _vc_elm_widget_wrapper_add_command(info->text, NULL);
- }
- }
- }
+ if (0 != __vc_add_commands_for_automode()) {
+ VC_ELM_LOG_ERR("Fail to add command in auto mode");
}
}