summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-11-23 21:49:44 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-11-23 21:49:44 +0000
commit96388823a7ca95523c0fb8f73cff87294fd9b63b (patch)
treefbc2269c9e5ca4c3f95a794b5cabf96915de7a8b
parentcf2d140f8c3ef2b91d55e653188a48c4d5640a66 (diff)
EPhysics: reset soft body's slices layer
If a evas object has its layer reset so we must apply the change its slices evas objects. Patch by: Leandro Dorileo <dorileo@profusion.mobi> SVN revision: 79595
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 4dd6cd8506..365eadc925 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -1038,6 +1038,23 @@ _ephysics_body_evas_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *o
1038 ephysics_world_lock_release(body->world); 1038 ephysics_world_lock_release(body->world);
1039} 1039}
1040 1040
1041 static void
1042_ephysics_body_soft_body_evas_restack_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1043{
1044 EPhysics_Body *body = (EPhysics_Body *)data;
1045 Eina_List *l;
1046 void *ldata;
1047 EPhysics_Body_Soft_Body_Slice *slice;
1048 short layer = evas_object_layer_get(obj);
1049
1050 EINA_LIST_FOREACH(body->slices_list, l, ldata)
1051 {
1052 slice = (EPhysics_Body_Soft_Body_Slice *)ldata;
1053 evas_object_layer_set(slice->evas_obj, layer);
1054 }
1055 DBG("Body's slices layer reset to: %d", layer);
1056}
1057
1041static void 1058static void
1042_ephysics_body_del(EPhysics_Body *body) 1059_ephysics_body_del(EPhysics_Body *body)
1043{ 1060{
@@ -1050,6 +1067,10 @@ _ephysics_body_del(EPhysics_Body *body)
1050 _ephysics_body_evas_obj_del_cb); 1067 _ephysics_body_evas_obj_del_cb);
1051 evas_object_event_callback_del(body->evas_obj, EVAS_CALLBACK_RESIZE, 1068 evas_object_event_callback_del(body->evas_obj, EVAS_CALLBACK_RESIZE,
1052 _ephysics_body_evas_obj_resize_cb); 1069 _ephysics_body_evas_obj_resize_cb);
1070
1071 if (body->slices_list)
1072 evas_object_event_callback_del(body->evas_obj, EVAS_CALLBACK_RESTACK,
1073 _ephysics_body_soft_body_evas_restack_cb);
1053 } 1074 }
1054 1075
1055 while (body->callbacks) 1076 while (body->callbacks)
@@ -2652,7 +2673,12 @@ ephysics_body_evas_object_set(EPhysics_Body *body, Evas_Object *evas_obj, Eina_B
2652 evas_object_event_callback_del(body->evas_obj, EVAS_CALLBACK_RESIZE, 2673 evas_object_event_callback_del(body->evas_obj, EVAS_CALLBACK_RESIZE,
2653 _ephysics_body_evas_obj_resize_cb); 2674 _ephysics_body_evas_obj_resize_cb);
2654 if (body->slices_list) 2675 if (body->slices_list)
2655 _ephysics_body_soft_body_slices_clean(body); 2676 {
2677 evas_object_event_callback_del(body->evas_obj,
2678 EVAS_CALLBACK_RESTACK,
2679 _ephysics_body_soft_body_evas_restack_cb);
2680 _ephysics_body_soft_body_slices_clean(body);
2681 }
2656 } 2682 }
2657 2683
2658 body->evas_obj = evas_obj; 2684 body->evas_obj = evas_obj;
@@ -2660,7 +2686,11 @@ ephysics_body_evas_object_set(EPhysics_Body *body, Evas_Object *evas_obj, Eina_B
2660 _ephysics_body_evas_obj_del_cb, body); 2686 _ephysics_body_evas_obj_del_cb, body);
2661 2687
2662 if (body->soft_body) 2688 if (body->soft_body)
2663 _ephysics_body_soft_body_slices_init(body); 2689 {
2690 evas_object_event_callback_add(body->evas_obj, EVAS_CALLBACK_RESTACK,
2691 _ephysics_body_soft_body_evas_restack_cb, body);
2692 _ephysics_body_soft_body_slices_init(body);
2693 }
2664 2694
2665 if (!use_obj_pos) 2695 if (!use_obj_pos)
2666 return; 2696 return;
@@ -2700,7 +2730,12 @@ ephysics_body_evas_object_unset(EPhysics_Body *body)
2700 } 2730 }
2701 2731
2702 if (body->slices_list) 2732 if (body->slices_list)
2703 _ephysics_body_soft_body_slices_clean(body); 2733 {
2734 evas_object_event_callback_del(body->evas_obj,
2735 EVAS_CALLBACK_RESTACK,
2736 _ephysics_body_soft_body_evas_restack_cb);
2737 _ephysics_body_soft_body_slices_clean(body);
2738 }
2704 2739
2705 return obj; 2740 return obj;
2706} 2741}