Evas render: Fix no-render with smart objects
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 28 Mar 2016 08:47:02 +0000 (17:47 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 29 Mar 2016 01:43:00 +0000 (10:43 +0900)
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
src/lib/edje/edje_smart.c
src/lib/elementary/elm_widget.c
src/lib/elementary/elm_widget.eo
src/lib/evas/canvas/evas_clip.c
src/lib/evas/canvas/evas_object_smart.c
src/lib/evas/canvas/evas_object_smart.eo
src/lib/evas/canvas/evas_render.c
src/lib/evas/include/evas_inline.x

index be0c902..305684c 100644 (file)
@@ -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;
index a8ef1bc..2e905bf 100644 (file)
@@ -332,6 +332,19 @@ _edje_object_evas_object_smart_hide(Eo *obj, Edje *ed)
 }
 
 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)
 {
    _edje_recalc_do(ed);
index b110f32..e165af9 100644 (file)
@@ -556,6 +556,21 @@ _elm_widget_evas_object_smart_color_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA
 }
 
 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)
 {
    Eina_Iterator *it;
@@ -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))
index b618b4d..505feb8 100644 (file)
@@ -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;
index f1c5e4b..3fda1f7 100644 (file)
@@ -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
index 44c18f1..57c8801 100644 (file)
@@ -679,6 +679,15 @@ _evas_object_smart_clip_unset(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED)
 }
 
 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)
 {
    MAGIC_CHECK(s, Evas_Smart, MAGIC_SMART);
index 3ecab65..f5f544e 100644 (file)
@@ -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.
 
index f3678e8..9114409 100644 (file)
@@ -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) ||
index cf28ed7..fcbceca 100644 (file)
@@ -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))