forked from enlightenment/efl
evas/callbacks: emit hardcoded legacy smart callbacks always
Summary: these are not strictly related to the event callback types and should not have their emission tied to the corresponding event also add unit test to verify all of these @fix Reviewers: cedric Reviewed By: cedric Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10353
This commit is contained in:
parent
4192137ba9
commit
e96d18b046
|
@ -348,7 +348,7 @@ evas_event_callback_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc, void *event_info)
|
_evas_smart_callback_legacy_git_er_done(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc)
|
||||||
{
|
{
|
||||||
if (efl_event_desc == EFL_GFX_ENTITY_EVENT_POSITION_CHANGED)
|
if (efl_event_desc == EFL_GFX_ENTITY_EVENT_POSITION_CHANGED)
|
||||||
evas_object_smart_callback_call(eo_obj, "move", NULL);
|
evas_object_smart_callback_call(eo_obj, "move", NULL);
|
||||||
|
@ -356,8 +356,13 @@ _evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_E
|
||||||
evas_object_smart_callback_call(eo_obj, "resize", NULL);
|
evas_object_smart_callback_call(eo_obj, "resize", NULL);
|
||||||
else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_STACKING_CHANGED)
|
else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_STACKING_CHANGED)
|
||||||
evas_object_smart_callback_call(eo_obj, "restack", NULL);
|
evas_object_smart_callback_call(eo_obj, "restack", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc, void *event_info)
|
||||||
|
{
|
||||||
/* this is inverted: the base call is the legacy compat and this is the new event */
|
/* this is inverted: the base call is the legacy compat and this is the new event */
|
||||||
else if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE))
|
if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE))
|
||||||
efl_event_callback_call(eo_obj, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, event_info);
|
efl_event_callback_call(eo_obj, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, event_info);
|
||||||
else if ((efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD) || (efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD))
|
else if ((efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD) || (efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD))
|
||||||
efl_event_callback_call(eo_obj, EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD_STATE_CHANGED, event_info);
|
efl_event_callback_call(eo_obj, EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD_STATE_CHANGED, event_info);
|
||||||
|
@ -403,6 +408,8 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
|
||||||
type == EVAS_CALLBACK_MULTI_UP)
|
type == EVAS_CALLBACK_MULTI_UP)
|
||||||
_efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info);
|
_efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info);
|
||||||
|
|
||||||
|
_evas_smart_callback_legacy_git_er_done(eo_obj, efl_event_desc);
|
||||||
|
|
||||||
if (!_evas_object_callback_has_by_type(obj, type))
|
if (!_evas_object_callback_has_by_type(obj, type))
|
||||||
goto nothing_here;
|
goto nothing_here;
|
||||||
|
|
||||||
|
|
|
@ -145,8 +145,33 @@ EFL_START_TEST(evas_event_callbacks_priority)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
int *called = data;
|
||||||
|
|
||||||
|
(*called)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFL_START_TEST(evas_event_callbacks_smart)
|
||||||
|
{
|
||||||
|
int called = 0;
|
||||||
|
Eo *box;
|
||||||
|
START_CALLBACK_TEST();
|
||||||
|
box = evas_object_box_add(evas);
|
||||||
|
evas_object_smart_callback_add(box, "move", _smart_cb, &called);
|
||||||
|
evas_object_smart_callback_add(box, "resize", _smart_cb, &called);
|
||||||
|
evas_object_smart_callback_add(box, "restack", _smart_cb, &called);
|
||||||
|
evas_object_geometry_set(box, 1, 1, 10, 10);
|
||||||
|
evas_object_layer_set(box, 10);
|
||||||
|
ck_assert_int_eq(called, 3);
|
||||||
|
END_CALLBACK_TEST();
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
void evas_test_callbacks(TCase *tc)
|
void evas_test_callbacks(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, evas_object_event_callbacks_priority);
|
tcase_add_test(tc, evas_object_event_callbacks_priority);
|
||||||
tcase_add_test(tc, evas_event_callbacks_priority);
|
tcase_add_test(tc, evas_event_callbacks_priority);
|
||||||
|
tcase_add_test(tc, evas_event_callbacks_smart);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue