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
This commit is contained in:
Marcel Hollerbach 2018-08-20 13:15:56 -04:00 committed by Mike Blumenkrantz
parent 87332f2e3a
commit 365c0334ff
3 changed files with 51 additions and 0 deletions

View File

@ -129,6 +129,17 @@ abstract Efl.Object ()
finalized: bool; [[$true if the object is invalidated, $false otherwise]]
}
}
@property invalidating {
[[True if the object is about to be invalidated, and the invalidation of the children is already happening.
Note this is true before the invalidate call on the object.
]]
get {
}
values {
invalidating: bool; [[$true if the object is invalidating, $false otherwise]]
}
}
provider_find @const {
[[Searches upwards in the object tree for a provider which knows the given class/interface.

View File

@ -827,6 +827,16 @@ _efl_object_invalidated_get(const Eo *obj_id, Efl_Object_Data *pd)
return invalidate;
}
EOLIAN static Eina_Bool
_efl_object_invalidating_get(const Eo *obj_id, Efl_Object_Data *pd EINA_UNUSED)
{
Eina_Bool invalidating;
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, EINA_TRUE);
invalidating = obj->is_invalidating;
EO_OBJ_DONE(obj_id);
return invalidating;
}
EOLIAN static Efl_Object *
_efl_object_provider_find(const Eo *obj, Efl_Object_Data *pd, const Efl_Object *klass)
{

View File

@ -162,6 +162,35 @@ EFL_START_TEST(eo_test_unref_noref)
}
EFL_END_TEST
typedef struct {
Eo *par;
Eina_Bool called;
} Invalidating_Test_Helper;
static void
_invalidate2(void *data, const Efl_Event *ev EINA_UNUSED)
{
Invalidating_Test_Helper *iev = data;
iev->called = EINA_TRUE;
ck_assert_int_eq(efl_invalidating_get(iev->par), EINA_TRUE);
ck_assert_int_eq(efl_invalidated_get(iev->par), EINA_FALSE);
}
EFL_START_TEST(eo_test_invalidating_get)
{
Eo *par = efl_add_ref(SIMPLE_CLASS, NULL);
Eo *obj = efl_add(SIMPLE_CLASS, par);
Invalidating_Test_Helper data = {par, EINA_FALSE};
efl_event_callback_add(obj, EFL_EVENT_INVALIDATE, _invalidate2, &data);
efl_unref(par);
ck_assert_int_eq(data.called, EINA_TRUE);
}
EFL_END_TEST
void eo_test_lifecycle(TCase *tc)
{
tcase_add_test(tc, eo_test_base_del);
@ -169,4 +198,5 @@ void eo_test_lifecycle(TCase *tc)
tcase_add_test(tc, eo_test_shutdown_eventting);
tcase_add_test(tc, eo_test_del_in_noref);
tcase_add_test(tc, eo_test_unref_noref);
tcase_add_test(tc, eo_test_invalidating_get);
}