forked from enlightenment/efl
Ecore_Fd_Handler: added a 'prepare' callback, that is called just before the main loop does its select() run for the FD handlers
SVN revision: 13957
This commit is contained in:
parent
c1356436fe
commit
421719f1d2
|
@ -231,6 +231,7 @@ extern "C" {
|
||||||
EAPI void ecore_main_loop_begin(void);
|
EAPI void ecore_main_loop_begin(void);
|
||||||
EAPI void ecore_main_loop_quit(void);
|
EAPI void ecore_main_loop_quit(void);
|
||||||
EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, int (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data, int (*buf_func) (void *buf_data, Ecore_Fd_Handler *fd_handler), const void *buf_data);
|
EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, int (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data, int (*buf_func) (void *buf_data, Ecore_Fd_Handler *fd_handler), const void *buf_data);
|
||||||
|
EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, void (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data);
|
||||||
EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
|
EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
|
||||||
EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
|
EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
|
||||||
EAPI int ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
|
EAPI int ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
|
||||||
|
|
|
@ -165,6 +165,19 @@ ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
|
||||||
return fd_handler->data;
|
return fd_handler->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, void (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data)
|
||||||
|
{
|
||||||
|
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||||
|
"ecore_main_fd_handler_prepare_callback_set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fd_handler->prep_func = func;
|
||||||
|
fd_handler->prep_data = data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the file descriptor that the given handler is handling.
|
* Retrieves the file descriptor that the given handler is handling.
|
||||||
* @param fd_handler The given FD handler.
|
* @param fd_handler The given FD handler.
|
||||||
|
@ -287,6 +300,17 @@ _ecore_main_select(double timeout)
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_ZERO(&wfds);
|
FD_ZERO(&wfds);
|
||||||
FD_ZERO(&exfds);
|
FD_ZERO(&exfds);
|
||||||
|
|
||||||
|
/* call the prepare callback for all handlers */
|
||||||
|
for (l = (Ecore_Oldlist *)fd_handlers; l; l = l->next)
|
||||||
|
{
|
||||||
|
Ecore_Fd_Handler *fdh;
|
||||||
|
|
||||||
|
fdh = (Ecore_Fd_Handler *)l;
|
||||||
|
|
||||||
|
if (fdh->prep_func)
|
||||||
|
fdh->prep_func (fdh->prep_data, fdh);
|
||||||
|
}
|
||||||
for (l = (Ecore_Oldlist *)fd_handlers; l; l = l->next)
|
for (l = (Ecore_Oldlist *)fd_handlers; l; l = l->next)
|
||||||
{
|
{
|
||||||
Ecore_Fd_Handler *fdh;
|
Ecore_Fd_Handler *fdh;
|
||||||
|
|
|
@ -137,6 +137,8 @@ struct _Ecore_Fd_Handler
|
||||||
void *data;
|
void *data;
|
||||||
int (*buf_func) (void *data, Ecore_Fd_Handler *fd_handler);
|
int (*buf_func) (void *data, Ecore_Fd_Handler *fd_handler);
|
||||||
void *buf_data;
|
void *buf_data;
|
||||||
|
void (*prep_func) (void *data, Ecore_Fd_Handler *fd_handler);
|
||||||
|
void *prep_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Ecore_Event_Handler
|
struct _Ecore_Event_Handler
|
||||||
|
|
Loading…
Reference in New Issue