summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:29:23 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:29:23 -0400
commite96d18b0462b77d051424d6ff510c5d5e3c3140b (patch)
treed8c9e2df7b5dfdfdee0d0aac741ac5cdf255dc1d
parent4192137ba9853c798e830acaa68c46f1afff0505 (diff)
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
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c11
-rw-r--r--src/tests/evas/evas_test_callbacks.c25
2 files changed, 34 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index 35ef78a..1f86f63 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -348,7 +348,7 @@ evas_event_callback_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
348} 348}
349 349
350static void 350static void
351_evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc, void *event_info) 351_evas_smart_callback_legacy_git_er_done(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc)
352{ 352{
353 if (efl_event_desc == EFL_GFX_ENTITY_EVENT_POSITION_CHANGED) 353 if (efl_event_desc == EFL_GFX_ENTITY_EVENT_POSITION_CHANGED)
354 evas_object_smart_callback_call(eo_obj, "move", NULL); 354 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
356 evas_object_smart_callback_call(eo_obj, "resize", NULL); 356 evas_object_smart_callback_call(eo_obj, "resize", NULL);
357 else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_STACKING_CHANGED) 357 else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_STACKING_CHANGED)
358 evas_object_smart_callback_call(eo_obj, "restack", NULL); 358 evas_object_smart_callback_call(eo_obj, "restack", NULL);
359}
360
361static void
362_evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc, void *event_info)
363{
359 /* this is inverted: the base call is the legacy compat and this is the new event */ 364 /* this is inverted: the base call is the legacy compat and this is the new event */
360 else if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE)) 365 if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE))
361 efl_event_callback_call(eo_obj, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, event_info); 366 efl_event_callback_call(eo_obj, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, event_info);
362 else if ((efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD) || (efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD)) 367 else if ((efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD) || (efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD))
363 efl_event_callback_call(eo_obj, EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD_STATE_CHANGED, event_info); 368 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
403 type == EVAS_CALLBACK_MULTI_UP) 408 type == EVAS_CALLBACK_MULTI_UP)
404 _efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info); 409 _efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info);
405 410
411 _evas_smart_callback_legacy_git_er_done(eo_obj, efl_event_desc);
412
406 if (!_evas_object_callback_has_by_type(obj, type)) 413 if (!_evas_object_callback_has_by_type(obj, type))
407 goto nothing_here; 414 goto nothing_here;
408 415
diff --git a/src/tests/evas/evas_test_callbacks.c b/src/tests/evas/evas_test_callbacks.c
index 0b61ca5..58da305 100644
--- a/src/tests/evas/evas_test_callbacks.c
+++ b/src/tests/evas/evas_test_callbacks.c
@@ -145,8 +145,33 @@ EFL_START_TEST(evas_event_callbacks_priority)
145} 145}
146EFL_END_TEST 146EFL_END_TEST
147 147
148static void
149_smart_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
150{
151 int *called = data;
152
153 (*called)++;
154}
155
156EFL_START_TEST(evas_event_callbacks_smart)
157{
158 int called = 0;
159 Eo *box;
160 START_CALLBACK_TEST();
161 box = evas_object_box_add(evas);
162 evas_object_smart_callback_add(box, "move", _smart_cb, &called);
163 evas_object_smart_callback_add(box, "resize", _smart_cb, &called);
164 evas_object_smart_callback_add(box, "restack", _smart_cb, &called);
165 evas_object_geometry_set(box, 1, 1, 10, 10);
166 evas_object_layer_set(box, 10);
167 ck_assert_int_eq(called, 3);
168 END_CALLBACK_TEST();
169}
170EFL_END_TEST
171
148void evas_test_callbacks(TCase *tc) 172void evas_test_callbacks(TCase *tc)
149{ 173{
150 tcase_add_test(tc, evas_object_event_callbacks_priority); 174 tcase_add_test(tc, evas_object_event_callbacks_priority);
151 tcase_add_test(tc, evas_event_callbacks_priority); 175 tcase_add_test(tc, evas_event_callbacks_priority);
176 tcase_add_test(tc, evas_event_callbacks_smart);
152} 177}