clouseau: Fixed highlight bug Verift that evas object was NOT deleted before trying to highlight

Signed-off-by: Aharon Hillel <a.hillel@samsung.com>

SVN revision: 72347
This commit is contained in:
Aharon Hillel 2012-06-18 07:22:53 +00:00 committed by Tom Hacohen
parent 2ddfd3c229
commit d58ccc2ba5
4 changed files with 65 additions and 11 deletions

View File

@ -994,11 +994,7 @@ _gl_selected(void *data EINA_UNUSED, Evas_Object *pobj EINA_UNUSED,
_bmp_object_ptr_cmp, t->ptr); _bmp_object_ptr_cmp, t->ptr);
if (v) if (v)
{ libclouseau_highlight(treeit->ptr, &treeit->info->evas_props);
bmp_info_st *view = v->data;
libclouseau_highlight(treeit->ptr, evas_object_evas_get(view->win),
&treeit->info->evas_props);
}
/* END - replacing libclouseau_highlight(obj); */ /* END - replacing libclouseau_highlight(obj); */
clouseau_obj_information_list_populate(treeit, gui->lb); clouseau_obj_information_list_populate(treeit, gui->lb);

View File

@ -630,14 +630,58 @@ libclouseau_highlight_fade(void *_rect)
return EINA_TRUE; return EINA_TRUE;
} }
static Evas_Object *
_verify_e_children(Evas_Object *obj, Evas_Object *ptr)
{ /* Verify that obj still exists (can be found on evas canvas) */
if (ptr == obj)
return ptr;
Evas_Object *child, *p = NULL;
Eina_List *tmp, *children = evas_object_smart_members_get(obj);
EINA_LIST_FOREACH(children, tmp, child)
{
p = _verify_e_children(child, ptr);
if (p) break;
}
eina_list_free(children);
return p;
}
static Evas_Object *
_verify_e_obj(Evas_Object *obj)
{ /* Verify that obj still exists (can be found on evas canvas) */
Evas_Object *o;
Eina_List *eeitr ,*objitr, *ees = ecore_evas_ecore_evas_list_get();
Ecore_Evas *ee;
Evas_Object *rt = NULL;
EINA_LIST_FOREACH(ees, eeitr, ee)
{
Evas *e = ecore_evas_get(ee);
Eina_List *objs = evas_objects_in_rectangle_get(e, SHRT_MIN, SHRT_MIN,
USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE);
EINA_LIST_FOREACH(objs, objitr, o)
{
rt = _verify_e_children(o, obj);
if (rt) break;
}
eina_list_free(objs);
if (rt) break;
}
eina_list_free(ees);
return rt;
}
void void
libclouseau_highlight(Evas_Object *obj, Evas *e, st_evas_props *props) libclouseau_highlight(Evas_Object *obj, st_evas_props *props)
{ {
Evas_Object *r; Evas_Object *r;
int x, y, wd, ht; int x, y, wd, ht;
if (!e) return;
if (props) if (props)
{ /* When working offline grab info from struct */ { /* When working offline grab info from struct */
x = props->x; x = props->x;
@ -646,8 +690,21 @@ libclouseau_highlight(Evas_Object *obj, Evas *e, st_evas_props *props)
ht = props->h; ht = props->h;
} }
else else
evas_object_geometry_get(obj, &x, &y, &wd, &ht); {
if (_verify_e_obj(obj))
evas_object_geometry_get(obj, &x, &y, &wd, &ht);
else
{
printf("<%s> Evas Object not found <%p> (probably deleted)\n",
__func__, obj);
return;
}
}
Evas *e = evas_object_evas_get(obj);
if (!e) return;
/* Continue and do the Highlight */
r = evas_object_rectangle_add(e); r = evas_object_rectangle_add(e);
evas_object_move(r, x - PADDING, y - PADDING); evas_object_move(r, x - PADDING, y - PADDING);
evas_object_resize(r, wd + (2 * PADDING), ht + (2 * PADDING)); evas_object_resize(r, wd + (2 * PADDING), ht + (2 * PADDING));

View File

@ -194,5 +194,5 @@ Eina_Bool eet_info_save(const char *filename, app_info_st *a, tree_data_st *ftd,
Eina_Bool eet_info_read(const char *filename, app_info_st **app, tree_data_st **ftd); Eina_Bool eet_info_read(const char *filename, app_info_st **app, tree_data_st **ftd);
/* Highlight code, we may choose to move this to other file later */ /* Highlight code, we may choose to move this to other file later */
void libclouseau_highlight(Evas_Object *obj, Evas *e, st_evas_props *props); void libclouseau_highlight(Evas_Object *obj, st_evas_props *props);
#endif /* EET_DATA_H */ #endif /* EET_DATA_H */

View File

@ -117,6 +117,7 @@ _load_list(void)
objs = evas_objects_in_rectangle_get(e, SHRT_MIN, SHRT_MIN, objs = evas_objects_in_rectangle_get(e, SHRT_MIN, SHRT_MIN,
USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE); USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE);
EINA_LIST_FOREACH(objs, objitr, obj) EINA_LIST_FOREACH(objs, objitr, obj)
{ {
libclouseau_item_add(obj, treeit); libclouseau_item_add(obj, treeit);
@ -203,7 +204,7 @@ _data(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Ipc_Event_Server_Data
{ /* Highlight msg contains PTR of object to highlight */ { /* Highlight msg contains PTR of object to highlight */
highlight_st *ht = v->data; highlight_st *ht = v->data;
Evas_Object *obj = (Evas_Object *) (uintptr_t) ht->object; Evas_Object *obj = (Evas_Object *) (uintptr_t) ht->object;
libclouseau_highlight(obj, evas_object_evas_get(obj), NULL); libclouseau_highlight(obj, NULL);
} }
break; break;