2 * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file vc_elm_efl_dump.c
19 * @brief The private module for efl object dump.
20 * @author Jaeyong Hwang <j_yong.hwang@samsung.com>
23 #include "vc_elm_tools.h"
24 #include "vc_elm_efl_dump.h"
26 #include <voice_control_elm_private.h>
28 #define EVAS_OBJECT_DUMP_DEBUG
29 #ifdef EVAS_OBJECT_DUMP_DEBUG
30 #define VC_ELM_LOG_DUMP(fmt, ...) SLOGD("\033[0;32m" fmt "\033[m", ## __VA_ARGS__)
32 #define VC_ELM_LOG_DUMP(fmt, ...)
35 typedef struct _Ea_Util_Mgr {
39 Eina_List *edje_part_name_list;
43 typedef struct _Edje_Info {
44 const Evas_Object *obj;
47 const char *image_name;
48 const char *color_class;
51 #define SPANS_COMMON(x1, w1, x2, w2) \
52 (!(((int)((x2) + (int)(w2)) < (int)(x1)) || (int)((x2) > (int)((x1) + (int)(w1)))))
54 #define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
55 ((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
57 Eina_List *ret_list = NULL;
58 Eina_List *ret_text_list = NULL;
59 Eina_List *ctxpop_text_list = NULL;
61 static Eina_Bool g_set_geometry = EINA_FALSE;
62 static int g_geo_x = 0, g_geo_y = 0, g_geo_w = 0, g_geo_h = 0;
63 static int find_popup = 0;
64 static int skip_text = 0;
66 int vc_elm_efl_dump_is_vt_auto_enabled()
68 int is_vt_automode = 0;
69 int ret = vc_elm_is_supported_vt_auto(&is_vt_automode);
71 VC_ELM_LOG_DUMP("Fail to check vt auto mode");
74 return is_vt_automode;
78 evas_object_is_visible_get(Evas_Object *obj)
80 int r = 0, g = 0, b = 0, a = 0;
81 Evas_Coord x = 0, y = 0, w = 0, h = 0;
82 Evas_Object *clip = NULL;
85 evas_object_color_get(obj, &r, &g, &b, &a);
86 evas_object_geometry_get(obj, &x, &y, &w, &h);
88 if (evas_object_visible_get(obj)) vis = 1;
89 clip = evas_object_clip_get(obj);
90 if (clip) evas_object_color_get(obj, &r, &g, &b, &a);
91 if (clip && !evas_object_visible_get(clip)) vis = 0;
93 if (clip && a == 0) vis = 0;
102 evas_object_type_match(const Evas_Object *obj, const char *type)
104 int ret = strcmp(EVAS_OBJECT_TYPE_GET(obj), type);
106 if (!ret) return EINA_TRUE;
111 evas_object_is_swallow_rect(const Evas_Object *obj)
113 int r = 0, g = 0, b = 0, a = 0;
115 evas_object_color_get(obj, &r, &g, &b, &a);
116 if (!r && !g && !b && !a
117 && evas_object_pointer_mode_get(obj) == EVAS_OBJECT_POINTER_MODE_NOGRAB
118 && evas_object_pass_events_get(obj))
125 _extract_edje_file_name(Object_Info *object_info, const char *full_path)
127 char name[255] = {0, };
128 unsigned int i, cnt = 0;
130 if (!full_path) return;
132 for (i = 0; i < strlen(full_path); i++) {
133 if (full_path[i] == '/') {
137 name[cnt++] = full_path[i];
140 object_info->edje_file = calloc(1, strlen(name) + 1);
141 strncpy(object_info->edje_file, name, strlen(name) + 1);
145 _edje_file_info_save(Ea_Util_Mgr *util_mgr, const Evas_Object *obj)
147 Evas_Object *ed = NULL;
148 const Evas_Object *pobj = NULL;
149 Eina_List *parts = NULL, *l = NULL;
150 Edje_Info *edje_info = NULL;
151 const char *file = NULL, *group = NULL, *pname = NULL, *ret = NULL;
154 if (!evas_object_type_match(obj, "edje")) return;
156 edje_object_file_get(obj, &file, &group);
158 ed = edje_edit_object_add(util_mgr->evas); // evas new ??
159 if (edje_object_file_set(ed, file, group)) {
160 parts = edje_edit_parts_list_get(ed);
161 EINA_LIST_FOREACH(parts, l, pname) {
162 if ((pobj = edje_object_part_object_get(obj, pname))) {
163 edje_info = malloc(sizeof(Edje_Info));
165 VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory");
168 edje_info->obj = pobj;
169 edje_info->part_name = strdup(pname);
170 ret = edje_object_part_state_get(obj, edje_info->part_name, &val);
173 edje_info->color_class = edje_edit_state_color_class_get(ed, edje_info->part_name , ret, val);
174 edje_info->image_name = edje_edit_state_image_get(ed, edje_info->part_name , ret, val);
177 util_mgr->edje_part_name_list = eina_list_append(util_mgr->edje_part_name_list, edje_info);
181 edje_edit_string_list_free(parts);
187 _obj_tree_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent)
189 Eina_List *children = NULL, *l = NULL;
190 Evas_Object *child, *smart_parent_obj = NULL;
191 Evas_Coord x = 0, y = 0, w = 0, h = 0;
192 Eina_Bool is_clip = EINA_FALSE;
193 int r = 0, g = 0, b = 0, a = 0;
194 const char *ret = NULL;
196 const char *file = NULL, *key = NULL, *group = NULL, *text = NULL;
197 Edje_Info *edje_info = NULL;
198 Object_Info *object_info = NULL;
202 if (!evas_object_is_visible_get(obj)) return;
205 evas_object_geometry_get(obj, &x, &y, &w, &h);
207 if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) return;
210 if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE;
211 if (is_clip) goto next;
213 object_info = calloc(1, sizeof(Object_Info));
215 VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory");
219 object_info->parent = parent;
221 object_info->address = (int)obj;
222 object_info->geometry_info.x = x;
223 object_info->geometry_info.y = y;
224 object_info->geometry_info.w = w;
225 object_info->geometry_info.h = h;
227 if (elm_widget_is(obj)) {
228 if (elm_object_focus_get(obj))
229 object_info->focus = EINA_TRUE;
231 object_info->focus = EINA_FALSE;
233 if (elm_widget_can_focus_get(obj) &&
234 (!elm_object_disabled_get(obj)))
235 object_info->focusable = EINA_TRUE;
237 object_info->focusable = EINA_FALSE;
240 // evas object type check
241 if (evas_object_is_swallow_rect(obj)) {
242 object_info->type = calloc(1, strlen("swallow") + 1);
243 strncpy(object_info->type, "swallow", strlen("swallow") + 1);
244 } else if (evas_object_type_match(obj, "rectangle")) {
245 object_info->type = calloc(1, strlen("rect") + 1);
246 strncpy(object_info->type, "rect", strlen("rect") + 1);
247 evas_object_color_get(obj, &r, &g, &b, &a);
248 object_info->rgb_info.r = r;
249 object_info->rgb_info.g = g;
250 object_info->rgb_info.b = b;
251 object_info->rgb_info.a = a;
253 object_info->type = calloc(1, strlen(EVAS_OBJECT_TYPE_GET(obj)) + 1);
254 strncpy(object_info->type, EVAS_OBJECT_TYPE_GET(obj), strlen(EVAS_OBJECT_TYPE_GET(obj)) + 1);
257 smart_parent_obj = evas_object_smart_parent_get(obj);
260 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_icon") ||
261 !strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_image")) {
262 elm_image_file_get(obj, &file, &key);
263 evas_object_data_set(obj, "image_name", file);
267 if (smart_parent_obj && evas_object_type_match(obj, "image")
268 && (evas_object_type_match(smart_parent_obj, "elm_icon")
269 || evas_object_type_match(smart_parent_obj, "elm_image"))) {
270 if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) {
271 _extract_edje_file_name(object_info, ret);
272 evas_object_data_del(smart_parent_obj, "edje_image_name");
277 if (evas_object_type_match(obj, "edje")) {
278 edje_object_file_get(obj, &file, &group);
280 object_info->group = calloc(1, strlen(group) + 1);
281 strncpy(object_info->group, group, strlen(group) + 1);
284 _extract_edje_file_name(object_info, file);
285 _edje_file_info_save(util_mgr, obj);
289 if (!is_clip && smart_parent_obj
290 && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) {
291 EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) {
292 if (edje_info->obj == obj) {
293 if (edje_info->color_class) {
294 object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1);
295 strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1);
298 ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val);
299 object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1);
300 object_info->part_state = calloc(1, strlen(ret) + 1);
301 strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1);
302 strncpy(object_info->part_state, ret, strlen(ret) + 1);
304 if (edje_info->image_name) {
305 object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1);
306 strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1);
314 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "text"))
315 text = eina_stringshare_add(evas_object_text_text_get(obj));
316 else if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "textblock")) {
317 ret = evas_object_textblock_text_markup_get(obj);
318 temp = evas_textblock_text_markup_to_utf8(obj, ret);
319 text = eina_stringshare_add(temp);
326 if (text && strlen(text) > 0) {
327 object_info->text = calloc(1, strlen(text) + 1);
328 strncpy(object_info->text, text, strlen(text) + 1);
331 ret_list = eina_list_append(ret_list, object_info);
333 if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) {
334 children = evas_object_smart_members_get(obj);
335 EINA_LIST_FREE(children, child)
336 _obj_tree_items(util_mgr, child, object_info);
340 static Eina_Bool _is_clickable_object(Evas_Object *obj)
342 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_win") || !strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_naviframe") || !strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_label")
343 || !strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_ctxpopup") || !strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_popup")) {
344 VC_ELM_LOG_DUMP("Not clickable object(%s)", EVAS_OBJECT_TYPE_GET(obj));
351 static Eina_Bool _is_descendant_of_list(Object_Info *object_info)
353 Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
354 while (NULL != parent_info) {
355 const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
356 if (NULL != widget_type) {
357 VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", EVAS_OBJECT_TYPE_GET((Evas_Object*)(parent_info->address)), widget_type);
358 if (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List") || !strcmp(widget_type, "Elm_Ctxpopup") || !strcmp(widget_type, "Elm_Index"))
361 parent_info = ea_object_dump_parent_widget_data_get(parent_info);
366 static Eina_Bool _is_descendant_of_ctxpopup(Object_Info *object_info)
368 Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
369 while (NULL != parent_info) {
370 const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
371 if (NULL != widget_type) {
372 VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", EVAS_OBJECT_TYPE_GET((Evas_Object*)(parent_info->address)), widget_type);
373 if (!strcmp(widget_type, "Elm_Ctxpopup"))
376 parent_info = ea_object_dump_parent_widget_data_get(parent_info);
381 static Eina_Bool _is_descendant_of_toolbar(Object_Info *object_info)
383 Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
384 while (NULL != parent_info) {
385 const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
386 if (NULL != widget_type) {
387 VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", EVAS_OBJECT_TYPE_GET((Evas_Object*)(parent_info->address)), widget_type);
388 if (!strcmp(widget_type, "Elm_Toolbar"))
391 parent_info = ea_object_dump_parent_widget_data_get(parent_info);
396 static Eina_Bool _has_accessible_name(Object_Info *object_info)
398 Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
399 while (NULL != parent_info) {
400 const char* text = NULL;
401 Evas_Object *obj = (Evas_Object *)(parent_info->address);
402 const char* widget_type = elm_widget_type_get(obj);
404 if (NULL != widget_type) {
405 if (elm_atspi_accessible_name_get(obj) && EINA_TRUE == parent_info->focusable && EINA_TRUE == _is_clickable_object(obj)) {
406 text = elm_atspi_accessible_name_get(obj);
407 VC_ELM_LOG_DUMP("####### [DEBUG] atspi_text(%s)", text);
408 } else if (elm_atspi_accessible_name_get(obj) && !strcmp(widget_type, "Elm_Toolbar")) {
409 text = elm_atspi_accessible_name_get(obj);
410 VC_ELM_LOG_DUMP("####### [DEBUG] toolbar(%s)", text);
414 VC_ELM_LOG_DUMP("####### [DEBUG] widget_type(%s), text(%s)", widget_type, text);
417 parent_info = ea_object_dump_parent_widget_data_get(parent_info);
423 _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent, Eina_Bool parent_widget_focusable, Eina_Bool list_type, int cnt)
425 Eina_List *children = NULL, *l = NULL;
426 Evas_Object *child, *smart_parent_obj = NULL;
427 Evas_Coord x = 0, y = 0, w = 0, h = 0;
428 Eina_Bool is_clip = EINA_FALSE;
429 int r = 0, g = 0, b = 0, a = 0;
430 const char *ret = NULL;
432 const char *file = NULL, *key = NULL, *group = NULL, *text = NULL;
433 Edje_Info *edje_info = NULL;
434 Object_Info *object_info = NULL;
437 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));
440 if (!evas_object_is_visible_get(obj)) {
441 VC_ELM_LOG_DUMP(" [%d] Object(%s) : Invisible)", cnt, EVAS_OBJECT_TYPE_GET(obj));
445 if (evas_object_type_match(obj, "elm_popup") || evas_object_type_match(obj, "elm_ctxpopup")) {
446 if (elm_object_part_text_get(obj, "title,text")) skip_text = 1;
447 eina_list_free(ret_list);
453 VC_ELM_LOG_DUMP(" [%d] Object(%s) : Find_popup", cnt, EVAS_OBJECT_TYPE_GET(obj));
458 evas_object_geometry_get(obj, &x, &y, &w, &h);
460 if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) {
461 VC_ELM_LOG_DUMP("## x(%d), y(%d), w(%d), h(%d), util_mgr->x(%d), util_mgr->y(%d), util_mgr->w(%d), util_mgr->h(%d)", x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h);
462 VC_ELM_LOG_DUMP("## RECTS_INTERSECT(%d), SPANS_COMMON_X(%d), SPANS_COMMON_Y(%d)", RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h),
463 SPANS_COMMON(x, w, util_mgr->x, util_mgr->w), SPANS_COMMON(y, h, util_mgr->y, util_mgr->h));
468 if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE;
470 VC_ELM_LOG_DUMP("is_clip(%d)", is_clip);
474 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "text") || !strcmp(EVAS_OBJECT_TYPE_GET(obj), "textblock")) {
475 if (!parent_widget_focusable && !list_type) {
476 VC_ELM_LOG_DUMP("## parent_widget_focusable(%d), list_type(%d)", parent_widget_focusable, list_type);
481 VC_ELM_LOG_DUMP(" [%d] Object(%s) : Skip_text", cnt, EVAS_OBJECT_TYPE_GET(obj));
486 object_info = calloc(1, sizeof(Object_Info));
488 VC_ELM_LOG_ERR("[ERROR] Fail to allocate memory");
492 object_info->parent = parent;
494 object_info->address = (int)obj;
495 object_info->geometry_info.x = x;
496 object_info->geometry_info.y = y;
497 object_info->geometry_info.w = w;
498 object_info->geometry_info.h = h;
500 if (elm_widget_is(obj)) {
501 if (elm_object_focus_get(obj))
502 object_info->focus = EINA_TRUE;
504 object_info->focus = EINA_FALSE;
506 if (elm_widget_can_focus_get(obj) &&
507 (!elm_object_disabled_get(obj))) {
508 object_info->focusable = EINA_TRUE;
509 parent_widget_focusable = EINA_TRUE;
511 object_info->focusable = EINA_FALSE;
512 parent_widget_focusable = EINA_FALSE;
516 if (evas_object_type_match(obj, "elm_genlist") || evas_object_type_match(obj, "elm_gengrid") || evas_object_type_match(obj, "elm_list") || evas_object_type_match(obj, "elm_ctxpopup") || evas_object_type_match(obj, "elm_index"))
517 list_type = EINA_TRUE;
520 // evas object type check
521 if (evas_object_is_swallow_rect(obj)) {
522 object_info->type = calloc(1, strlen("swallow") + 1);
523 strncpy(object_info->type, "swallow", strlen("swallow") + 1);
524 } else if (evas_object_type_match(obj, "rectangle")) {
525 object_info->type = calloc(1, strlen("rect") + 1);
526 strncpy(object_info->type, "rect", strlen("rect") + 1);
527 evas_object_color_get(obj, &r, &g, &b, &a);
528 object_info->rgb_info.r = r;
529 object_info->rgb_info.g = g;
530 object_info->rgb_info.b = b;
531 object_info->rgb_info.a = a;
533 object_info->type = calloc(1, strlen(EVAS_OBJECT_TYPE_GET(obj)) + 1);
534 strncpy(object_info->type, EVAS_OBJECT_TYPE_GET(obj), strlen(EVAS_OBJECT_TYPE_GET(obj)) + 1);
537 smart_parent_obj = evas_object_smart_parent_get(obj);
540 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_icon") ||
541 !strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_image")) {
542 elm_image_file_get(obj, &file, &key);
543 evas_object_data_set(obj, "image_name", file);
547 if (smart_parent_obj && evas_object_type_match(obj, "image")
548 && (evas_object_type_match(smart_parent_obj, "elm_icon")
549 || evas_object_type_match(smart_parent_obj, "elm_image"))) {
550 if ((ret = evas_object_data_get(smart_parent_obj, "image_name"))) {
551 _extract_edje_file_name(object_info, ret);
552 evas_object_data_del(smart_parent_obj, "edje_image_name");
557 if (evas_object_type_match(obj, "edje")) {
558 edje_object_file_get(obj, &file, &group);
560 object_info->group = calloc(1, strlen(group) + 1);
561 strncpy(object_info->group, group, strlen(group) + 1);
564 _extract_edje_file_name(object_info, file);
565 _edje_file_info_save(util_mgr, obj);
569 if (!is_clip && smart_parent_obj
570 && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje")) {
571 EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info) {
572 if (edje_info->obj == obj) {
573 if (edje_info->color_class) {
574 object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1);
575 strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1);
578 ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val);
579 object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1);
580 object_info->part_state = calloc(1, strlen(ret) + 1);
581 strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1);
582 strncpy(object_info->part_state, ret, strlen(ret) + 1);
584 if (edje_info->image_name) {
585 object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1);
586 strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1);
594 if (0 == vc_elm_efl_dump_is_vt_auto_enabled()) {
595 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "text"))
596 text = eina_stringshare_add(evas_object_text_text_get(obj));
597 else if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "textblock")) {
598 ret = evas_object_textblock_text_markup_get(obj);
599 temp = evas_textblock_text_markup_to_utf8(obj, ret);
600 text = eina_stringshare_add(temp);
608 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "text") && EINA_TRUE == _is_descendant_of_list(object_info)) {
609 text = eina_stringshare_add(evas_object_text_text_get(obj));
610 VC_ELM_LOG_DUMP("####### [DEBUG] text(%s), atspi_text(%s)", text, elm_atspi_accessible_name_get(obj));
611 } else if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "textblock") && EINA_TRUE == _is_descendant_of_list(object_info)) {
612 ret = evas_object_textblock_text_markup_get(obj);
613 temp = evas_textblock_text_markup_to_utf8(obj, ret);
614 text = eina_stringshare_add(temp);
620 VC_ELM_LOG_DUMP("####### [DEBUG] textblock(%s), atspi_text(%s)", text, elm_atspi_accessible_name_get(obj));
621 } else if (elm_atspi_accessible_name_get(obj) && EINA_TRUE == object_info->focusable && EINA_TRUE == _is_clickable_object(obj)) {
622 text = elm_atspi_accessible_name_get(obj);
623 VC_ELM_LOG_DUMP("####### [DEBUG] atspi_text(%s)", text);
624 } else if (elm_atspi_accessible_name_get(obj) && !strcmp(EVAS_OBJECT_TYPE_GET(obj), "elm_layout") && EINA_TRUE == _is_descendant_of_toolbar(object_info)) {
625 text = elm_atspi_accessible_name_get(obj);
626 VC_ELM_LOG_DUMP("####### [DEBUG] toolbar(%s)", text);
628 if (EINA_FALSE == _has_accessible_name(object_info)) {
629 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "text")) {
630 text = eina_stringshare_add(evas_object_text_text_get(obj));
631 VC_ELM_LOG_DUMP("####### [DEBUG] text(%s), part_name(%s)", text, object_info->part_name);
632 } else if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "textblock")) {
633 ret = evas_object_textblock_text_markup_get(obj);
634 temp = evas_textblock_text_markup_to_utf8(obj, ret);
635 text = eina_stringshare_add(temp);
636 VC_ELM_LOG_DUMP("####### [DEBUG] textblock(%s), part_name(%s)", text, object_info->part_name);
646 if (NULL != text && EINA_TRUE == _is_descendant_of_list(object_info) && EINA_TRUE == _is_descendant_of_ctxpopup(object_info)) {
647 char* temp_text = strdup(text);
648 ctxpop_text_list = eina_list_append(ctxpop_text_list, temp_text);
649 VC_ELM_LOG_DUMP("####### [DEBUG] list in ctxpopup, text(%s)", temp_text);
652 if (text && strlen(text) > 0) {
653 object_info->text = calloc(1, strlen(text) + 1);
654 strncpy(object_info->text, text, strlen(text) + 1);
657 ret_list = eina_list_append(ret_list, object_info);
659 if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) {
660 children = evas_object_smart_members_get(obj);
661 EINA_LIST_FREE(children, child)
662 _obj_tree_items_exclude_unfocusable_text(util_mgr, child, object_info, parent_widget_focusable, list_type, cnt + 1);
663 if (evas_object_type_match(obj, "elm_popup") || evas_object_type_match(obj, "elm_ctxpopup")) find_popup = 1;
665 VC_ELM_LOG_DUMP(" [%d] %s : return", cnt, EVAS_OBJECT_TYPE_GET(obj));
669 _obj_tree_text_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj)
671 Eina_List *children = NULL, *l = NULL;
673 Evas_Coord x = 0, y = 0, w = 0, h = 0;
674 Eina_Bool is_clip = EINA_FALSE;
675 const char *ret = NULL;
676 const char *text = NULL;
682 if (!evas_object_is_visible_get(obj)) return;
685 evas_object_geometry_get(obj, &x, &y, &w, &h);
687 if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) return;
690 if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE;
691 if (is_clip) goto next;
694 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "text"))
695 text = eina_stringshare_add(evas_object_text_text_get(obj));
696 else if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "textblock")) {
697 ret = evas_object_textblock_text_markup_get(obj);
698 temp = evas_textblock_text_markup_to_utf8(obj, ret);
699 text = eina_stringshare_add(temp);
706 if (text && strlen(text) > 0) {
708 EINA_LIST_FOREACH(ret_text_list, l, data) {
709 if (!strcmp(data, text)) {
714 if (check) ret_text_list = eina_list_append(ret_text_list, text);
718 if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) {
719 children = evas_object_smart_members_get(obj);
720 EINA_LIST_FREE(children, child)
721 _obj_tree_text_items(util_mgr, child);
726 _obj_tree_text_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Eina_Bool parent_widget_focusable)
728 Eina_List *children = NULL, *l = NULL;
730 Evas_Coord x = 0, y = 0, w = 0, h = 0;
731 Eina_Bool is_clip = EINA_FALSE;
732 const char *ret = NULL;
733 const char *text = NULL;
739 if (!evas_object_is_visible_get(obj)) return;
742 evas_object_geometry_get(obj, &x, &y, &w, &h);
744 if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) /*return;*/ goto next;
747 if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE;
748 if (is_clip) goto next;
750 if (elm_widget_is(obj)) {
751 if (elm_widget_can_focus_get(obj)) parent_widget_focusable = EINA_TRUE;
752 else parent_widget_focusable = EINA_FALSE;
756 if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "text")) {
757 if (!parent_widget_focusable) goto next;
758 text = eina_stringshare_add(evas_object_text_text_get(obj));
759 } else if (!strcmp(EVAS_OBJECT_TYPE_GET(obj), "textblock")) {
760 if (!parent_widget_focusable) goto next;
761 ret = evas_object_textblock_text_markup_get(obj);
762 temp = evas_textblock_text_markup_to_utf8(obj, ret);
763 text = eina_stringshare_add(temp);
770 if (text && strlen(text) > 0) {
772 EINA_LIST_FOREACH(ret_text_list, l, data) {
773 if (!strcmp(data, text)) {
778 if (check) ret_text_list = eina_list_append(ret_text_list, text);
782 if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) {
783 children = evas_object_smart_members_get(obj);
784 EINA_LIST_FREE(children, child)
785 _obj_tree_text_items_exclude_unfocusable_text(util_mgr, child, parent_widget_focusable);
790 _object_tree(Ea_Util_Mgr *util_mgr, int val, Eina_Bool exclude_unfocusable_text)
792 Eina_List *objs = NULL;
793 Evas_Object *obj = NULL;
795 objs = evas_objects_in_rectangle_get(util_mgr->evas, SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE);
798 if (exclude_unfocusable_text) {
799 EINA_LIST_FREE(objs, obj) {
800 VC_ELM_LOG_DUMP("###################### start ########################");
801 _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE, EINA_FALSE, 0);
804 EINA_LIST_FREE(objs, obj)
805 _obj_tree_items(util_mgr, obj, NULL);
807 } else if (val == 2) {
808 if (exclude_unfocusable_text) {
809 EINA_LIST_FREE(objs, obj)
810 _obj_tree_text_items_exclude_unfocusable_text(util_mgr, obj, EINA_FALSE);
812 EINA_LIST_FREE(objs, obj)
813 _obj_tree_text_items(util_mgr, obj);
819 ea_object_dump_list_clear(void)
821 Object_Info *obj_info = NULL;
822 EINA_LIST_FREE(ret_list, obj_info) {
823 if (!obj_info->type) free(obj_info->type);
824 if (!obj_info->edje_file) free(obj_info->edje_file);
825 if (!obj_info->group) free(obj_info->group);
826 if (!obj_info->image_name) free(obj_info->image_name);
827 if (!obj_info->color_class) free(obj_info->color_class);
828 if (!obj_info->part_name) free(obj_info->part_name);
829 if (!obj_info->part_state) free(obj_info->part_state);
830 if (!obj_info->text) free(obj_info->text);
838 ea_object_dump_full_list_get(Eina_Bool exclude_unfocusable_text)
840 Eina_List *ecore_evas_list = NULL;
841 Ecore_Evas *ee = NULL;
845 ea_object_dump_list_clear();
846 if (ctxpop_text_list) {
847 text_dump_genlist_in_ctxpopup_clear();
848 VC_ELM_LOG_DUMP("Clear ctxpop_text_list");
850 Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr));
852 printf("Fail : utility manager memory alloc\n");
856 ecore_evas_list = ecore_evas_ecore_evas_list_get();
858 EINA_LIST_FREE(ecore_evas_list, ee) {
859 evas = ecore_evas_get(ee);
860 util_mgr->evas = evas;
866 Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
868 if (EINA_TRUE == g_set_geometry) {
869 util_mgr->x = g_geo_x;
870 util_mgr->y = g_geo_y;
871 util_mgr->w = g_geo_w;
872 util_mgr->h = g_geo_h;
876 ecore_wl2_display_screen_size_get(wl2_display, &util_mgr->w, &util_mgr->h);
879 _object_tree(util_mgr, 1, exclude_unfocusable_text);
883 if (!util_mgr) return NULL;
884 if (util_mgr->edje_part_name_list)
885 eina_list_free(util_mgr->edje_part_name_list); // need to check
891 ea_object_dump_text_list_get(Eina_Bool exclude_unfocusable_text)
893 Eina_List *ecore_evas_list = NULL;
894 Ecore_Evas *ee = NULL;
897 Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr));
899 printf("Fail : utility manager memory alloc\n");
903 ecore_evas_list = ecore_evas_ecore_evas_list_get();
905 EINA_LIST_FREE(ecore_evas_list, ee) {
906 evas = ecore_evas_get(ee);
907 util_mgr->evas = evas;
913 Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
914 ecore_wl2_display_screen_size_get(wl2_display, &util_mgr->w, &util_mgr->h);
916 _object_tree(util_mgr, 2, exclude_unfocusable_text);
920 if (!util_mgr) return NULL;
922 return ret_text_list;
926 ea_object_dump_find_data(Eina_List *list, const char *str1, const char *str2)
929 Object_Info *data = NULL;
930 Eina_List *ret_data_list = NULL;
932 if (!list) return NULL;
933 if (!str1 || !str2) return NULL;
935 if (!strcmp(str1, "type")) {
936 EINA_LIST_FOREACH(list, l, data) {
938 if (!strcmp(data->type, str2)) ret_data_list = eina_list_append(ret_data_list, data);
940 } else if (!strcmp(str1, "edje_file")) {
941 EINA_LIST_FOREACH(list, l, data) {
943 if (!strcmp(data->edje_file, str2)) ret_data_list = eina_list_append(ret_data_list, data);
945 } else if (!strcmp(str1, "group")) {
946 EINA_LIST_FOREACH(list, l, data) {
948 if (!strcmp(data->group, str2)) ret_data_list = eina_list_append(ret_data_list, data);
950 } else if (!strcmp(str1, "image_name")) {
951 EINA_LIST_FOREACH(list, l, data) {
952 if (data->image_name)
953 if (!strcmp(data->image_name, str2)) ret_data_list = eina_list_append(ret_data_list, data);
955 } else if (!strcmp(str1, "color_class")) {
956 EINA_LIST_FOREACH(list, l, data) {
957 if (data->color_class)
958 if (!strcmp(data->color_class, str2)) ret_data_list = eina_list_append(ret_data_list, data);
960 } else if (!strcmp(str1, "part_name")) {
961 EINA_LIST_FOREACH(list, l, data) {
963 if (!strcmp(data->part_name, str2)) ret_data_list = eina_list_append(ret_data_list, data);
965 } else if (!strcmp(str1, "part_state")) {
966 EINA_LIST_FOREACH(list, l, data) {
967 if (data->part_state)
968 if (!strcmp(data->part_state, str2)) ret_data_list = eina_list_append(ret_data_list, data);
970 } else if (!strcmp(str1, "text")) {
971 EINA_LIST_FOREACH(list, l, data) {
973 if (!strcmp(data->text, str2)) ret_data_list = eina_list_append(ret_data_list, data);
977 return ret_data_list;
981 ea_object_dump_parent_widget_data_get(const Object_Info *obj_info)
983 if (NULL == obj_info) {
984 VC_ELM_LOG_DUMP("obj_info is NULL");
988 Object_Info *parent_info = NULL;
990 parent_info = obj_info->parent;
991 while (parent_info) {
992 if (strstr(parent_info->type, "elm"))
994 parent_info = parent_info->parent;
999 void ea_object_dump_set_geometry_info(int x, int y, int w, int h)
1001 g_set_geometry = EINA_TRUE;
1008 void ea_object_dump_unset_geometry_info()
1010 g_set_geometry = EINA_FALSE;
1018 text_dump_genlist_in_ctxpopup_get()
1020 return ctxpop_text_list;
1024 text_dump_genlist_in_ctxpopup_clear(void)
1027 EINA_LIST_FREE(ctxpop_text_list, text) {
1028 if (!text) free(text);
1030 ctxpop_text_list = NULL;