This example shows when Ecore_Idler, Ecore_Idle_Enterer and Ecore_Idle_Exiter are called. See the explanation here.
#include <Ecore.h>
#include <unistd.h>
struct context
{
int count;
};
static int _event_type = 0;
_enterer_cb(void *data)
{
printf("IDLE ENTERER: Ecore entering in idle state.\n");
}
_exiter_cb(void *data)
{
printf("IDLE EXITER: Ecore exiting idle state.\n");
}
_idler_cb(void *data)
{
struct context *ctxt = data;
printf("IDLER: executing idler callback while in idle state.\n");
ctxt->count++;
if ((ctxt->count % 10) == 0)
}
_event_handler_cb(void *data, int type, void *event)
{
struct context *ctxt = data;
printf("EVENT: processing callback for the event received.\n");
if (ctxt->count > 100)
{
eo_unref(ctxt->idler);
ctxt->enterer = NULL;
ctxt->exiter = NULL;
ctxt->idler = NULL;
if (ctxt->timer)
{
ctxt->timer = NULL;
}
}
}
_timer_cb(void *data)
{
struct context *ctxt = data;
printf("TIMER: timer callback called.\n");
if (ctxt->timer)
ctxt->timer = NULL;
}
int
main(int argc, char **argv)
{
struct context ctxt = {0};
{
printf("ERROR: Cannot init Ecore!\n");
return -1;
}
_event_handler_cb,
&ctxt);
return 0;
}