forked from enlightenment/efl
By popular demand, I'm committing the collisionless naming scheme now, even
though E17 itself hasn't been updated. I don't like having to hand-merge raster's changes anyway. :) SVN revision: 5498
This commit is contained in:
parent
40d7049b65
commit
7f12c5c062
|
@ -2,3 +2,4 @@ The Rasterman <raster@rasterman.com>
|
|||
Tom Gilbert <tom@linuxbrit.co.uk>
|
||||
Burra <burra@colorado.edu>
|
||||
Chris Ross <chris@darkrock.co.uk>
|
||||
Term <term@twistedpath.org>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,28 +1,28 @@
|
|||
#include "Ecore.h"
|
||||
|
||||
typedef struct _ev_handler Ev_Handler;
|
||||
typedef struct _ev_idle_handler Ev_Idle_Handler;
|
||||
typedef struct _ecore_event_handler Ecore_Event_Handler;
|
||||
typedef struct _ecore_event_idle_handler Ecore_Event_Idle_Handler;
|
||||
|
||||
struct _ev_handler
|
||||
struct _ecore_event_handler
|
||||
{
|
||||
void (*func) (Eevent * ev);
|
||||
Ev_Handler *next;
|
||||
void (*func) (Ecore_Event * ev);
|
||||
Ecore_Event_Handler *next;
|
||||
};
|
||||
|
||||
struct _ev_idle_handler
|
||||
struct _ecore_event_idle_handler
|
||||
{
|
||||
void (*func) (void *data);
|
||||
void *data;
|
||||
Ev_Idle_Handler *next;
|
||||
Ecore_Event_Idle_Handler *next;
|
||||
};
|
||||
|
||||
static Ev_Handler *handler[EV_MAX];
|
||||
static Ev_Idle_Handler *idle_handlers = NULL;
|
||||
static Ecore_Event_Handler *handler[ECORE_EVENT_MAX];
|
||||
static Ecore_Event_Idle_Handler *idle_handlers = NULL;
|
||||
|
||||
void
|
||||
e_event_filter(Eevent * ev)
|
||||
ecore_event_filter(Ecore_Event * ev)
|
||||
{
|
||||
Eevent *evp;
|
||||
Ecore_Event *evp;
|
||||
int motion_events = 0;
|
||||
int dnd_pos_events = 0;
|
||||
int dnd_status_events = 0;
|
||||
|
@ -30,16 +30,16 @@ e_event_filter(Eevent * ev)
|
|||
/* count events to only use last events of some types */
|
||||
for (evp = ev; evp; evp = evp->next)
|
||||
{
|
||||
if (evp->type == EV_MOUSE_MOVE)
|
||||
if (evp->type == ECORE_EVENT_MOUSE_MOVE)
|
||||
motion_events++;
|
||||
if (evp->type == EV_DND_DROP_POSITION)
|
||||
if (evp->type == ECORE_EVENT_DND_DROP_POSITION)
|
||||
dnd_pos_events++;
|
||||
if (evp->type == EV_DND_DROP_STATUS)
|
||||
if (evp->type == ECORE_EVENT_DND_DROP_STATUS)
|
||||
dnd_status_events++;
|
||||
}
|
||||
for (evp = ev; evp; evp = evp->next)
|
||||
{
|
||||
if (evp->type == EV_MOUSE_MOVE)
|
||||
if (evp->type == ECORE_EVENT_MOUSE_MOVE)
|
||||
{
|
||||
if (motion_events > 1)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ e_event_filter(Eevent * ev)
|
|||
motion_events--;
|
||||
}
|
||||
}
|
||||
else if (evp->type == EV_DND_DROP_POSITION)
|
||||
else if (evp->type == ECORE_EVENT_DND_DROP_POSITION)
|
||||
{
|
||||
if (dnd_pos_events > 1)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ e_event_filter(Eevent * ev)
|
|||
dnd_pos_events--;
|
||||
}
|
||||
}
|
||||
else if (evp->type == EV_DND_DROP_STATUS)
|
||||
else if (evp->type == ECORE_EVENT_DND_DROP_STATUS)
|
||||
{
|
||||
if (dnd_status_events > 1)
|
||||
{
|
||||
|
@ -67,28 +67,29 @@ e_event_filter(Eevent * ev)
|
|||
}
|
||||
|
||||
void
|
||||
e_event_filter_events_handle(Eevent * ev)
|
||||
ecore_event_filter_events_handle(Ecore_Event * ev)
|
||||
{
|
||||
Eevent *evp;
|
||||
Ecore_Event *evp;
|
||||
|
||||
for (evp = ev; evp; evp = evp->next)
|
||||
{
|
||||
Ev_Handler *h;
|
||||
Ecore_Event_Handler *h;
|
||||
|
||||
if (!evp->ignore)
|
||||
{
|
||||
for (h = handler[evp->type]; h; h = h->next)
|
||||
{
|
||||
if (h->func) h->func(evp);
|
||||
if (h->func)
|
||||
h->func(evp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_event_filter_idle_handle(void)
|
||||
ecore_event_filter_idle_handle(void)
|
||||
{
|
||||
Ev_Idle_Handler *h;
|
||||
Ecore_Event_Idle_Handler *h;
|
||||
|
||||
for (h = idle_handlers; h; h = h->next)
|
||||
h->func(h->data);
|
||||
|
@ -97,32 +98,33 @@ e_event_filter_idle_handle(void)
|
|||
extern int __quit_ev_loop;
|
||||
|
||||
void
|
||||
e_event_filter_init(void)
|
||||
ecore_event_filter_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
__quit_ev_loop = 0;
|
||||
for (i = 0; i < EV_MAX; i++)
|
||||
for (i = 0; i < ECORE_EVENT_MAX; i++)
|
||||
handler[i] = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
e_event_filter_handler_add(Eevent_Type type, void (*func) (Eevent * ev))
|
||||
ecore_event_filter_handler_add(Ecore_Event_Type type,
|
||||
void (*func) (Ecore_Event * ev))
|
||||
{
|
||||
Ev_Handler *h;
|
||||
Ecore_Event_Handler *h;
|
||||
|
||||
h = NEW(Ev_Handler, 1);
|
||||
h = NEW(Ecore_Event_Handler, 1);
|
||||
h->func = func;
|
||||
h->next = handler[type];
|
||||
handler[type] = h;
|
||||
}
|
||||
|
||||
void
|
||||
e_event_filter_idle_handler_add(void (*func) (void *data), void *data)
|
||||
ecore_event_filter_idle_handler_add(void (*func) (void *data), void *data)
|
||||
{
|
||||
Ev_Idle_Handler *h;
|
||||
Ecore_Event_Idle_Handler *h;
|
||||
|
||||
h = NEW(Ev_Idle_Handler, 1);
|
||||
h = NEW(Ecore_Event_Idle_Handler, 1);
|
||||
h->func = func;
|
||||
h->data = data;
|
||||
h->next = idle_handlers;
|
||||
|
|
|
@ -5,25 +5,25 @@
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
static void e_ev_signal_free(void *event);
|
||||
static void e_ev_signal_handle_sigchld(int num);
|
||||
static void e_ev_signal_handle_sigusr1(int num);
|
||||
static void e_ev_signal_handle_sigusr2(int num);
|
||||
static void e_ev_signal_handle_sighup(int num);
|
||||
static void e_ev_signal_handle_sigpipe(int num);
|
||||
static void e_ev_signal_handle_sigsegv(int num);
|
||||
static void e_ev_signal_handle_sigfpe(int num);
|
||||
static void e_ev_signal_handle_sigill(int num);
|
||||
static void e_ev_signal_handle_sigbus(int num);
|
||||
static void ecore_event_signal_free(void *event);
|
||||
static void ecore_event_signal_handle_sigchld(int num);
|
||||
static void ecore_event_signal_handle_sigusr1(int num);
|
||||
static void ecore_event_signal_handle_sigusr2(int num);
|
||||
static void ecore_event_signal_handle_sighup(int num);
|
||||
static void ecore_event_signal_handle_sigpipe(int num);
|
||||
static void ecore_event_signal_handle_sigsegv(int num);
|
||||
static void ecore_event_signal_handle_sigfpe(int num);
|
||||
static void ecore_event_signal_handle_sigill(int num);
|
||||
static void ecore_event_signal_handle_sigbus(int num);
|
||||
|
||||
#ifdef HAVE_SIGSTKFLT
|
||||
static void e_ev_signal_handle_sigstkflt(int num);
|
||||
static void ecore_event_signal_handle_sigstkflt(int num);
|
||||
#endif
|
||||
#ifdef HAVE_SIGPWR
|
||||
static void e_ev_signal_handle_sigpwr(int num);
|
||||
static void ecore_event_signal_handle_sigpwr(int num);
|
||||
#endif
|
||||
static void e_ev_signal_handle_sigchld(int num);
|
||||
static void e_ev_signal_handle_all(pid_t pid);
|
||||
static void ecore_event_signal_handle_sigchld(int num);
|
||||
static void ecore_event_signal_handle_all(pid_t pid);
|
||||
|
||||
static int signal_chld_count = 0;
|
||||
static int signal_usr1_count = 0;
|
||||
|
@ -32,14 +32,14 @@ static int signal_hup_count = 0;
|
|||
|
||||
/* freeing stuff */
|
||||
static void
|
||||
e_ev_signal_free(void *event)
|
||||
ecore_event_signal_free(void *event)
|
||||
{
|
||||
FREE(event);
|
||||
}
|
||||
|
||||
/* signal handlers we can return from and add to signal recieved counts */
|
||||
static void
|
||||
e_ev_signal_handle_sigchld(int num)
|
||||
ecore_event_signal_handle_sigchld(int num)
|
||||
{
|
||||
signal_chld_count++;
|
||||
return;
|
||||
|
@ -47,7 +47,7 @@ e_ev_signal_handle_sigchld(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigusr1(int num)
|
||||
ecore_event_signal_handle_sigusr1(int num)
|
||||
{
|
||||
signal_usr1_count++;
|
||||
return;
|
||||
|
@ -55,7 +55,7 @@ e_ev_signal_handle_sigusr1(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigusr2(int num)
|
||||
ecore_event_signal_handle_sigusr2(int num)
|
||||
{
|
||||
signal_usr2_count++;
|
||||
return;
|
||||
|
@ -63,7 +63,7 @@ e_ev_signal_handle_sigusr2(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sighup(int num)
|
||||
ecore_event_signal_handle_sighup(int num)
|
||||
{
|
||||
signal_hup_count++;
|
||||
return;
|
||||
|
@ -72,7 +72,7 @@ e_ev_signal_handle_sighup(int num)
|
|||
|
||||
/* signals to ignore */
|
||||
static void
|
||||
e_ev_signal_handle_sigpipe(int num)
|
||||
ecore_event_signal_handle_sigpipe(int num)
|
||||
{
|
||||
return;
|
||||
num = 0;
|
||||
|
@ -80,7 +80,7 @@ e_ev_signal_handle_sigpipe(int num)
|
|||
|
||||
/* signal handlers we cant return from - so handle here */
|
||||
static void
|
||||
e_ev_signal_handle_sigsegv(int num)
|
||||
ecore_event_signal_handle_sigsegv(int num)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ e_ev_signal_handle_sigsegv(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigfpe(int num)
|
||||
ecore_event_signal_handle_sigfpe(int num)
|
||||
{
|
||||
/* EEK - can't return - bad */
|
||||
abort();
|
||||
|
@ -101,7 +101,7 @@ e_ev_signal_handle_sigfpe(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigill(int num)
|
||||
ecore_event_signal_handle_sigill(int num)
|
||||
{
|
||||
/* EEK - can't return - bad */
|
||||
abort();
|
||||
|
@ -109,7 +109,7 @@ e_ev_signal_handle_sigill(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigbus(int num)
|
||||
ecore_event_signal_handle_sigbus(int num)
|
||||
{
|
||||
/* EEK - can't return - bad */
|
||||
abort();
|
||||
|
@ -118,7 +118,7 @@ e_ev_signal_handle_sigbus(int num)
|
|||
|
||||
#ifdef HAVE_SIGSTKFLT
|
||||
static void
|
||||
e_ev_signal_handle_sigstkflt(int num)
|
||||
ecore_event_signal_handle_sigstkflt(int num)
|
||||
{
|
||||
/* EEK - can't return - bad */
|
||||
abort();
|
||||
|
@ -128,7 +128,7 @@ e_ev_signal_handle_sigstkflt(int num)
|
|||
#endif
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigint(int num)
|
||||
ecore_event_signal_handle_sigint(int num)
|
||||
{
|
||||
exit(0);
|
||||
return;
|
||||
|
@ -136,7 +136,7 @@ e_ev_signal_handle_sigint(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigquit(int num)
|
||||
ecore_event_signal_handle_sigquit(int num)
|
||||
{
|
||||
exit(0);
|
||||
return;
|
||||
|
@ -144,7 +144,7 @@ e_ev_signal_handle_sigquit(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigabrt(int num)
|
||||
ecore_event_signal_handle_sigabrt(int num)
|
||||
{
|
||||
abort();
|
||||
return;
|
||||
|
@ -152,14 +152,14 @@ e_ev_signal_handle_sigabrt(int num)
|
|||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigalrm(int num)
|
||||
ecore_event_signal_handle_sigalrm(int num)
|
||||
{
|
||||
return;
|
||||
num = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_sigterm(int num)
|
||||
ecore_event_signal_handle_sigterm(int num)
|
||||
{
|
||||
exit(0);
|
||||
return;
|
||||
|
@ -168,7 +168,7 @@ e_ev_signal_handle_sigterm(int num)
|
|||
|
||||
#ifdef HAVE_SIGPWR
|
||||
static void
|
||||
e_ev_signal_handle_sigpwr(int num)
|
||||
ecore_event_signal_handle_sigpwr(int num)
|
||||
{
|
||||
exit(0);
|
||||
return;
|
||||
|
@ -177,7 +177,7 @@ e_ev_signal_handle_sigpwr(int num)
|
|||
#endif
|
||||
|
||||
static void
|
||||
e_ev_signal_handle_all(pid_t pid_pass)
|
||||
ecore_event_signal_handle_all(pid_t pid_pass)
|
||||
{
|
||||
int status;
|
||||
pid_t pid;
|
||||
|
@ -188,36 +188,36 @@ e_ev_signal_handle_all(pid_t pid_pass)
|
|||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
Ev_Child *e;
|
||||
Ecore_Event_Child *e;
|
||||
int code;
|
||||
|
||||
code = WEXITSTATUS(status);
|
||||
e = NEW(Ev_Child, 1);
|
||||
e = NEW(Ecore_Event_Child, 1);
|
||||
e->pid = pid;
|
||||
e->exit_code = code;
|
||||
e_add_event(EV_CHILD, e, e_ev_signal_free);
|
||||
ecore_add_event(ECORE_EVENT_CHILD, e, ecore_event_signal_free);
|
||||
}
|
||||
}
|
||||
signal_chld_count = 0;
|
||||
}
|
||||
while (signal_usr1_count > 0)
|
||||
{
|
||||
Ev_User *e;
|
||||
Ecore_Event_User *e;
|
||||
|
||||
e = NEW(Ev_User, 1);
|
||||
e = NEW(Ecore_Event_User, 1);
|
||||
e->num = 0;
|
||||
e->hup = 0;
|
||||
e_add_event(EV_USER, e, e_ev_signal_free);
|
||||
ecore_add_event(ECORE_EVENT_USER, e, ecore_event_signal_free);
|
||||
signal_usr1_count--;
|
||||
}
|
||||
while (signal_hup_count > 0)
|
||||
{
|
||||
Ev_User *e;
|
||||
Ecore_Event_User *e;
|
||||
|
||||
e = NEW(Ev_User, 1);
|
||||
e = NEW(Ecore_Event_User, 1);
|
||||
e->num = 0;
|
||||
e->hup = 1;
|
||||
e_add_event(EV_USER, e, e_ev_signal_free);
|
||||
ecore_add_event(ECORE_EVENT_USER, e, ecore_event_signal_free);
|
||||
signal_hup_count--;
|
||||
}
|
||||
return;
|
||||
|
@ -225,94 +225,94 @@ e_ev_signal_handle_all(pid_t pid_pass)
|
|||
}
|
||||
|
||||
int
|
||||
e_ev_signal_events_pending(void)
|
||||
ecore_event_signal_events_pending(void)
|
||||
{
|
||||
return (signal_chld_count + signal_usr1_count + signal_hup_count);
|
||||
}
|
||||
|
||||
void
|
||||
e_ev_signal_init(void)
|
||||
ecore_event_signal_init(void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
e_add_event_pid(0, e_ev_signal_handle_all);
|
||||
ecore_add_event_pid(0, ecore_event_signal_handle_all);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigchld;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigchld;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGCHLD, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigusr1;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigusr1;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGUSR1, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigusr2;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigusr2;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGUSR2, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sighup;
|
||||
sa.sa_handler = ecore_event_signal_handle_sighup;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGHUP, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigpipe;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigpipe;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGPIPE, &sa, (struct sigaction *)0);
|
||||
/*
|
||||
sa.sa_handler = e_ev_signal_handle_sigsegv;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigsegv;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGSEGV, &sa, (struct sigaction *)0);
|
||||
*/
|
||||
sa.sa_handler = e_ev_signal_handle_sigfpe;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigfpe;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGFPE, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigill;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigill;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGILL, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigbus;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigbus;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGBUS, &sa, (struct sigaction *)0);
|
||||
#ifdef HAVE_SIGSTKFLT
|
||||
sa.sa_handler = e_ev_signal_handle_sigstkflt;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigstkflt;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGSTKFLT, &sa, (struct sigaction *)0);
|
||||
#endif
|
||||
sa.sa_handler = e_ev_signal_handle_sigint;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigint;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGINT, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigquit;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigquit;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGQUIT, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigabrt;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigabrt;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGABRT, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigalrm;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigalrm;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGALRM, &sa, (struct sigaction *)0);
|
||||
|
||||
sa.sa_handler = e_ev_signal_handle_sigterm;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigterm;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGTERM, &sa, (struct sigaction *)0);
|
||||
#ifdef HAVE_SIGPWR
|
||||
sa.sa_handler = e_ev_signal_handle_sigpwr;
|
||||
sa.sa_handler = ecore_event_signal_handle_sigpwr;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGPWR, &sa, (struct sigaction *)0);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,29 +6,30 @@
|
|||
#include <unistd.h>
|
||||
|
||||
/* glocal (yes global/local) variabels for events */
|
||||
Ev_Fd_Handler *fd_handlers = NULL;
|
||||
Ev_Ipc_Handler *ipc_handlers = NULL;
|
||||
Ev_Pid_Handler *pid_handlers = NULL;
|
||||
Ev_Timer *timers = NULL;
|
||||
Ecore_Event_Fd_Handler *fd_handlers = NULL;
|
||||
Ecore_Event_Ipc_Handler *ipc_handlers = NULL;
|
||||
Ecore_Event_Pid_Handler *pid_handlers = NULL;
|
||||
Ecore_Event_Timer *timers = NULL;
|
||||
|
||||
Eevent *events = NULL;
|
||||
Eevent *last_event = NULL;
|
||||
Ecore_Event *events = NULL;
|
||||
Ecore_Event *last_event = NULL;
|
||||
|
||||
int __quit_ev_loop = 0;
|
||||
|
||||
/* local functions for event handling */
|
||||
static void e_handle_event_timer(void);
|
||||
static void e_handle_zero_event_timer(void);
|
||||
static void ecore_handle_event_timer(void);
|
||||
static void ecore_handle_zero_event_timer(void);
|
||||
|
||||
/* public functions */
|
||||
|
||||
/* add an event to the end of the event queue */
|
||||
void
|
||||
e_add_event(Eevent_Type type, void *event, void (*ev_free) (void *event))
|
||||
ecore_add_event(Ecore_Event_Type type, void *event,
|
||||
void (*ev_free) (void *event))
|
||||
{
|
||||
Eevent *ev;
|
||||
Ecore_Event *ev;
|
||||
|
||||
ev = NEW(Eevent, 1);
|
||||
ev = NEW(Ecore_Event, 1);
|
||||
ev->type = type;
|
||||
ev->ignore = 0;
|
||||
ev->event = event;
|
||||
|
@ -43,9 +44,9 @@ e_add_event(Eevent_Type type, void *event, void (*ev_free) (void *event))
|
|||
|
||||
/* delete an event from the event queue */
|
||||
void
|
||||
e_del_event(void *event)
|
||||
ecore_del_event(void *event)
|
||||
{
|
||||
Eevent *ev, *pev;
|
||||
Ecore_Event *ev, *pev;
|
||||
|
||||
pev = NULL;
|
||||
ev = events;
|
||||
|
@ -70,9 +71,9 @@ e_del_event(void *event)
|
|||
}
|
||||
|
||||
void
|
||||
e_del_all_events(void)
|
||||
ecore_del_all_events(void)
|
||||
{
|
||||
Eevent *ev, *pev;
|
||||
Ecore_Event *ev, *pev;
|
||||
|
||||
ev = events;
|
||||
while (ev)
|
||||
|
@ -87,20 +88,20 @@ e_del_all_events(void)
|
|||
last_event = NULL;
|
||||
}
|
||||
|
||||
Eevent *
|
||||
e_get_last_event(void)
|
||||
Ecore_Event *
|
||||
ecore_get_last_event(void)
|
||||
{
|
||||
return last_event;
|
||||
}
|
||||
|
||||
/* add a callback handler if fd is active for reading */
|
||||
void
|
||||
e_add_event_fd(int fd, void (*func) (int fd))
|
||||
ecore_add_event_fd(int fd, void (*func) (int fd))
|
||||
{
|
||||
Ev_Fd_Handler *fd_h;
|
||||
Ecore_Event_Fd_Handler *fd_h;
|
||||
|
||||
/* new handler struct */
|
||||
fd_h = NEW(Ev_Fd_Handler, 1);
|
||||
fd_h = NEW(Ecore_Event_Fd_Handler, 1);
|
||||
fd_h->next = fd_handlers;
|
||||
fd_h->fd = fd;
|
||||
fd_h->func = func;
|
||||
|
@ -109,22 +110,22 @@ e_add_event_fd(int fd, void (*func) (int fd))
|
|||
|
||||
/* delete handler for fd */
|
||||
void
|
||||
e_del_event_fd(int fd)
|
||||
ecore_del_event_fd(int fd)
|
||||
{
|
||||
START_LIST_DEL(Ev_Fd_Handler, fd_handlers, (_p->fd == fd));
|
||||
START_LIST_DEL(Ecore_Event_Fd_Handler, fd_handlers, (_p->fd == fd));
|
||||
FREE(_p);
|
||||
END_LIST_DEL;
|
||||
}
|
||||
|
||||
void
|
||||
e_add_event_pid(pid_t pid, void (*func) (pid_t pid))
|
||||
ecore_add_event_pid(pid_t pid, void (*func) (pid_t pid))
|
||||
{
|
||||
Ev_Pid_Handler *pid_h;
|
||||
Ecore_Event_Pid_Handler *pid_h;
|
||||
|
||||
/* delete the old handler */
|
||||
e_del_event_pid(pid);
|
||||
ecore_del_event_pid(pid);
|
||||
/* new handler struct */
|
||||
pid_h = NEW(Ev_Pid_Handler, 1);
|
||||
pid_h = NEW(Ecore_Event_Pid_Handler, 1);
|
||||
pid_h->next = pid_handlers;
|
||||
pid_h->pid = pid;
|
||||
pid_h->func = func;
|
||||
|
@ -132,22 +133,22 @@ e_add_event_pid(pid_t pid, void (*func) (pid_t pid))
|
|||
}
|
||||
|
||||
void
|
||||
e_del_event_pid(pid_t pid)
|
||||
ecore_del_event_pid(pid_t pid)
|
||||
{
|
||||
START_LIST_DEL(Ev_Pid_Handler, pid_handlers, (_p->pid == pid));
|
||||
START_LIST_DEL(Ecore_Event_Pid_Handler, pid_handlers, (_p->pid == pid));
|
||||
FREE(_p);
|
||||
END_LIST_DEL;
|
||||
}
|
||||
|
||||
void
|
||||
e_add_event_ipc(int ipc, void (*func) (int ipc))
|
||||
ecore_add_event_ipc(int ipc, void (*func) (int ipc))
|
||||
{
|
||||
Ev_Ipc_Handler *ipc_h;
|
||||
Ecore_Event_Ipc_Handler *ipc_h;
|
||||
|
||||
/* delete the old handler */
|
||||
e_del_event_ipc(ipc);
|
||||
ecore_del_event_ipc(ipc);
|
||||
/* new handler struct */
|
||||
ipc_h = NEW(Ev_Ipc_Handler, 1);
|
||||
ipc_h = NEW(Ecore_Event_Ipc_Handler, 1);
|
||||
ipc_h->next = ipc_handlers;
|
||||
ipc_h->ipc = ipc;
|
||||
ipc_h->func = func;
|
||||
|
@ -155,28 +156,28 @@ e_add_event_ipc(int ipc, void (*func) (int ipc))
|
|||
}
|
||||
|
||||
void
|
||||
e_del_event_ipc(int ipc)
|
||||
ecore_del_event_ipc(int ipc)
|
||||
{
|
||||
START_LIST_DEL(Ev_Ipc_Handler, ipc_handlers, (_p->ipc == ipc));
|
||||
START_LIST_DEL(Ecore_Event_Ipc_Handler, ipc_handlers, (_p->ipc == ipc));
|
||||
FREE(_p);
|
||||
END_LIST_DEL;
|
||||
}
|
||||
|
||||
/* sit in this loop forever and process events */
|
||||
void
|
||||
e_event_loop(void)
|
||||
ecore_event_loop(void)
|
||||
{
|
||||
int fdcount, fdsize, ipccount, ipcsize;
|
||||
int timed_out, were_events;
|
||||
double time1, time2, prev_time = 0.0;
|
||||
struct timeval tval;
|
||||
fd_set fdset, ipcset;
|
||||
Ev_Fd_Handler *fd_h;
|
||||
Ev_Pid_Handler *pid_h;
|
||||
Ev_Ipc_Handler *ipc_h;
|
||||
Ecore_Event_Fd_Handler *fd_h;
|
||||
Ecore_Event_Pid_Handler *pid_h;
|
||||
Ecore_Event_Ipc_Handler *ipc_h;
|
||||
|
||||
/* init some of the time variables */
|
||||
time1 = e_get_time();
|
||||
time1 = ecore_get_time();
|
||||
time2 = time1 - prev_time;
|
||||
prev_time = time1;
|
||||
while (__quit_ev_loop == 0)
|
||||
|
@ -227,16 +228,14 @@ e_event_loop(void)
|
|||
tval.tv_sec = 0;
|
||||
if (tval.tv_usec <= 1000)
|
||||
tval.tv_usec = 1000;
|
||||
e_handle_zero_event_timer();
|
||||
if ((!e_events_pending()) &&
|
||||
(!e_ev_signal_events_pending()))
|
||||
ecore_handle_zero_event_timer();
|
||||
if ((!ecore_events_pending()) && (!ecore_ev_signal_events_pending()))
|
||||
fdcount = select(fdsize + 1, &fdset, NULL, NULL, &tval);
|
||||
}
|
||||
/* no timers - just sit and block */
|
||||
else
|
||||
{
|
||||
if ((!e_events_pending()) &&
|
||||
(!e_ev_signal_events_pending()))
|
||||
if ((!ecore_events_pending()) && (!ecore_ev_signal_events_pending()))
|
||||
fdcount = select(fdsize + 1, &fdset, NULL, NULL, NULL);
|
||||
}
|
||||
for (pid_h = pid_handlers; pid_h; pid_h = pid_h->next)
|
||||
|
@ -260,15 +259,15 @@ e_event_loop(void)
|
|||
/* timers are available and its a timeout */
|
||||
if ((timers) && (fdcount == 0))
|
||||
{
|
||||
e_handle_event_timer();
|
||||
ecore_handle_event_timer();
|
||||
timed_out = 1;
|
||||
}
|
||||
if (fdcount < 0)
|
||||
fdcount = 0;
|
||||
if (e_events_pending())
|
||||
if (ecore_events_pending())
|
||||
{
|
||||
fdcount++;
|
||||
FD_SET(e_x_get_fd(), &fdset);
|
||||
FD_SET(ecore_x_get_fd(), &fdset);
|
||||
}
|
||||
/* fd's are active */
|
||||
if (fdcount > 0)
|
||||
|
@ -276,7 +275,7 @@ e_event_loop(void)
|
|||
/* for every fd handler - if its fd is set - call the func */
|
||||
for (fd_h = fd_handlers; fd_h;)
|
||||
{
|
||||
Ev_Fd_Handler *fdh;
|
||||
Ecore_Event_Fd_Handler *fdh;
|
||||
|
||||
fdh = fd_h;
|
||||
fd_h = fd_h->next;
|
||||
|
@ -290,7 +289,7 @@ e_event_loop(void)
|
|||
{
|
||||
for (ipc_h = ipc_handlers; ipc_h;)
|
||||
{
|
||||
Ev_Ipc_Handler *ipch;
|
||||
Ecore_Event_Ipc_Handler *ipch;
|
||||
|
||||
ipch = ipc_h;
|
||||
ipc_h = ipc_h->next;
|
||||
|
@ -299,17 +298,17 @@ e_event_loop(void)
|
|||
}
|
||||
}
|
||||
if (events)
|
||||
e_event_filter(events);
|
||||
ecore_event_filter(events);
|
||||
if (events)
|
||||
{
|
||||
e_event_filter_events_handle(events);
|
||||
ecore_event_filter_events_handle(events);
|
||||
were_events = 1;
|
||||
}
|
||||
e_del_all_events();
|
||||
ecore_del_all_events();
|
||||
if ((timed_out) || (were_events))
|
||||
e_event_filter_idle_handle();
|
||||
e_flush();
|
||||
time1 = e_get_time();
|
||||
ecore_event_filter_idle_handle();
|
||||
ecore_flush();
|
||||
time1 = ecore_get_time();
|
||||
time2 = time1 - prev_time;
|
||||
prev_time = time1;
|
||||
}
|
||||
|
@ -318,22 +317,22 @@ e_event_loop(void)
|
|||
/* set a flag to 0 so that we can quit the event loop and shutdown
|
||||
* properly */
|
||||
void
|
||||
e_event_loop_quit(void)
|
||||
ecore_event_loop_quit(void)
|
||||
{
|
||||
__quit_ev_loop = 1;
|
||||
}
|
||||
|
||||
/* add a timeout funcitont o be called in "in" seconds with name name */
|
||||
void
|
||||
e_add_event_timer(char *name, double in, void (*func) (int val, void *data),
|
||||
ecore_add_event_timer(char *name, double in, void (*func) (int val, void *data),
|
||||
int val, void *data)
|
||||
{
|
||||
Ev_Timer *timer, *ptr, *pptr;
|
||||
Ecore_Event_Timer *timer, *ptr, *pptr;
|
||||
double tally;
|
||||
|
||||
if (name)
|
||||
e_del_event_timer(name);
|
||||
timer = NEW(Ev_Timer, 1);
|
||||
ecore_del_event_timer(name);
|
||||
timer = NEW(Ecore_Event_Timer, 1);
|
||||
timer->next = NULL;
|
||||
timer->func = func;
|
||||
timer->data = data;
|
||||
|
@ -377,9 +376,9 @@ e_add_event_timer(char *name, double in, void (*func) (int val, void *data),
|
|||
|
||||
/* delete a timer timeout entry named "name" */
|
||||
void *
|
||||
e_del_event_timer(char *name)
|
||||
ecore_del_event_timer(char *name)
|
||||
{
|
||||
Ev_Timer *timer, *ptr, *pptr;
|
||||
Ecore_Event_Timer *timer, *ptr, *pptr;
|
||||
|
||||
pptr = NULL;
|
||||
ptr = timers;
|
||||
|
@ -409,9 +408,9 @@ e_del_event_timer(char *name)
|
|||
|
||||
/* private functions */
|
||||
static void
|
||||
e_handle_event_timer(void)
|
||||
ecore_handle_event_timer(void)
|
||||
{
|
||||
Ev_Timer *timer;
|
||||
Ecore_Event_Timer *timer;
|
||||
|
||||
if (!timers)
|
||||
return;
|
||||
|
@ -423,8 +422,8 @@ e_handle_event_timer(void)
|
|||
}
|
||||
|
||||
static void
|
||||
e_handle_zero_event_timer(void)
|
||||
ecore_handle_zero_event_timer(void)
|
||||
{
|
||||
while ((timers) && (timers->in == 0.0))
|
||||
e_handle_event_timer();
|
||||
ecore_handle_event_timer();
|
||||
}
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void e_ipc_init(char *path);
|
||||
void e_ipc_cleanup(void);
|
||||
static void e_ipc_connect_handler(int fd);
|
||||
static void e_ipc_client_handler(int fd);
|
||||
void e_ipc_get_data(int fd, void *buf);
|
||||
void e_ipc_send_data(int fd, void *buf, int size);
|
||||
void e_add_ipc_service(int service, void (*func) (int fd));
|
||||
void e_del_ipc_service(int service);
|
||||
void ecore_ipc_init(char *path);
|
||||
void ecore_ipc_cleanup(void);
|
||||
static void ecore_ipc_connect_handler(int fd);
|
||||
static void ecore_ipc_client_handler(int fd);
|
||||
void ecore_ipc_get_data(int fd, void *buf);
|
||||
void ecore_ipc_send_data(int fd, void *buf, int size);
|
||||
void ecore_add_ipc_service(int service, void (*func) (int fd));
|
||||
void ecore_del_ipc_service(int service);
|
||||
|
||||
Ev_Ipc_Service *ipc_services = NULL;
|
||||
Ecore_Event_Ipc_Service *ipc_services = NULL;
|
||||
|
||||
void
|
||||
e_ev_ipc_init(char *path)
|
||||
ecore_ev_ipc_init(char *path)
|
||||
{
|
||||
int fd, len;
|
||||
struct sockaddr_un saun;
|
||||
|
@ -40,7 +40,7 @@ e_ev_ipc_init(char *path)
|
|||
unlink(path);
|
||||
len = sizeof(saun.sun_family) + strlen(saun.sun_path);
|
||||
|
||||
if (bind(fd, &saun, len) < 0)
|
||||
if (bind(fd, (struct sockaddr *)&saun, len) < 0)
|
||||
{
|
||||
printf("Cannot bind ipc socket... disabling ipc.\n");
|
||||
return;
|
||||
|
@ -54,23 +54,23 @@ e_ev_ipc_init(char *path)
|
|||
}
|
||||
|
||||
/* add ipc listener */
|
||||
e_add_event_ipc(fd, e_ipc_connect_handler);
|
||||
ecore_add_event_ipc(fd, ecore_ipc_connect_handler);
|
||||
}
|
||||
|
||||
void
|
||||
e_ev_ipc_cleanup(void)
|
||||
ecore_ev_ipc_cleanup(void)
|
||||
{
|
||||
Ev_Ipc_Service *ipc_s;
|
||||
Ecore_Event_Ipc_Service *ipc_s;
|
||||
|
||||
/* cleanup services list */
|
||||
for (ipc_s = ipc_services; ipc_s; ipc_s = ipc_s->next)
|
||||
{
|
||||
e_del_ipc_service(ipc_s->service);
|
||||
ecore_del_ipc_service(ipc_s->service);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
e_ipc_connect_handler(int fd)
|
||||
ecore_ipc_connect_handler(int fd)
|
||||
{
|
||||
struct sockaddr_un fsaun;
|
||||
int fromlen, nfd;
|
||||
|
@ -78,26 +78,26 @@ e_ipc_connect_handler(int fd)
|
|||
/* accept ipc connection */
|
||||
fromlen = sizeof(fsaun);
|
||||
|
||||
if ((nfd = accept(fd, &fsaun, &fromlen)) < 0)
|
||||
if ((nfd = accept(fd, (struct sockaddr *)&fsaun, &fromlen)) < 0)
|
||||
{
|
||||
printf("Cannot accept ipc connection... ignoring connection attempt.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* add ipc client */
|
||||
e_add_event_ipc(nfd, e_ipc_client_handler);
|
||||
ecore_add_event_ipc(nfd, ecore_ipc_client_handler);
|
||||
}
|
||||
|
||||
static void
|
||||
e_ipc_client_handler(int fd)
|
||||
ecore_ipc_client_handler(int fd)
|
||||
{
|
||||
int nread, service;
|
||||
Ev_Ipc_Service *ipc_s;
|
||||
Ecore_Event_Ipc_Service *ipc_s;
|
||||
|
||||
if ((nread = read(fd, &service, sizeof(service))) == 0)
|
||||
{
|
||||
close(fd);
|
||||
e_del_event_ipc(fd);
|
||||
ecore_del_event_ipc(fd);
|
||||
}
|
||||
else if (nread > 0)
|
||||
{
|
||||
|
@ -113,67 +113,75 @@ e_ipc_client_handler(int fd)
|
|||
}
|
||||
else
|
||||
{
|
||||
printf("ipc error in read service.\n"); fflush(stdout);
|
||||
printf("ipc error in read service.\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_ipc_get_data(int fd, void *buf)
|
||||
ecore_ipc_get_data(int fd, void *buf)
|
||||
{
|
||||
int readn, nread;
|
||||
|
||||
/* read number of bytes being sent */
|
||||
if ((nread = read(fd, &readn, sizeof(readn))) == -1)
|
||||
{
|
||||
printf("ipc error in get data.\n"); fflush(stdout);
|
||||
printf("ipc error in get data.\n");
|
||||
fflush(stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get data structure */
|
||||
if ((nread = read(fd, buf, readn)) == -1)
|
||||
{
|
||||
printf("ipc error in get data.\n"); fflush(stdout);
|
||||
printf("ipc error in get data.\n");
|
||||
fflush(stdout);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_ipc_send_data(int fd, void *buf, int size)
|
||||
ecore_ipc_send_data(int fd, void *buf, int size)
|
||||
{
|
||||
int n;
|
||||
|
||||
/* send length of data being sent */
|
||||
if ((n = write(fd, &size, sizeof(size))) == -1)
|
||||
{
|
||||
printf("ipc error in send data length.\n"); fflush(stdout);
|
||||
printf("ipc error in send data length.\n");
|
||||
fflush(stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
/* send data */
|
||||
if ((n = write(fd, buf, size)) == -1)
|
||||
{
|
||||
printf("ipc error in send data.\n"); fflush(stdout);
|
||||
printf("ipc error in send data.\n");
|
||||
fflush(stdout);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_add_ipc_service(int service, void (*func) (int fd))
|
||||
ecore_add_ipc_service(int service, void (*func) (int fd))
|
||||
{
|
||||
Ev_Ipc_Service *ipc_s;
|
||||
Ecore_Event_Ipc_Service *ipc_s;
|
||||
|
||||
/* delete the old service */
|
||||
e_del_ipc_service(service);
|
||||
ecore_del_ipc_service(service);
|
||||
/* new service struct */
|
||||
ipc_s = NEW(Ev_Ipc_Service, 1);
|
||||
ipc_s = NEW(Ecore_Event_Ipc_Service, 1);
|
||||
ipc_s->next = ipc_services;
|
||||
ipc_s->service = service;
|
||||
ipc_s->func = func;
|
||||
ipc_services = ipc_s;
|
||||
}
|
||||
|
||||
void e_del_ipc_service(int service)
|
||||
void
|
||||
ecore_del_ipc_service(int service)
|
||||
{
|
||||
START_LIST_DEL(Ev_Ipc_Service, ipc_services, (_p->service == service));
|
||||
START_LIST_DEL(Ecore_Event_Ipc_Service, ipc_services,
|
||||
(_p->service == service));
|
||||
FREE(_p);
|
||||
END_LIST_DEL;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "Ecore.h"
|
||||
|
||||
double
|
||||
e_get_time(void)
|
||||
ecore_get_time(void)
|
||||
{
|
||||
struct timeval timev;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue