From 8fb8e6d257f7199acd450f082188c282a48d339b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Mon, 28 Mar 2016 17:47:02 +0900 Subject: [PATCH] Evas render: Fix no-render with smart objects Setting the no-render flag on an elm widget had no effect, as it was not properly propagated to its children. This should fix that, but I'm not a fan of the solution. Fixes T3371 --- src/lib/edje/edje_object.eo | 1 + src/lib/edje/edje_smart.c | 13 +++++++++++++ src/lib/elementary/elm_widget.c | 16 ++++++++++++++++ src/lib/elementary/elm_widget.eo | 1 + src/lib/evas/canvas/evas_clip.c | 4 +++- src/lib/evas/canvas/evas_object_smart.c | 9 +++++++++ src/lib/evas/canvas/evas_object_smart.eo | 5 +++++ src/lib/evas/canvas/evas_render.c | 6 +++--- src/lib/evas/include/evas_inline.x | 4 ++-- 9 files changed, 53 insertions(+), 6 deletions(-) diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index be0c90248f..305684c3c7 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -2234,6 +2234,7 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File) Evas.Object_Smart.add; Evas.Object_Smart.del; Evas.Object_Smart.resize; + Evas.Object_Smart.smart_no_render.set; Efl.File.file.set; Efl.File.file.get; Efl.File.mmap.set; diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index a8ef1bcd22..2e905bf2ac 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -331,6 +331,19 @@ _edje_object_evas_object_smart_hide(Eo *obj, Edje *ed) _edje_emit(ed, "hide", NULL); } +EOLIAN static void +_edje_object_evas_object_smart_smart_no_render_set(Eo *obj, Edje *ed, Eina_Bool hide) +{ + Eina_List *l; + Edje *edg; + + evas_obj_smart_no_render_set(eo_super(obj, MY_CLASS), hide); + if (evas_obj_no_render_get(obj) == hide) return; + + EINA_LIST_FOREACH(ed->groups, l, edg) + if (edg != ed) evas_obj_smart_no_render_set(edg->obj, hide); +} + EOLIAN static void _edje_object_evas_object_smart_calculate(Eo *obj EINA_UNUSED, Edje *ed) { diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index b110f323a7..e165af9178 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -555,6 +555,21 @@ _elm_widget_evas_object_smart_color_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA eina_iterator_free(it); } +EOLIAN static void +_elm_widget_evas_object_smart_smart_no_render_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Eina_Bool hide) +{ + Eina_Iterator *it; + Evas_Object *o; + + it = evas_object_smart_iterator_new(obj); + EINA_ITERATOR_FOREACH(it, o) + { + if (evas_object_data_get(o, "_elm_leaveme")) continue; + evas_obj_no_render_set(o, hide); + } + eina_iterator_free(it); +} + EOLIAN static void _elm_widget_evas_object_smart_clip_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Object *clip) { @@ -602,6 +617,7 @@ _elm_widget_evas_object_smart_member_add(Eo *obj, Elm_Widget_Smart_Data *_pd EIN evas_object_color_get(obj, &r, &g, &b, &a); evas_object_color_set(child, r, g, b, a); + evas_obj_no_render_set(child, evas_obj_no_render_get(obj)); evas_object_clip_set(child, evas_object_clip_get(obj)); if (evas_object_visible_get(obj)) diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index b618b4dcc9..505feb827e 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -851,6 +851,7 @@ abstract Elm.Widget (Evas.Object_Smart, Elm.Interface_Atspi_Accessible, Elm.Inte Evas.Object_Smart.clip.set; Evas.Object_Smart.member_add; Evas.Object_Smart.resize; + Evas.Object_Smart.smart_no_render.set; @virtual .focus_direction; @virtual .focus_next; @virtual .parent_widget.get; diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c index f1c5e4b1c3..3fda1f72ea 100644 --- a/src/lib/evas/canvas/evas_clip.c +++ b/src/lib/evas/canvas/evas_clip.c @@ -537,9 +537,11 @@ _evas_object_clipees_has(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj } EOLIAN void -_evas_object_no_render_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Eina_Bool enable) +_evas_object_no_render_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool enable) { obj->no_render = enable; + if (obj->is_smart) + evas_obj_smart_no_render_set(eo_obj, enable); } EOLIAN Eina_Bool diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c index 44c18f197f..57c8801926 100644 --- a/src/lib/evas/canvas/evas_object_smart.c +++ b/src/lib/evas/canvas/evas_object_smart.c @@ -678,6 +678,15 @@ _evas_object_smart_clip_unset(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED) if (s && s->smart_class->clip_unset) s->smart_class->clip_unset(eo_obj); } +EOLIAN static void +_evas_object_smart_smart_no_render_set(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, Eina_Bool hide) +{ + Evas_Object_Protected_Data *obj2; + + EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), obj2) + evas_obj_no_render_set(obj2->object, hide); +} + EOLIAN static void _evas_object_smart_attach(Eo *eo_obj, Evas_Smart_Data *_pd EINA_UNUSED, Evas_Smart *s) { diff --git a/src/lib/evas/canvas/evas_object_smart.eo b/src/lib/evas/canvas/evas_object_smart.eo index 3ecab659e2..f5f544ebff 100644 --- a/src/lib/evas/canvas/evas_object_smart.eo +++ b/src/lib/evas/canvas/evas_object_smart.eo @@ -113,6 +113,11 @@ class Evas.Object_Smart (Evas.Object, Evas.Signal_Interface) @in y: Evas.Coord; } } + @property smart_no_render { + [[Propagates the value of no-render to the smart children.]] + set { legacy: null; } + values { hide: bool; } + } callbacks_descriptions_set { [[Set an smart object instance's smart callbacks descriptions. diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index f3678e84f2..911440929a 100644 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -534,12 +534,12 @@ _evas_render_phase1_object_process(Evas_Public_Data *e, Evas_Object *eo_obj, obj->is_active = is_active; #ifdef REND_DBG - RD(level, "[--- PROCESS [%p (eo: %p)", obj, obj->object); + RD(level, "[--- PROCESS [%p", obj->object); IFRD(obj->name, 0, " '%s'", obj->name); RD(0, "] '%s' active = %i, del = %i | %i %i %ix%i\n", obj->type, is_active, obj->delete_me, obj->cur->geometry.x, obj->cur->geometry.y, obj->cur->geometry.w, obj->cur->geometry.h); #endif - if ((!mapped_parent) && ((is_active) || (obj->delete_me != 0))) + if ((!mapped_parent) && ((is_active) || (obj->delete_me != 0)) && !obj->no_render) OBJ_ARRAY_PUSH(active_objects, obj); if (is_active && obj->cur->snapshot && !obj->delete_me && evas_object_is_visible(eo_obj, obj)) @@ -2292,7 +2292,7 @@ evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *e, if (obj == top) break; /* if it's in our outpout rect and it doesn't clip anything */ - RD(level, " OBJ: [%p", obj); + RD(level, " OBJ: [%p", eo_obj); IFRD(obj->name, 0, " '%s'", obj->name); RD(level, "] '%s' %i %i %ix%i\n", obj->type, obj->cur->geometry.x, obj->cur->geometry.y, obj->cur->geometry.w, obj->cur->geometry.h); if ((evas_object_is_in_output_rect(eo_obj, obj, ux - fx, uy - fy, uw, uh) || diff --git a/src/lib/evas/include/evas_inline.x b/src/lib/evas/include/evas_inline.x index cf28ed7614..fcbceca8a8 100644 --- a/src/lib/evas/include/evas_inline.x +++ b/src/lib/evas/include/evas_inline.x @@ -137,8 +137,8 @@ evas_object_is_source_invisible(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Pro static inline int evas_object_is_visible(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) -{ /* post 1.0 -> enable? */ - if ((obj->cur->visible)/* && (obj->cur->color.a > 0)*/ && +{ + if ((obj->cur->visible) && (!obj->no_render) && ((obj->cur->cache.clip.visible) || (obj->is_smart)) && ((obj->cur->cache.clip.a > 0 && obj->cur->render_op == EVAS_RENDER_BLEND) || obj->cur->render_op != EVAS_RENDER_BLEND))