ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/examples.git/commit/?id=4f1249466727efbbe77d08932073bdd0370e57ef
commit 4f1249466727efbbe77d08932073bdd0370e57ef Author: Andy Williams <[email protected]> Date: Wed Nov 22 14:39:45 2017 +0000 core: Tidy up some core example variables --- reference/c/core/src/core_idler.c | 17 +++++++++-------- reference/c/core/src/core_poll.c | 20 ++++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/reference/c/core/src/core_idler.c b/reference/c/core/src/core_idler.c index 3256bac..48f07a2 100644 --- a/reference/c/core/src/core_idler.c +++ b/reference/c/core/src/core_idler.c @@ -15,8 +15,6 @@ * We initiate a timer to exit the idle state and then exit the application */ -Efl_Loop_Timer *_timer; - // the idler enter callback static void _enter_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) @@ -40,26 +38,29 @@ _idler_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) // Our timer callback ticks at the specified interval to interrupt the idle state static void -_timer_cb(void *data, const Efl_Event *event) +_timer_cb(void *data EINA_UNUSED, const Efl_Event *event) { + Efl_Loop_Timer *timer; + + timer = event->object; printf("TIMER: timer callback called, exiting.\n"); - efl_del(_timer); + efl_del(timer); efl_exit(0); } EAPI_MAIN void efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) { - Eo *loop = ev->object; + Efl_Loop *loop = ev->object; efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE, _idler_cb, NULL); efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE_ENTER, _enter_cb, NULL); efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE_EXIT, _exit_cb, NULL); - _timer = efl_add(EFL_LOOP_TIMER_CLASS, loop, - efl_loop_timer_interval_set(efl_added, 0.0005)); - efl_event_callback_add(_timer, EFL_LOOP_TIMER_EVENT_TICK, _timer_cb, NULL); + efl_add(EFL_LOOP_TIMER_CLASS, loop, + efl_loop_timer_interval_set(efl_added, 0.0005), + efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, _timer_cb, NULL)); } EFL_MAIN() diff --git a/reference/c/core/src/core_poll.c b/reference/c/core/src/core_poll.c index 84f095c..38de6a4 100644 --- a/reference/c/core/src/core_poll.c +++ b/reference/c/core/src/core_poll.c @@ -14,8 +14,6 @@ * Depending on your system this may not include any LOW frequency polls. */ -Efl_Loop_Timer *_timer; - // the poll callback for low frequency events static void _poll_low_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) @@ -40,27 +38,33 @@ _poll_high_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) // Our timer callback ticks at the specified interval to interrupt the polling static void -_timer_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) +_timer_cb(void *data EINA_UNUSED, const Efl_Event *event) { + Efl_Loop_Timer *timer; + + timer = event->object; + printf("\nTIMER: timer callback called, exiting.\n"); - efl_del(_timer); + efl_del(timer); efl_exit(0); } EAPI_MAIN void efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) { - Eo *loop = ev->object; + Efl_Loop *loop = ev->object; + // don't buffer output this time as we're looking for immediate output setbuf(stdout, NULL); + efl_event_callback_add(loop, EFL_LOOP_EVENT_POLL_LOW, _poll_low_cb, NULL); efl_event_callback_add(loop, EFL_LOOP_EVENT_POLL_MEDIUM, _poll_med_cb, NULL); efl_event_callback_add(loop, EFL_LOOP_EVENT_POLL_HIGH, _poll_high_cb, NULL); - _timer = efl_add(EFL_LOOP_TIMER_CLASS, loop, - efl_loop_timer_interval_set(efl_added, 30)); - efl_event_callback_add(_timer, EFL_LOOP_TIMER_EVENT_TICK, _timer_cb, NULL); + efl_add(EFL_LOOP_TIMER_CLASS, loop, + efl_loop_timer_interval_set(efl_added, 30), + efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, _timer_cb, NULL)); } EFL_MAIN() --
