Add commands in genlist when its parent is ctxpopup 68/172068/1
authorWonnam Jang <wn.jang@samsung.com>
Thu, 7 Dec 2017 14:47:36 +0000 (23:47 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Fri, 9 Mar 2018 10:24:29 +0000 (10:24 +0000)
Change-Id: I16e922028712c9f7eec0c00244b2c7ef9eae7732
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
(cherry picked from commit 7035e395b10ed3949d362b046f5b746d0ff99efa)

src/vc_elm_core.c
src/vc_elm_efl_dump.c

index c92e4456ff5d6d65f75958e1c833b57e99b12e32..ac5b713a016aea05d46913624a6d069d5d18b661 100644 (file)
@@ -817,10 +817,22 @@ static Eina_List *__get_ctxpopup_objects_of_visible_items(Evas_Object *widget)
        do {
                Evas_Object *ee = eina_list_data_get(tmp_list);
                eina_hash_foreach(command_item_map, __item_item_map_foreach, ee);
+               VC_ELM_LOG_DBG("ctx popup object(%p)(%s)", ee, evas_object_type_get(ee));
+               VC_ELM_LOG_DBG("cmd(%s) hint(%s)", evas_object_data_get(ee, VC_ELM_CMD_DATA_KEY), evas_object_data_get(ee, VC_ELM_HINT_DATA_KEY));
                if (evas_object_data_get(ee, VC_ELM_CMD_DATA_KEY) || evas_object_data_get(ee, VC_ELM_HINT_DATA_KEY))
                        ret = eina_list_append(ret, (void *)ee);
        } while ((tmp_list = eina_list_next(tmp_list)) != NULL);
 
+       Eina_List *text_list = text_dump_genlist_in_ctxpopup_get();
+       Eina_List *iter = NULL;
+       char *text = NULL;
+       EINA_LIST_FOREACH(text_list, iter, text) {
+               if (NULL != text) {
+                       VC_ELM_LOG_DBG("Text in ctxpopup (%s)", text);
+                       _vc_elm_widget_wrapper_add_command(text, NULL);
+               }
+       }
+
        return ret;
 }
 
@@ -1312,8 +1324,10 @@ static int __vc_add_commands_for_automode_vt_auto()
                                VC_ELM_LOG_ERR("Not supported widget manually");
                        }
                }
-               if (NULL != info) {
-                       if (NULL != info->text && NULL != info->part_name) {
+
+               if (NULL != info && NULL != info->text) {
+                       VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name);
+                       if (NULL != info->part_name) {
                                Eina_List *iter = NULL;
                                char *part_name = NULL;
                                EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) {
index 1d7ed10fecc373ebd80c14337a2df61f14f04679..bc8a5fb51882c34b343c6abd9401ddde22b27941 100644 (file)
@@ -56,6 +56,7 @@ typedef struct _Edje_Info {
 
 Eina_List *ret_list = NULL;
 Eina_List *ret_text_list = NULL;
+Eina_List *ctxpop_text_list = NULL;
 
 static Eina_Bool g_set_geometry = EINA_FALSE;
 static int g_geo_x = 0, g_geo_y = 0, g_geo_w = 0, g_geo_h = 0;
@@ -362,6 +363,21 @@ static Eina_Bool _is_descendant_of_list(Object_Info *object_info)
        return EINA_FALSE;
 }
 
+static Eina_Bool _is_descendant_of_ctxpopup(Object_Info *object_info)
+{
+       Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
+       while (NULL != parent_info) {
+               const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
+               if (NULL != widget_type) {
+                       VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type);
+                       if (!strcmp(widget_type, "Elm_Ctxpopup"))
+                               return EINA_TRUE;
+               }
+               parent_info = ea_object_dump_parent_widget_data_get(parent_info);
+       }
+       return EINA_FALSE;
+}
+
 static Eina_Bool _is_descendant_of_toolbar(Object_Info *object_info)
 {
        Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
@@ -418,7 +434,7 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj
        Object_Info *object_info = NULL;
        char* temp = NULL;
 
-       VC_ELM_LOG_DUMP("[%d] Object(%s), text(%s)(%s)", cnt, evas_object_type_get(obj), (!evas_object_text_text_get(obj)) ? " " : evas_object_text_text_get(obj), !elm_atspi_accessible_name_get(obj) ? " " : elm_atspi_accessible_name_get(obj));
+       VC_ELM_LOG_DUMP("[%d] Object(%p)(%s), text(%s)(%s)", cnt, obj, evas_object_type_get(obj), (!evas_object_text_text_get(obj)) ? " " : evas_object_text_text_get(obj), !elm_atspi_accessible_name_get(obj) ? " " : elm_atspi_accessible_name_get(obj));
 
        // visible check
        if (!evas_object_is_visible_get(obj)) {
@@ -626,6 +642,12 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj
                                }
                        }
                }
+
+               if (NULL != text && EINA_TRUE == _is_descendant_of_list(object_info) && EINA_TRUE == _is_descendant_of_ctxpopup(object_info)) {
+                       char* temp_text = strdup(text);
+                       ctxpop_text_list = eina_list_append(ctxpop_text_list, temp_text);
+                       VC_ELM_LOG_DUMP("####### [DEBUG] list in ctxpopup, text(%s)", temp_text);
+               }
        }
        if (text && strlen(text) > 0) {
                object_info->text = calloc(1, strlen(text) + 1);
@@ -819,9 +841,12 @@ ea_object_dump_full_list_get(Eina_Bool exclude_unfocusable_text)
        Ecore_Evas *ee = NULL;
        Evas *evas = NULL;
 
-       if (!ret_list)
+       if (ret_list)
                ea_object_dump_list_clear();
-
+       if (ctxpop_text_list) {
+               text_dump_genlist_in_ctxpopup_clear();
+               VC_ELM_LOG_DUMP("Clear ctxpop_text_list");
+       }
        Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr));
        if (!util_mgr) {
                printf("Fail : utility manager memory alloc\n");
@@ -984,3 +1009,19 @@ void ea_object_dump_unset_geometry_info()
        g_geo_w = 0;
        g_geo_h = 0;
 }
+
+Eina_List*
+text_dump_genlist_in_ctxpopup_get()
+{
+       return ctxpop_text_list;
+}
+
+void
+text_dump_genlist_in_ctxpopup_clear(void)
+{
+       char *text = NULL;
+       EINA_LIST_FREE(ctxpop_text_list, text) {
+               if (!text) free(text);
+       }
+       ctxpop_text_list = NULL;
+}