forked from enlightenment/efl
* ecore: Remove user of Ecore_List2 from ecore events.
SVN revision: 41070
This commit is contained in:
parent
3ff7c2300d
commit
8e392a0742
|
@ -46,7 +46,7 @@ ecore_animator_add(int (*func) (void *data), const void *data)
|
|||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR);
|
||||
animator->func = func;
|
||||
animator->data = (void *)data;
|
||||
animators = _ecore_list2_append(animators, animator);
|
||||
animators = (Ecore_Animator *) eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
|
||||
if (!timer)
|
||||
timer = ecore_timer_add(animators_frametime, _ecore_animator, NULL);
|
||||
return animator;
|
||||
|
@ -125,7 +125,7 @@ _ecore_animator_shutdown(void)
|
|||
Ecore_Animator *animator;
|
||||
|
||||
animator = animators;
|
||||
animators = _ecore_list2_remove(animators, animator);
|
||||
animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
|
||||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
|
||||
free(animator);
|
||||
}
|
||||
|
@ -133,15 +133,11 @@ _ecore_animator_shutdown(void)
|
|||
|
||||
static int
|
||||
_ecore_animator(void *data __UNUSED__)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
|
||||
for (l = (Ecore_List2 *)animators; l;)
|
||||
{
|
||||
Ecore_Animator *animator;
|
||||
|
||||
animator = (Ecore_Animator *)l;
|
||||
l = l->next;
|
||||
EINA_INLIST_FOREACH(animators, animator)
|
||||
{
|
||||
if (!animator->delete_me)
|
||||
{
|
||||
if (!animator->func(animator->data))
|
||||
|
@ -153,15 +149,14 @@ _ecore_animator(void *data __UNUSED__)
|
|||
}
|
||||
if (animators_delete_me)
|
||||
{
|
||||
for (l = (Ecore_List2 *)animators; l;)
|
||||
Ecore_Animator *l;
|
||||
for(l = animators; l;)
|
||||
{
|
||||
Ecore_Animator *animator;
|
||||
|
||||
animator = (Ecore_Animator *)l;
|
||||
l = l->next;
|
||||
animator = l;
|
||||
l = (Ecore_Animator *) EINA_INLIST_GET(l)->next;
|
||||
if (animator->delete_me)
|
||||
{
|
||||
animators = _ecore_list2_remove(animators, animator);
|
||||
animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
|
||||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
|
||||
free(animator);
|
||||
animators_delete_me--;
|
||||
|
|
|
@ -17,7 +17,7 @@ static Ecore_Event *events = NULL;
|
|||
static Ecore_Event_Handler **event_handlers = NULL;
|
||||
static int event_handlers_num = 0;
|
||||
static int event_handlers_alloc_num = 0;
|
||||
static Ecore_List2_Data *event_handlers_delete_list = NULL;
|
||||
static Eina_List *event_handlers_delete_list = NULL;
|
||||
|
||||
static Ecore_Event_Filter *event_filters = NULL;
|
||||
static int event_filters_delete_me = 0;
|
||||
|
@ -87,7 +87,7 @@ ecore_event_handler_add(int type, int (*func) (void *data, int type, void *event
|
|||
event_handlers[i] = NULL;
|
||||
}
|
||||
}
|
||||
event_handlers[type] = _ecore_list2_append(event_handlers[type], eh);
|
||||
event_handlers[type] = (Ecore_Event_Handler *) eina_inlist_append(EINA_INLIST_GET(event_handlers[type]), EINA_INLIST_GET(eh));
|
||||
return eh;
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,6 @@ ecore_event_handler_add(int type, int (*func) (void *data, int type, void *event
|
|||
EAPI void *
|
||||
ecore_event_handler_del(Ecore_Event_Handler *event_handler)
|
||||
{
|
||||
Ecore_List2_Data *node;
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER,
|
||||
|
@ -113,9 +111,7 @@ ecore_event_handler_del(Ecore_Event_Handler *event_handler)
|
|||
return NULL;
|
||||
}
|
||||
event_handler->delete_me = 1;
|
||||
node = calloc(1, sizeof(Ecore_List2_Data));
|
||||
node->data = event_handler;
|
||||
event_handlers_delete_list = _ecore_list2_append(event_handlers_delete_list, node);
|
||||
event_handlers_delete_list = eina_list_append(event_handlers_delete_list, event_handler);
|
||||
return event_handler->data;
|
||||
}
|
||||
|
||||
|
@ -226,7 +222,7 @@ ecore_event_filter_add(void * (*func_start) (void *data), int (*func_filter) (vo
|
|||
ef->func_filter = func_filter;
|
||||
ef->func_end = func_end;
|
||||
ef->data = (void *)data;
|
||||
event_filters = _ecore_list2_append(event_filters, ef);
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_append(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
return ef;
|
||||
}
|
||||
|
||||
|
@ -296,38 +292,28 @@ void
|
|||
_ecore_event_shutdown(void)
|
||||
{
|
||||
int i;
|
||||
Ecore_Event_Handler *eh;
|
||||
Ecore_Event_Filter *ef;
|
||||
|
||||
while (events) _ecore_event_del(events);
|
||||
for (i = 0; i < event_handlers_num; i++)
|
||||
{
|
||||
while (event_handlers[i])
|
||||
{
|
||||
Ecore_Event_Handler *eh;
|
||||
|
||||
eh = event_handlers[i];
|
||||
event_handlers[i] = _ecore_list2_remove(event_handlers[i], eh);
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
event_handlers[i] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
|
||||
ECORE_MAGIC_SET(event_handlers[i], ECORE_MAGIC_NONE);
|
||||
free(event_handlers[i]);
|
||||
}
|
||||
}
|
||||
EINA_LIST_FREE(event_handlers_delete_list, eh)
|
||||
free(eh);
|
||||
}
|
||||
}
|
||||
while (event_handlers_delete_list)
|
||||
{
|
||||
Ecore_List2_Data *ehd;
|
||||
|
||||
ehd = event_handlers_delete_list;
|
||||
event_handlers_delete_list = _ecore_list2_remove(event_handlers_delete_list, ehd);
|
||||
free(ehd);
|
||||
}
|
||||
if (event_handlers) free(event_handlers);
|
||||
event_handlers = NULL;
|
||||
event_handlers_num = 0;
|
||||
event_handlers_alloc_num = 0;
|
||||
while (event_filters)
|
||||
while ((ef = event_filters))
|
||||
{
|
||||
Ecore_Event_Filter *ef;
|
||||
|
||||
ef = event_filters;
|
||||
event_filters = _ecore_list2_remove(event_filters, ef);
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
}
|
||||
|
@ -353,7 +339,7 @@ _ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), v
|
|||
e->event = ev;
|
||||
e->func_free = func_free;
|
||||
e->data = data;
|
||||
events = _ecore_list2_append(events, e);
|
||||
events = (Ecore_Event *) eina_inlist_append(EINA_INLIST_GET(events), EINA_INLIST_GET(e));
|
||||
events_num++;
|
||||
return e;
|
||||
}
|
||||
|
@ -365,7 +351,7 @@ _ecore_event_del(Ecore_Event *event)
|
|||
|
||||
data = event->data;
|
||||
if (event->func_free) event->func_free(event->data, event->event);
|
||||
events = _ecore_list2_remove(events, event);
|
||||
events = (Ecore_Event *) eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event));
|
||||
ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE);
|
||||
free(event);
|
||||
events_num--;
|
||||
|
@ -375,23 +361,19 @@ _ecore_event_del(Ecore_Event *event)
|
|||
void
|
||||
_ecore_event_call(void)
|
||||
{
|
||||
Ecore_List2 *l, *ll;
|
||||
Ecore_Event *e;
|
||||
Ecore_Event_Filter *ef;
|
||||
Ecore_Event_Handler *eh;
|
||||
Ecore_List2_Data *ehd;
|
||||
int handle_count;
|
||||
|
||||
for (l = (Ecore_List2 *)event_filters; l; l = l->next)
|
||||
EINA_INLIST_FOREACH(event_filters, ef)
|
||||
{
|
||||
ef = (Ecore_Event_Filter *)l;
|
||||
if (!ef->delete_me)
|
||||
{
|
||||
if (ef->func_start)
|
||||
ef->loop_data = ef->func_start(ef->data);
|
||||
for (ll = (Ecore_List2 *)events; ll; ll = ll->next)
|
||||
EINA_INLIST_FOREACH(events, e)
|
||||
{
|
||||
e = (Ecore_Event *)ll;
|
||||
if (!ef->func_filter(ef->loop_data, ef->data,
|
||||
e->type, e->event))
|
||||
{
|
||||
|
@ -405,13 +387,14 @@ _ecore_event_call(void)
|
|||
}
|
||||
if (event_filters_delete_me)
|
||||
{
|
||||
for (l = (Ecore_List2 *)event_filters; l;)
|
||||
Ecore_Event_Filter *l;
|
||||
EINA_INLIST_FOREACH(event_filters, l)
|
||||
{
|
||||
ef = (Ecore_Event_Filter *)l;
|
||||
l = l->next;
|
||||
ef = l;
|
||||
l = (Ecore_Event_Filter *) EINA_INLIST_GET(l)->next;
|
||||
if (ef->delete_me)
|
||||
{
|
||||
event_filters = _ecore_list2_remove(event_filters, ef);
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
}
|
||||
|
@ -419,9 +402,8 @@ _ecore_event_call(void)
|
|||
event_filters_delete_me = 0;
|
||||
}
|
||||
// printf("EVENT BATCH...\n");
|
||||
for (l = (Ecore_List2 *)events; l; l = l->next)
|
||||
EINA_INLIST_FOREACH(events, e)
|
||||
{
|
||||
e = (Ecore_Event *)l;
|
||||
if (!e->delete_me)
|
||||
{
|
||||
handle_count = 0;
|
||||
|
@ -430,9 +412,8 @@ _ecore_event_call(void)
|
|||
// printf("HANDLE ev type %i, %p\n", e->type, e->event);
|
||||
if ((e->type >= 0) && (e->type < event_handlers_num))
|
||||
{
|
||||
for (ll = (Ecore_List2 *)event_handlers[e->type]; ll; ll = ll->next)
|
||||
EINA_INLIST_FOREACH(event_handlers[e->type], eh)
|
||||
{
|
||||
eh = (Ecore_Event_Handler *)ll;
|
||||
if (!eh->delete_me)
|
||||
{
|
||||
handle_count++;
|
||||
|
@ -451,16 +432,13 @@ _ecore_event_call(void)
|
|||
ecore_raw_event_type = ECORE_EVENT_NONE;
|
||||
ecore_raw_event_event = NULL;
|
||||
|
||||
while (events) _ecore_event_del(events);
|
||||
while (event_handlers_delete_list)
|
||||
while (events) _ecore_event_del((Ecore_Event *) events);
|
||||
EINA_LIST_FREE(event_handlers_delete_list, eh)
|
||||
{
|
||||
ehd = event_handlers_delete_list;
|
||||
eh = ehd->data;
|
||||
event_handlers[eh->type] = _ecore_list2_remove(event_handlers[eh->type], eh);
|
||||
event_handlers_delete_list = _ecore_list2_remove(event_handlers_delete_list, ehd);
|
||||
event_handlers[eh->type] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
|
||||
event_handlers_delete_list = eina_list_remove(event_handlers_delete_list, eh);
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
free(eh);
|
||||
free(ehd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
}
|
||||
}
|
||||
|
||||
exes = _ecore_list2_append(exes, exe);
|
||||
exes = (Ecore_Exe *) eina_inlist_append(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
|
||||
n = 0;
|
||||
}
|
||||
else
|
||||
|
@ -959,7 +959,7 @@ ecore_exe_free(Ecore_Exe * exe)
|
|||
IF_FREE(exe->error_data_buf);
|
||||
IF_FREE(exe->cmd);
|
||||
|
||||
exes = _ecore_list2_remove(exes, exe);
|
||||
exes = (Ecore_Exe *) eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
|
||||
ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE);
|
||||
IF_FREE(exe->tag);
|
||||
free(exe);
|
||||
|
@ -1301,14 +1301,10 @@ _ecore_exe_shutdown(void)
|
|||
|
||||
Ecore_Exe *
|
||||
_ecore_exe_find(pid_t pid)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
|
||||
for (l = (Ecore_List2 *) exes; l; l = l->next)
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
|
||||
exe = (Ecore_Exe *) l;
|
||||
EINA_INLIST_FOREACH(exes, exe)
|
||||
{
|
||||
if (exe->pid == pid)
|
||||
return exe;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ ecore_idle_enterer_add(int (*func) (void *data), const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idle_enterers = _ecore_list2_append(idle_enterers, ie);
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
return ie;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ ecore_idle_enterer_before_add(int (*func) (void *data), const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idle_enterers = _ecore_list2_prepend(idle_enterers, ie);
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
return ie;
|
||||
}
|
||||
|
||||
|
@ -83,13 +83,11 @@ ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
|
|||
|
||||
void
|
||||
_ecore_idle_enterer_shutdown(void)
|
||||
{
|
||||
while (idle_enterers)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie;
|
||||
|
||||
ie = idle_enterers;
|
||||
idle_enterers = _ecore_list2_remove(idle_enterers, ie);
|
||||
while ((ie = idle_enterers))
|
||||
{
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -98,34 +96,26 @@ _ecore_idle_enterer_shutdown(void)
|
|||
|
||||
void
|
||||
_ecore_idle_enterer_call(void)
|
||||
{
|
||||
Ecore_List2 *l, *last;
|
||||
|
||||
last = idle_enterers ? ((Ecore_List2 *)idle_enterers)->last : NULL;
|
||||
|
||||
for (l = (Ecore_List2 *)idle_enterers; l; l = l->next)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie;
|
||||
|
||||
ie = (Ecore_Idle_Enterer *)l;
|
||||
EINA_INLIST_FOREACH(idle_enterers, ie)
|
||||
{
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
if (!ie->func(ie->data)) ecore_idle_enterer_del(ie);
|
||||
}
|
||||
|
||||
if (l == last) break;
|
||||
}
|
||||
if (idle_enterers_delete_me)
|
||||
{
|
||||
for (l = (Ecore_List2 *)idle_enterers; l;)
|
||||
Ecore_Idle_Enterer *l;
|
||||
for(l = idle_enterers; l;)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie;
|
||||
|
||||
ie = (Ecore_Idle_Enterer *)l;
|
||||
l = l->next;
|
||||
ie = l;
|
||||
l = (Ecore_Idle_Enterer *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
idle_enterers = _ecore_list2_remove(idle_enterers, ie);
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ ecore_idle_exiter_add(int (*func) (void *data), const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_EXITER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idle_exiters = _ecore_list2_append(idle_exiters, ie);
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
return ie;
|
||||
}
|
||||
|
||||
|
@ -59,13 +59,11 @@ ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
|
|||
|
||||
void
|
||||
_ecore_idle_exiter_shutdown(void)
|
||||
{
|
||||
while (idle_exiters)
|
||||
{
|
||||
Ecore_Idle_Exiter *ie;
|
||||
|
||||
ie = idle_exiters;
|
||||
idle_exiters = _ecore_list2_remove(idle_exiters, ie);
|
||||
while ((ie = idle_exiters))
|
||||
{
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -74,34 +72,27 @@ _ecore_idle_exiter_shutdown(void)
|
|||
|
||||
void
|
||||
_ecore_idle_exiter_call(void)
|
||||
{
|
||||
Ecore_List2 *l, *last;
|
||||
|
||||
last = idle_exiters ? ((Ecore_List2 *)idle_exiters)->last : NULL;
|
||||
|
||||
for (l = (Ecore_List2 *)idle_exiters; l; l = l->next)
|
||||
{
|
||||
Ecore_Idle_Exiter *ie;
|
||||
|
||||
ie = (Ecore_Idle_Exiter *)l;
|
||||
EINA_INLIST_FOREACH(idle_exiters, ie)
|
||||
{
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
if (!ie->func(ie->data)) ecore_idle_exiter_del(ie);
|
||||
}
|
||||
|
||||
if (l == last) break;
|
||||
}
|
||||
if (idle_exiters_delete_me)
|
||||
{
|
||||
for (l = (Ecore_List2 *)idle_exiters; l;)
|
||||
Ecore_Idle_Exiter *l;
|
||||
for (l = idle_exiters; l;)
|
||||
{
|
||||
Ecore_Idle_Exiter *ie;
|
||||
ie = l;
|
||||
|
||||
ie = (Ecore_Idle_Exiter *)l;
|
||||
l = l->next;
|
||||
l = (Ecore_Idle_Exiter *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
idle_exiters = _ecore_list2_remove(idle_exiters, ie);
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ ecore_idler_add(int (*func) (void *data), const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idlers = _ecore_list2_append(idlers, ie);
|
||||
idlers = (Ecore_Idler *) eina_inlist_append(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
return ie;
|
||||
}
|
||||
|
||||
|
@ -67,13 +67,11 @@ ecore_idler_del(Ecore_Idler *idler)
|
|||
|
||||
void
|
||||
_ecore_idler_shutdown(void)
|
||||
{
|
||||
while (idlers)
|
||||
{
|
||||
Ecore_Idler *ie;
|
||||
|
||||
ie = idlers;
|
||||
idlers = _ecore_list2_remove(idlers, ie);
|
||||
while ((ie = idlers))
|
||||
{
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -82,34 +80,26 @@ _ecore_idler_shutdown(void)
|
|||
|
||||
int
|
||||
_ecore_idler_call(void)
|
||||
{
|
||||
Ecore_List2 *l, *last;
|
||||
|
||||
last = idlers ? ((Ecore_List2 *)idlers)->last : NULL;
|
||||
|
||||
for (l = (Ecore_List2 *)idlers; l; l = l->next)
|
||||
{
|
||||
Ecore_Idler *ie;
|
||||
|
||||
ie = (Ecore_Idler *)l;
|
||||
EINA_INLIST_FOREACH(idlers, ie)
|
||||
{
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
if (!ie->func(ie->data)) ecore_idler_del(ie);
|
||||
}
|
||||
|
||||
if (l == last) break;
|
||||
}
|
||||
if (idlers_delete_me)
|
||||
{
|
||||
for (l = (Ecore_List2 *)idlers; l;)
|
||||
Ecore_Idler *l;
|
||||
for (l = idlers; l;)
|
||||
{
|
||||
Ecore_Idler *ie;
|
||||
|
||||
ie = (Ecore_Idler *)l;
|
||||
l = l->next;
|
||||
ie = l;
|
||||
l = (Ecore_Idler *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
idlers = _ecore_list2_remove(idlers, ie);
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
|
|
@ -98,8 +98,7 @@ static int
|
|||
_ecore_poller_cb_timer(void *data __UNUSED__)
|
||||
{
|
||||
int i;
|
||||
Ecore_List2 *l;
|
||||
Ecore_Poller *poller;
|
||||
Ecore_Poller *poller, *l;
|
||||
int changes = 0;
|
||||
|
||||
at_tick++;
|
||||
|
@ -123,9 +122,8 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
|
|||
* tick interval, so run all pollers hooked to that counter */
|
||||
if (poller_counters[i] == 0)
|
||||
{
|
||||
for (l = (Ecore_List2 *)pollers[i]; l; l = l->next)
|
||||
EINA_INLIST_FOREACH(pollers[i], poller)
|
||||
{
|
||||
poller = (Ecore_Poller *)l;
|
||||
if (!poller->delete_me)
|
||||
{
|
||||
if (!poller->func(poller->data))
|
||||
|
@ -148,13 +146,13 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
|
|||
/* FIXME: walk all pollers and remove deleted ones */
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
for (l = (Ecore_List2 *)pollers[i]; l;)
|
||||
for (l = pollers[i]; l;)
|
||||
{
|
||||
poller = (Ecore_Poller *)l;
|
||||
l = l->next;
|
||||
poller = l;
|
||||
l = (Ecore_Poller *) EINA_INLIST_GET(l)->next;
|
||||
if (poller->delete_me)
|
||||
{
|
||||
pollers[poller->ibit] = _ecore_list2_remove(pollers[poller->ibit], poller);
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller));
|
||||
free(poller);
|
||||
poller_delete_count--;
|
||||
changes++;
|
||||
|
@ -297,7 +295,7 @@ ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, int (*func) (v
|
|||
poller->ibit = ibit;
|
||||
poller->func = func;
|
||||
poller->data = (void *)data;
|
||||
pollers[poller->ibit] = _ecore_list2_prepend(pollers[poller->ibit], poller);
|
||||
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
if (poller_walking)
|
||||
just_added_poller++;
|
||||
else
|
||||
|
@ -337,7 +335,7 @@ ecore_poller_del(Ecore_Poller *poller)
|
|||
}
|
||||
/* not in loop so safe - delete immediately */
|
||||
data = poller->data;
|
||||
pollers[poller->ibit] = _ecore_list2_remove(pollers[poller->ibit], poller);
|
||||
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
free(poller);
|
||||
_ecore_poller_next_tick_eval();
|
||||
return data;
|
||||
|
@ -347,16 +345,13 @@ void
|
|||
_ecore_poller_shutdown(void)
|
||||
{
|
||||
int i;
|
||||
Ecore_List2 *l;
|
||||
Ecore_Poller *poller;
|
||||
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
for (l = (Ecore_List2 *)pollers[i]; l;)
|
||||
while ((poller = pollers[i]))
|
||||
{
|
||||
poller = (Ecore_Poller *)l;
|
||||
l = l->next;
|
||||
pollers[poller->ibit] = _ecore_list2_remove(pollers[poller->ibit], poller);
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i]));
|
||||
free(poller);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ typedef struct _Ecore_Poller Ecore_Poller;
|
|||
#ifndef _WIN32
|
||||
struct _Ecore_Exe
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
pid_t pid;
|
||||
void *data;
|
||||
|
@ -276,7 +276,7 @@ struct _Ecore_Exe
|
|||
|
||||
struct _Ecore_Timer
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
double in;
|
||||
double at;
|
||||
|
@ -290,7 +290,7 @@ struct _Ecore_Timer
|
|||
|
||||
struct _Ecore_Idler
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
int delete_me : 1;
|
||||
int (*func) (void *data);
|
||||
|
@ -299,7 +299,7 @@ struct _Ecore_Idler
|
|||
|
||||
struct _Ecore_Idle_Enterer
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
int delete_me : 1;
|
||||
int (*func) (void *data);
|
||||
|
@ -308,7 +308,7 @@ struct _Ecore_Idle_Enterer
|
|||
|
||||
struct _Ecore_Idle_Exiter
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
int delete_me : 1;
|
||||
int (*func) (void *data);
|
||||
|
@ -335,7 +335,7 @@ struct _Ecore_Fd_Handler
|
|||
|
||||
struct _Ecore_Event_Handler
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
int type;
|
||||
int delete_me : 1;
|
||||
|
@ -345,7 +345,7 @@ struct _Ecore_Event_Handler
|
|||
|
||||
struct _Ecore_Event_Filter
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
int delete_me : 1;
|
||||
void * (*func_start) (void *data);
|
||||
|
@ -357,7 +357,7 @@ struct _Ecore_Event_Filter
|
|||
|
||||
struct _Ecore_Event
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
int type;
|
||||
void *event;
|
||||
|
@ -368,7 +368,7 @@ struct _Ecore_Event
|
|||
|
||||
struct _Ecore_Animator
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
unsigned char delete_me : 1;
|
||||
int (*func) (void *data);
|
||||
|
@ -377,7 +377,7 @@ struct _Ecore_Animator
|
|||
|
||||
struct _Ecore_Poller
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
EINA_INLIST;
|
||||
ECORE_MAGIC;
|
||||
int ibit;
|
||||
unsigned char delete_me : 1;
|
||||
|
|
|
@ -227,7 +227,7 @@ ecore_timer_delay(Ecore_Timer *timer, double add)
|
|||
}
|
||||
else
|
||||
{
|
||||
timers = _ecore_list2_remove(timers, timer);
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
_ecore_timer_set(timer, timer->at + add, timer->in, timer->func, timer->data);
|
||||
}
|
||||
}
|
||||
|
@ -277,8 +277,8 @@ ecore_timer_freeze(Ecore_Timer *timer)
|
|||
if (timer->frozen)
|
||||
return ;
|
||||
|
||||
timers = _ecore_list2_remove(timers, timer);
|
||||
suspended = _ecore_list2_prepend(suspended, timer);
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
suspended = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
|
||||
now = ecore_time_get();
|
||||
|
||||
|
@ -303,7 +303,7 @@ ecore_timer_thaw(Ecore_Timer *timer)
|
|||
if (!timer->frozen)
|
||||
return ;
|
||||
|
||||
suspended = _ecore_list2_remove(suspended, timer);
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
now = ecore_time_get();
|
||||
|
||||
_ecore_timer_set(timer, timer->pending + now, timer->in, timer->func, timer->data);
|
||||
|
@ -311,23 +311,19 @@ ecore_timer_thaw(Ecore_Timer *timer)
|
|||
|
||||
void
|
||||
_ecore_timer_shutdown(void)
|
||||
{
|
||||
while (timers)
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
|
||||
timer = timers;
|
||||
timers = _ecore_list2_remove(timers, timer);
|
||||
while ((timer = timers))
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
}
|
||||
|
||||
while (suspended)
|
||||
while ((timer = suspended))
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
|
||||
timer = suspended;
|
||||
suspended = _ecore_list2_remove(suspended, timer);
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(suspended));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
}
|
||||
|
@ -336,33 +332,31 @@ _ecore_timer_shutdown(void)
|
|||
void
|
||||
_ecore_timer_cleanup(void)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
Ecore_Timer *l;
|
||||
|
||||
if (!timers_delete_me) return;
|
||||
for (l = (Ecore_List2 *)timers; l;)
|
||||
for (l = timers; l;)
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
Ecore_Timer *timer = l;
|
||||
|
||||
timer = (Ecore_Timer *)l;
|
||||
l = l->next;
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
timers = _ecore_list2_remove(timers, timer);
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
if (timers_delete_me == 0) return;
|
||||
}
|
||||
}
|
||||
for (l = (Ecore_List2 *)suspended; l;)
|
||||
for (l = suspended; l;)
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
Ecore_Timer *timer = l;
|
||||
|
||||
timer = (Ecore_Timer *)l;
|
||||
l = l->next;
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
suspended = _ecore_list2_remove(suspended, timer);
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
|
@ -375,26 +369,21 @@ _ecore_timer_cleanup(void)
|
|||
void
|
||||
_ecore_timer_enable_new(void)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
Ecore_Timer *timer;
|
||||
|
||||
if (!timers_added) return;
|
||||
timers_added = 0;
|
||||
for (l = (Ecore_List2 *)timers; l; l = l->next)
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
|
||||
timer = (Ecore_Timer *)l;
|
||||
EINA_INLIST_FOREACH(timers, timer)
|
||||
timer->just_added = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline Ecore_Timer *
|
||||
_ecore_timer_first_get(void)
|
||||
{
|
||||
Ecore_Timer *timer = (Ecore_Timer *)timers;
|
||||
Ecore_Timer *timer = timers;
|
||||
|
||||
while ((timer) && ((timer->delete_me) || (timer->just_added)))
|
||||
timer = (Ecore_Timer *)((Ecore_List2 *)timer)->next;
|
||||
timer = (Ecore_Timer *) EINA_INLIST_GET(timer)->next;
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
@ -402,11 +391,11 @@ _ecore_timer_first_get(void)
|
|||
static inline Ecore_Timer *
|
||||
_ecore_timer_after_get(Ecore_Timer *base)
|
||||
{
|
||||
Ecore_Timer *timer = (Ecore_Timer *)((Ecore_List2 *)base)->next;
|
||||
Ecore_Timer *timer = (Ecore_Timer *) EINA_INLIST_GET(base)->next;
|
||||
double maxtime = base->at + precision;
|
||||
|
||||
while ((timer) && ((timer->delete_me) || (timer->just_added)) && (timer->at <= maxtime))
|
||||
timer = (Ecore_Timer *)((Ecore_List2 *)timer)->next;
|
||||
timer = (Ecore_Timer *) EINA_INLIST_GET(timer)->next;
|
||||
|
||||
if ((!timer) || (timer->at > maxtime))
|
||||
return NULL;
|
||||
|
@ -437,28 +426,25 @@ _ecore_timer_next_get(void)
|
|||
int
|
||||
_ecore_timer_call(double when)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
Ecore_Timer *timer;
|
||||
Ecore_Timer *timer, *l;
|
||||
|
||||
if (!timers) return 0;
|
||||
if (last_check > when)
|
||||
{
|
||||
/* User set time backwards */
|
||||
for (l = (Ecore_List2 *)timers; l; l = l->next)
|
||||
{
|
||||
timer = (Ecore_Timer *)l;
|
||||
EINA_INLIST_FOREACH(timers, timer)
|
||||
timer->at -= (last_check - when);
|
||||
}
|
||||
}
|
||||
last_check = when;
|
||||
for (l = (Ecore_List2 *)timers; l; l = l->next)
|
||||
for (l = timers; l;)
|
||||
{
|
||||
timer = (Ecore_Timer *)l;
|
||||
timer = l;
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
if ((timer->at <= when) &&
|
||||
(timer->just_added == 0) &&
|
||||
(timer->delete_me == 0))
|
||||
{
|
||||
timers = _ecore_list2_remove(timers, timer);
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
_ecore_timer_call(when);
|
||||
if ((!timer->delete_me) && (timer->func(timer->data)))
|
||||
{
|
||||
|
@ -492,7 +478,7 @@ _ecore_timer_call(double when)
|
|||
static void
|
||||
_ecore_timer_set(Ecore_Timer *timer, double at, double in, int (*func) (void *data), void *data)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
Ecore_Timer *t2;
|
||||
|
||||
timers_added = 1;
|
||||
timer->at = at;
|
||||
|
@ -504,17 +490,14 @@ _ecore_timer_set(Ecore_Timer *timer, double at, double in, int (*func) (void *da
|
|||
timer->pending = 0.0;
|
||||
if (timers)
|
||||
{
|
||||
for (l = ((Ecore_List2 *)(timers))->last; l; l = l->prev)
|
||||
EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(timers), t2)
|
||||
{
|
||||
Ecore_Timer *t2;
|
||||
|
||||
t2 = (Ecore_Timer *)l;
|
||||
if (timer->at > t2->at)
|
||||
{
|
||||
timers = _ecore_list2_append_relative(timers, timer, t2);
|
||||
timers = (Ecore_Timer *) eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
timers = _ecore_list2_prepend(timers, timer);
|
||||
timers = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue