evas/proxy - +source visible set APIs

Need to care some more cases. will be upstreamed additionally.



SVN revision: 78180
This commit is contained in:
ChunEon Park 2012-10-18 11:30:04 +00:00
parent 4468ee3a7f
commit d9bdce172a
7 changed files with 206 additions and 33 deletions

View File

@ -8017,6 +8017,7 @@ EAPI void evas_object_image_alpha_mask_set(Evas_Object
*
* @see evas_object_image_source_get()
* @see evas_object_image_source_unset()
* @see evas_object_image_source_render_set()
*/
EAPI Eina_Bool evas_object_image_source_set(Evas_Object *obj, Evas_Object *src) EINA_ARG_NONNULL(1);
@ -8042,6 +8043,44 @@ EAPI Evas_Object *evas_object_image_source_get(const Evas_Objec
*/
EAPI Eina_Bool evas_object_image_source_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Set the source object to be shown or hidden.
*
* @param obj Proxy (image) object.
* @param visible @c EINA_TRUE is source object to be shown, @c EINA_FALSE
* otherwise.
*
* If the @p visible set to @c EINA_FALSE, the source object of the proxy(@p obj
* ) will be hidden.
*
* This API works differently with evas_object_show() and evas_object_hide().
* Once source object is hidden by evas_object_hide() then the proxy object will * be hidden also. Actually in this case both objects are excluded from the
* Evas internal updation. By this API, instead, you can set only proxy object
* to be shown. And even if source object is invisible, source object can be
*updated for proxy.
*
* @see evas_object_image_source_visible_get()
* @see evas_object_image_source_set()
* @see evas_object_show()
* @see evas_object_hide()
* @since 1.8
*/
EAPI void evas_object_image_source_visible_set(Evas_Object *obj, Eina_Bool visible) EINA_ARG_NONNULL(1);
/**
* Get the state of the source object visibility.
*
* @param obj Proxy (image) object.
* @return @c EINA_TRUE if source object is visible, @c EINA_FALSE otherwise.
*
* @see evas_object_image_source_visible_get()
* @see evas_object_image_source_set()
* @see evas_object_show()
* @see evas_object_hide()
* @since 1.8
*/
EAPI Eina_Bool evas_object_image_source_visible_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Check if a file extension may be supported by @ref Evas_Object_Image.
*
@ -15653,6 +15692,8 @@ enum
EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_LOOP_COUNT_GET,
EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_FRAME_DURATION_GET,
EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_FRAME_SET,
EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_SET,
EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET,
EVAS_OBJ_IMAGE_SUB_ID_LAST
};
@ -15727,6 +15768,28 @@ enum
*/
#define evas_obj_image_source_get(src) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_GET), EO_TYPECHECK(Evas_Object **, src)
/**
* @def evas_obj_image_source_visible_set
*
* Set the source object to be shown or hidden.
*
* @param[in] visible in
*
* @see evas_object_image_source_visible_get
*/
#define evas_obj_image_source_visible_set(visible) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_SET), EO_TYPECHECK(Eina_Bool, visible)
/**
* @def evas_obj_image_source_visible_get
*
* Get the state of the source object visibility.
*
* @param[out] visible out
*
* @see evas_obj_image_source_visible_set
*/
#define evas_obj_image_source_visible_get(visible) EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET), EO_TYPECHECK(Eina_Bool *, visible)
/**
* @def evas_obj_image_border_set
*

View File

@ -2044,7 +2044,8 @@ _freeze_events_set(Eo *eo_obj, void *_pd, va_list *list)
freeze = !!freeze;
if (obj->freeze_events == freeze) return;
obj->freeze_events = freeze;
evas_object_smart_member_cache_invalidate(eo_obj, EINA_FALSE, EINA_TRUE);
evas_object_smart_member_cache_invalidate(eo_obj, EINA_FALSE, EINA_TRUE,
EINA_FALSE);
}
EAPI Eina_Bool
@ -2083,7 +2084,7 @@ _pass_events_set(Eo *eo_obj, void *_pd, va_list *list)
pass = !!pass;
if (obj->pass_events == pass) return;
obj->pass_events = pass;
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_FALSE);
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_FALSE, EINA_FALSE);
if (evas_object_is_in_output_rect(eo_obj, obj,
obj->layer->evas->pointer.x,
obj->layer->evas->pointer.y, 1, 1) &&

View File

@ -88,6 +88,7 @@ struct _Evas_Object_Image
Eina_Bool dirty_pixels : 1;
Eina_Bool filled : 1;
Eina_Bool proxyrendering : 1;
Eina_Bool source_invisible : 1;
Eina_Bool preloading : 1;
Eina_Bool video_surface : 1;
Eina_Bool video_visible : 1;
@ -555,6 +556,51 @@ evas_object_image_source_unset(Evas_Object *eo_obj)
return result;
}
EAPI void
evas_object_image_source_visible_set(Evas_Object *eo_obj, Eina_Bool visible)
{
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
eo_do(eo_obj, evas_obj_image_source_visible_set(visible));
}
void
_image_source_visible_set(Eo *eo_obj, void *_pd, va_list *list)
{
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
Evas_Object_Protected_Data *src_obj;
Evas_Object_Image *o = _pd;
Eina_Bool visible = va_arg(*list, int);
visible = !!visible;
if (o->source_invisible == !visible) return;
o->source_invisible = !visible;
if (!o->cur.source) return;
src_obj = eo_data_get(o->cur.source, EVAS_OBJ_CLASS);
src_obj->proxy.source_invisible = !visible;
evas_object_smart_member_cache_invalidate(o->cur.source, EINA_FALSE,
EINA_FALSE, EINA_TRUE);
src_obj->changed = EINA_TRUE;
evas_object_change(o->cur.source, src_obj);
//FIXME: Feed mouse events here.
}
EAPI Eina_Bool
evas_object_image_source_visible_get(const Evas_Object *eo_obj)
{
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return EINA_FALSE;
MAGIC_CHECK_END();
Eina_Bool visible;
eo_do((Eo*)eo_obj, evas_obj_image_source_visible_get(&visible));
return visible;
}
EAPI void
evas_object_image_border_set(Evas_Object *eo_obj, int l, int r, int t, int b)
{
@ -564,6 +610,21 @@ evas_object_image_border_set(Evas_Object *eo_obj, int l, int r, int t, int b)
eo_do(eo_obj, evas_obj_image_border_set(l, r, t, b));
}
static void
_image_source_visible_get(Eo *eo_obj, void *_pd, va_list *list)
{
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
Evas_Object_Protected_Data *src_obj;
Evas_Object_Image *o = _pd;
Eina_Bool *visible = va_arg(*list, Eina_Bool *);
if (!visible) return;
src_obj = eo_data_get(o->cur.source, EVAS_OBJ_CLASS);
if (src_obj)
*visible = !o->source_invisible;
else *visible = EINA_FALSE;
}
static void
_image_border_set(Eo *eo_obj, void *_pd, va_list *list)
{
@ -2564,6 +2625,12 @@ _proxy_unset(Evas_Object *proxy)
cur_source->proxy.proxies = eina_list_remove(cur_source->proxy.proxies, proxy);
if (cur_source->proxy.source_invisible)
{
cur_source->proxy.source_invisible = EINA_FALSE;
evas_object_smart_member_cache_invalidate(o->cur.source, EINA_FALSE,
EINA_FALSE, EINA_TRUE);
}
o->cur.source = NULL;
if (o->cur.defmap)
{
@ -2572,7 +2639,6 @@ _proxy_unset(Evas_Object *proxy)
}
}
static void
_proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src)
{
@ -2586,6 +2652,12 @@ _proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src)
src->proxy.proxies = eina_list_append(src->proxy.proxies, eo_proxy);
src->proxy.redraw = EINA_TRUE;
if (o->source_invisible)
{
src->proxy.source_invisible = EINA_TRUE;
evas_object_smart_member_cache_invalidate(o->cur.source, EINA_FALSE,
EINA_FALSE, EINA_TRUE);
}
}
/* Some moron just set a proxy on a proxy.
@ -2704,11 +2776,12 @@ _proxy_subrender(Evas *eo_e, Evas_Object *eo_source)
evas_render_mapped(e, eo_source, source, ctx, source->proxy.surface,
-source->cur.geometry.x,
-source->cur.geometry.y,
1, 0, 0, e->output.w, e->output.h
1, 0, 0, e->output.w, e->output.h, EINA_TRUE
#ifdef REND_DBG
, 1
#endif
);
e->engine.func->context_free(e->engine.data.output, ctx);
source->proxy.surface = e->engine.func->image_dirty_region
(e->engine.data.output, source->proxy.surface, 0, 0, w, h);
@ -4415,6 +4488,8 @@ _class_constructor(Eo_Class *klass)
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_LOOP_COUNT_GET), _image_animated_loop_count_get),
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_FRAME_DURATION_GET), _image_animated_frame_duration_get),
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_FRAME_SET), _image_animated_frame_set),
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_SET), _image_source_visible_set),
EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET), _image_source_visible_get),
EO_OP_FUNC_SENTINEL
};
@ -4486,6 +4561,8 @@ static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_LOOP_COUNT_GET, "Get the number times the animation of the object loops."),
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_FRAME_DURATION_GET, "Get the duration of a sequence of frames."),
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_ANIMATED_FRAME_SET, "Set the frame to current frame of an image object."),
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_SET, "-"),
EO_OP_DESCRIPTION(EVAS_OBJ_IMAGE_SUB_ID_SOURCE_VISIBLE_GET, "-"),
EO_OP_DESCRIPTION_SENTINEL
};

View File

@ -247,7 +247,8 @@ _smart_member_add(Eo *smart_obj, void *_pd, va_list *list)
obj->layer->usage++;
obj->smart.parent = smart_obj;
o->contained = eina_inlist_append(o->contained, EINA_INLIST_GET(obj));
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE);
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE,
EINA_TRUE);
obj->restack = 1;
evas_object_change(eo_obj, obj);
evas_object_mapped_clip_across_mark(eo_obj, obj);
@ -286,7 +287,7 @@ _smart_member_del(Eo *smart_obj, void *_pd EINA_UNUSED, va_list *list)
o->contained = eina_inlist_remove(o->contained, EINA_INLIST_GET(obj));
o->member_count--;
obj->smart.parent = NULL;
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE);
evas_object_smart_member_cache_invalidate(eo_obj, EINA_TRUE, EINA_TRUE, EINA_TRUE);
obj->layer->usage--;
obj->cur.layer = obj->layer->layer;
evas_object_inject(eo_obj, obj, obj->layer->evas->evas);
@ -1135,7 +1136,8 @@ evas_object_smart_cleanup(Evas_Object *eo_obj)
void
evas_object_smart_member_cache_invalidate(Evas_Object *eo_obj,
Eina_Bool pass_events,
Eina_Bool freeze_events)
Eina_Bool freeze_events,
Eina_Bool source_invisible)
{
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return;
@ -1148,15 +1150,17 @@ evas_object_smart_member_cache_invalidate(Evas_Object *eo_obj,
obj->parent_cache.pass_events_valid = EINA_FALSE;
if (freeze_events)
obj->parent_cache.freeze_events_valid = EINA_FALSE;
if (source_invisible)
obj->parent_cache.source_invisible_valid = EINA_FALSE;
if (!obj->is_smart) return;
Evas_Object_Smart *o = eo_data_get(eo_obj, MY_CLASS);
EINA_INLIST_FOREACH(o->contained, member)
{
Evas_Object *eo_member = member->object;
evas_object_smart_member_cache_invalidate(eo_member,
pass_events,
freeze_events);
evas_object_smart_member_cache_invalidate(eo_member, pass_events,
freeze_events,
source_invisible);
}
}

View File

@ -855,10 +855,10 @@ _evas_render_can_use_overlay(Evas_Public_Data *e, Evas_Object *eo_obj)
}
Eina_Bool
evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
void *context, void *surface,
int off_x, int off_y, int mapped,
int ecx, int ecy, int ecw, int ech
evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj, void *context,
void *surface, int off_x, int off_y, int mapped, int ecx,
int ecy, int ecw, int ech, Eina_Bool proxy_render
#ifdef REND_DBG
, int level
#endif
@ -868,6 +868,9 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj, Evas_Object_Protect
Evas_Object_Protected_Data *obj2;
Eina_Bool clean_them = EINA_FALSE;
if ((evas_object_is_source_invisible(eo_obj, obj) && (!proxy_render)))
return clean_them;
evas_object_clip_recalc(eo_obj, obj);
RDI(level);
@ -1007,10 +1010,12 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj, Evas_Object_Protect
EINA_INLIST_FOREACH
(evas_object_smart_members_get_direct(eo_obj), obj2)
{
clean_them |= evas_render_mapped(e, obj2->object, obj2, ctx,
clean_them |= evas_render_mapped(e, obj2->object,
obj2, ctx,
obj->map.surface,
off_x2, off_y2, 1,
ecx, ecy, ecw, ech
ecx, ecy, ecw, ech,
proxy_render
#ifdef REND_DBG
, level + 1
#endif
@ -1119,10 +1124,11 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj, Evas_Object_Protect
EINA_INLIST_FOREACH
(evas_object_smart_members_get_direct(eo_obj), obj2)
{
clean_them |= evas_render_mapped(e, obj2->object, obj2, ctx,
surface,
clean_them |= evas_render_mapped(e, obj2->object,
obj2, ctx, surface,
off_x, off_y, 1,
ecx, ecy, ecw, ech
ecx, ecy, ecw, ech,
proxy_render
#ifdef REND_DBG
, level + 1
#endif
@ -1218,10 +1224,11 @@ _evas_render_cutout_add(Evas *eo_e, Evas_Object *eo_obj, int off_x, int off_y)
{
Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
if (evas_object_is_source_invisible(eo_obj, obj)) return;
if (evas_object_is_opaque(eo_obj, obj))
{
Evas_Coord cox, coy, cow, coh;
cox = obj->cur.cache.clip.x;
coy = obj->cur.cache.clip.y;
cow = obj->cur.cache.clip.w;
@ -1412,7 +1419,7 @@ evas_render_updates_internal(Evas *eo_e,
evas_object_move(e->framespace.clip,
e->framespace.x, e->framespace.y);
evas_object_resize(e->framespace.clip,
e->viewport.w - e->framespace.w,
e->viewport.w - e->framespace.w,
e->viewport.h - e->framespace.h);
evas_object_show(e->framespace.clip);
}
@ -1420,10 +1427,10 @@ evas_render_updates_internal(Evas *eo_e,
{
/* master clip is already present. check for size changes in the
* viewport, and update master clip size if needed */
if ((e->viewport.changed) || (e->output.changed) ||
if ((e->viewport.changed) || (e->output.changed) ||
(e->framespace.changed))
{
evas_object_move(e->framespace.clip,
evas_object_move(e->framespace.clip,
e->framespace.x, e->framespace.y);
evas_object_resize(e->framespace.clip,
e->viewport.w - e->framespace.w,
@ -1431,7 +1438,7 @@ evas_render_updates_internal(Evas *eo_e,
}
}
Evas_Object_Protected_Data *framespace_clip =
Evas_Object_Protected_Data *framespace_clip =
eo_data_get(e->framespace.clip, EVAS_OBJ_CLASS);
EINA_RECTANGLE_SET(&clip_rect,
@ -1638,8 +1645,10 @@ evas_render_updates_internal(Evas *eo_e,
}
#endif
clean_them |= evas_render_mapped(e, eo_obj, obj, e->engine.data.context,
surface, off_x, off_y, 0,
cx, cy, cw, ch
surface, off_x,
off_y, 0,
cx, cy, cw, ch,
EINA_FALSE
#ifdef REND_DBG
, 1
#endif

View File

@ -106,6 +106,21 @@ evas_event_passes_through(Evas_Object *eo_obj __UNUSED__, Evas_Object_Protected_
return obj->parent_cache.pass_events;
}
static inline int
evas_object_is_source_invisible(Evas_Object *eo_obj __UNUSED__, Evas_Object_Protected_Data *obj)
{
if (obj->parent_cache.source_invisible_valid)
return obj->parent_cache.source_invisible;
if (obj->proxy.proxies && obj->proxy.source_invisible) return 1;
if (!obj->smart.parent) return 0;
Evas_Object_Protected_Data *smart_parent_pd =
eo_data_get(obj->smart.parent, EVAS_OBJ_CLASS);
obj->parent_cache.source_invisible =
evas_object_is_source_invisible(obj->smart.parent, smart_parent_pd);
obj->parent_cache.source_invisible_valid = EINA_TRUE;
return obj->parent_cache.source_invisible;
}
static inline int
evas_object_is_visible(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
{ /* post 1.0 -> enable? */

View File

@ -595,7 +595,8 @@ struct _Evas_Object_Protected_Data
Eina_List *proxies;
void *surface;
int w,h;
Eina_Bool redraw;
Eina_Bool redraw : 1;
Eina_Bool source_invisible : 1;
} proxy;
// Pointer to the Evas_Object itself
@ -644,6 +645,8 @@ struct _Evas_Object_Protected_Data
Eina_Bool pass_events_valid : 1;
Eina_Bool freeze_events : 1;
Eina_Bool freeze_events_valid : 1;
Eina_Bool source_invisible : 1;
Eina_Bool source_invisible_valid : 1;
} parent_cache;
Eina_Bool restack : 1;
Eina_Bool is_active : 1;
@ -1074,7 +1077,7 @@ int evas_font_desc_cmp(const Evas_Font_Description *a, const Evas_Font_Descripti
Evas_Font_Description *evas_font_desc_ref(Evas_Font_Description *fdesc);
void * evas_font_load(Evas *evas, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size);
void evas_font_load_hinting_set(Evas *evas, void *font, int hinting);
void evas_object_smart_member_cache_invalidate(Evas_Object *obj, Eina_Bool pass_events, Eina_Bool freeze_events);
void evas_object_smart_member_cache_invalidate(Evas_Object *obj, Eina_Bool pass_events, Eina_Bool freeze_events, Eina_Bool sourve_invisible);
void evas_text_style_pad_get(Evas_Text_Style_Type style, int *l, int *r, int *t, int *b);
void _evas_object_text_rehint(Evas_Object *obj);
void _evas_object_textblock_rehint(Evas_Object *obj);
@ -1227,11 +1230,12 @@ void _evas_unwalk(Evas_Public_Data *e_pd);
// expose for use in engines
EAPI int _evas_module_engine_inherit(Evas_Func *funcs, char *name);
EAPI const char *_evas_module_libdir_get(void);
Eina_Bool evas_render_mapped(Evas_Public_Data *e, Evas_Object *obj, Evas_Object_Protected_Data *source_pd,
void *context, void *surface,
int off_x, int off_y, int mapped,
int ecx, int ecy, int ecw, int ech
Eina_Bool evas_render_mapped(Evas_Public_Data *e, Evas_Object *obj,
Evas_Object_Protected_Data *source_pd,
void *context, void *surface, int off_x, int off_y,
int mapped, int ecx, int ecy, int ecw, int ech,
Eina_Bool proxy_render
#ifdef REND_DBG
, int level
#endif