summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-08-20 13:15:56 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-20 13:15:57 -0400
commit365c0334ff66af2592c8f86f542024d0b506ca3e (patch)
treec337d6cb92c7f71cbb47363cbc263fae4725bf95 /src
parent87332f2e3ab2694f27913222ddadbadbca5c4d54 (diff)
efl_object: add call for getting invalidating
Summary: there is now invalidated & invalidating. invalidated returns true when all children are invalidated, and the object is / was requested to be invalidated. invalidating return true when the object is called to be invalidated but not all children are invalidated yet. However, the object is garanteed to be invalidated in near future. Reviewers: zmike Reviewed By: zmike Subscribers: cedric Tags: #efl, #do_not_merge Differential Revision: https://phab.enlightenment.org/D6722
Diffstat (limited to 'src')
-rw-r--r--src/lib/eo/efl_object.eo11
-rw-r--r--src/lib/eo/eo_base_class.c10
-rw-r--r--src/tests/eo/suite/eo_test_lifecycle.c30
3 files changed, 51 insertions, 0 deletions
diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo
index 97a9489c30..a0d500bfea 100644
--- a/src/lib/eo/efl_object.eo
+++ b/src/lib/eo/efl_object.eo
@@ -129,6 +129,17 @@ abstract Efl.Object ()
129 finalized: bool; [[$true if the object is invalidated, $false otherwise]] 129 finalized: bool; [[$true if the object is invalidated, $false otherwise]]
130 } 130 }
131 } 131 }
132 @property invalidating {
133 [[True if the object is about to be invalidated, and the invalidation of the children is already happening.
134
135 Note this is true before the invalidate call on the object.
136 ]]
137 get {
138 }
139 values {
140 invalidating: bool; [[$true if the object is invalidating, $false otherwise]]
141 }
142 }
132 provider_find @const { 143 provider_find @const {
133 [[Searches upwards in the object tree for a provider which knows the given class/interface. 144 [[Searches upwards in the object tree for a provider which knows the given class/interface.
134 145
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 5acc70bca2..b2de426e37 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -827,6 +827,16 @@ _efl_object_invalidated_get(const Eo *obj_id, Efl_Object_Data *pd)
827 return invalidate; 827 return invalidate;
828} 828}
829 829
830EOLIAN static Eina_Bool
831_efl_object_invalidating_get(const Eo *obj_id, Efl_Object_Data *pd EINA_UNUSED)
832{
833 Eina_Bool invalidating;
834 EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, EINA_TRUE);
835 invalidating = obj->is_invalidating;
836 EO_OBJ_DONE(obj_id);
837 return invalidating;
838}
839
830EOLIAN static Efl_Object * 840EOLIAN static Efl_Object *
831_efl_object_provider_find(const Eo *obj, Efl_Object_Data *pd, const Efl_Object *klass) 841_efl_object_provider_find(const Eo *obj, Efl_Object_Data *pd, const Efl_Object *klass)
832{ 842{
diff --git a/src/tests/eo/suite/eo_test_lifecycle.c b/src/tests/eo/suite/eo_test_lifecycle.c
index b0c67bca45..190a7366ca 100644
--- a/src/tests/eo/suite/eo_test_lifecycle.c
+++ b/src/tests/eo/suite/eo_test_lifecycle.c
@@ -162,6 +162,35 @@ EFL_START_TEST(eo_test_unref_noref)
162} 162}
163EFL_END_TEST 163EFL_END_TEST
164 164
165
166typedef struct {
167 Eo *par;
168 Eina_Bool called;
169} Invalidating_Test_Helper;
170
171static void
172_invalidate2(void *data, const Efl_Event *ev EINA_UNUSED)
173{
174 Invalidating_Test_Helper *iev = data;
175
176 iev->called = EINA_TRUE;
177 ck_assert_int_eq(efl_invalidating_get(iev->par), EINA_TRUE);
178 ck_assert_int_eq(efl_invalidated_get(iev->par), EINA_FALSE);
179}
180
181EFL_START_TEST(eo_test_invalidating_get)
182{
183 Eo *par = efl_add_ref(SIMPLE_CLASS, NULL);
184 Eo *obj = efl_add(SIMPLE_CLASS, par);
185 Invalidating_Test_Helper data = {par, EINA_FALSE};
186
187 efl_event_callback_add(obj, EFL_EVENT_INVALIDATE, _invalidate2, &data);
188
189 efl_unref(par);
190 ck_assert_int_eq(data.called, EINA_TRUE);
191}
192EFL_END_TEST
193
165void eo_test_lifecycle(TCase *tc) 194void eo_test_lifecycle(TCase *tc)
166{ 195{
167 tcase_add_test(tc, eo_test_base_del); 196 tcase_add_test(tc, eo_test_base_del);
@@ -169,4 +198,5 @@ void eo_test_lifecycle(TCase *tc)
169 tcase_add_test(tc, eo_test_shutdown_eventting); 198 tcase_add_test(tc, eo_test_shutdown_eventting);
170 tcase_add_test(tc, eo_test_del_in_noref); 199 tcase_add_test(tc, eo_test_del_in_noref);
171 tcase_add_test(tc, eo_test_unref_noref); 200 tcase_add_test(tc, eo_test_unref_noref);
201 tcase_add_test(tc, eo_test_invalidating_get);
172} 202}