Data Structures | |
struct | _Ecore_Event_Signal_User |
User signal event. More... | |
struct | _Ecore_Event_Signal_Hup |
Hup signal event. More... | |
struct | _Ecore_Event_Signal_Exit |
Exit request event. More... | |
struct | _Ecore_Event_Signal_Power |
Power event. More... | |
struct | _Ecore_Event_Signal_Realtime |
Realtime event. More... | |
struct | _Ecore_Exe_Event_Add |
Process add event. More... | |
struct | _Ecore_Exe_Event_Del |
Process exit event. More... | |
struct | _Ecore_Exe_Event_Data_Line |
< Lines from a child process More... | |
struct | _Ecore_Exe_Event_Data |
Data from a child process event. More... | |
Defines | |
#define | ECORE_EVENT_SIGNAL_USER 1 |
User signal event. | |
#define | ECORE_EVENT_SIGNAL_HUP 2 |
Hup signal event. | |
#define | ECORE_EVENT_SIGNAL_EXIT 3 |
Exit signal event. | |
#define | ECORE_EVENT_SIGNAL_POWER 4 |
Power signal event. | |
#define | ECORE_EVENT_SIGNAL_REALTIME 5 |
Realtime signal event. | |
Typedefs | |
typedef void | Ecore_Exe |
A handle for spawned processes. | |
typedef void | Ecore_Timer |
A handle for timers. | |
typedef void | Ecore_Idler |
A handle for idlers. | |
typedef void | Ecore_Idle_Enterer |
A handle for idle enterers. | |
typedef void | Ecore_Idle_Exiter |
A handle for idle exiters. | |
typedef void | Ecore_Fd_Handler |
A handle for Fd hanlders. | |
typedef void | Ecore_Event_Handler |
A handle for an event handler. | |
typedef void | Ecore_Event_Filter |
A handle for an event filter. | |
typedef void | Ecore_Event |
A handle for an event. | |
typedef void | Ecore_Animator |
A handle for animators. | |
typedef _Ecore_Event_Signal_User | Ecore_Event_Signal_User |
User signal event. | |
typedef _Ecore_Event_Signal_Hup | Ecore_Event_Signal_Hup |
Hup signal event. | |
typedef _Ecore_Event_Signal_Exit | Ecore_Event_Signal_Exit |
Exit signal event. | |
typedef _Ecore_Event_Signal_Power | Ecore_Event_Signal_Power |
Power signal event. | |
typedef _Ecore_Event_Signal_Realtime | Ecore_Event_Signal_Realtime |
Realtime signal event. | |
typedef _Ecore_Exe_Event_Add | Ecore_Exe_Event_Add |
Spawned Exe add event. | |
typedef _Ecore_Exe_Event_Del | Ecore_Exe_Event_Del |
Spawned Exe exit event. | |
typedef _Ecore_Exe_Event_Data_Line | Ecore_Exe_Event_Data_Line |
Lines from a child process. | |
typedef _Ecore_Exe_Event_Data | Ecore_Exe_Event_Data |
Data from a child process. | |
Enumerations | |
enum | _Ecore_Fd_Handler_Flags { ECORE_FD_READ = 1, ECORE_FD_WRITE = 2, ECORE_FD_ERROR = 4 } |
enum | _Ecore_Exe_Flags { ECORE_EXE_PIPE_READ = 1, ECORE_EXE_PIPE_WRITE = 2, ECORE_EXE_PIPE_ERROR = 4, ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, ECORE_EXE_PIPE_AUTO = 32, ECORE_EXE_RESPAWN = 64, ECORE_EXE_USE_SH = 128 } |
Functions | |
EAPI int | ecore_init (void) |
Set up connections, signal handlers, sockets etc. | |
EAPI int | ecore_shutdown (void) |
Shut down connections, signal handlers sockets etc. | |
EAPI void | ecore_app_args_set (int argc, const char **argv) |
Set up the programs command-line arguments. | |
EAPI void | ecore_app_args_get (int *argc, char ***argv) |
Return the programs stored command-line arguments. | |
EAPI void | ecore_app_restart (void) |
Restart the program executable with the command-line arguments stored. | |
EAPI Ecore_Event_Handler * | ecore_event_handler_add (int type, int(*func)(void *data, int type, void *event), const void *data) |
Add an event handler. | |
EAPI void * | ecore_event_handler_del (Ecore_Event_Handler *event_handler) |
Delete an event handler. | |
EAPI Ecore_Event * | ecore_event_add (int type, void *ev, void(*func_free)(void *data, void *ev), void *data) |
Add an event to the event queue. | |
EAPI void * | ecore_event_del (Ecore_Event *event) |
Delete an event from the queue. | |
EAPI int | ecore_event_type_new (void) |
Allocate a new event type id sensibly and return the new id. | |
EAPI Ecore_Event_Filter * | ecore_event_filter_add (void *(*func_start)(void *data), int(*func_filter)(void *data, void *loop_data, int type, void *event), void(*func_end)(void *data, void *loop_data), const void *data) |
Add a filter the current event queue. | |
EAPI void * | ecore_event_filter_del (Ecore_Event_Filter *ef) |
Delete an event filter. | |
EAPI int | ecore_event_current_type_get (void) |
Return the current event type being handled. | |
EAPI void * | ecore_event_current_event_get (void) |
Return the current event type pointer handled. | |
EAPI Ecore_Exe * | ecore_exe_run (const char *exe_cmd, const void *data) |
Spawns a child process. | |
EAPI Ecore_Exe * | ecore_exe_pipe_run (const char *exe_cmd, Ecore_Exe_Flags flags, const void *data) |
Spawns a child process with its stdin/out available for communication. | |
EAPI int | ecore_exe_send (Ecore_Exe *exe, void *data, int size) |
Sends data to the given child process which it recieves on stdin. | |
EAPI void | ecore_exe_close_stdin (Ecore_Exe *exe) |
The stdin of the given child process will close when the write buffer is empty. | |
EAPI void | ecore_exe_auto_limits_set (Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines) |
Sets the auto pipe limits for the given process handle. | |
EAPI Ecore_Exe_Event_Data * | ecore_exe_event_data_get (Ecore_Exe *exe, Ecore_Exe_Flags flags) |
Gets the auto pipe data for the given process handle. | |
EAPI void | ecore_exe_event_data_free (Ecore_Exe_Event_Data *data) |
Frees the given event data. | |
EAPI void * | ecore_exe_free (Ecore_Exe *exe) |
Frees the given process handle. | |
EAPI pid_t | ecore_exe_pid_get (Ecore_Exe *exe) |
Retrieves the process ID of the given spawned process. | |
EAPI void | ecore_exe_tag_set (Ecore_Exe *exe, const char *tag) |
Sets the string tag for the given process handle. | |
EAPI char * | ecore_exe_tag_get (Ecore_Exe *exe) |
Retrieves the tag attached to the given process handle. | |
EAPI char * | ecore_exe_cmd_get (Ecore_Exe *exe) |
Retrieves the command of the given spawned process. | |
EAPI void * | ecore_exe_data_get (Ecore_Exe *exe) |
Retrieves the data attached to the given process handle. | |
EAPI void | ecore_exe_pause (Ecore_Exe *exe) |
Pauses the given process by sending it a SIGSTOP signal. | |
EAPI void | ecore_exe_continue (Ecore_Exe *exe) |
Continues the given paused process by sending it a SIGCONT signal. | |
EAPI void | ecore_exe_terminate (Ecore_Exe *exe) |
Sends the given spawned process a terminate (SIGTERM ) signal. | |
EAPI void | ecore_exe_kill (Ecore_Exe *exe) |
Kills the given spawned process by sending it a SIGKILL signal. | |
EAPI void | ecore_exe_signal (Ecore_Exe *exe, int num) |
Sends a SIGUSR signal to the given spawned process. | |
EAPI void | ecore_exe_hup (Ecore_Exe *exe) |
Sends a SIGHUP signal to the given spawned process. | |
EAPI Ecore_Idler * | ecore_idler_add (int(*func)(void *data), const void *data) |
Add an idler handler. | |
EAPI void * | ecore_idler_del (Ecore_Idler *idler) |
Delete an idler callback from the list to be executed. | |
EAPI Ecore_Idle_Enterer * | ecore_idle_enterer_add (int(*func)(void *data), const void *data) |
Add an idle enterer handler. | |
EAPI void * | ecore_idle_enterer_del (Ecore_Idle_Enterer *idle_enterer) |
Delete an idle enterer callback. | |
EAPI Ecore_Idle_Exiter * | ecore_idle_exiter_add (int(*func)(void *data), const void *data) |
Add an idle exiter handler. | |
EAPI void * | ecore_idle_exiter_del (Ecore_Idle_Exiter *idle_exiter) |
Delete an idle exiter handler from the list to be run on exiting idle state. | |
EAPI void | ecore_main_loop_iterate (void) |
Runs a single iteration of the main loop to process everything on the queue. | |
EAPI void | ecore_main_loop_begin (void) |
Runs the application main loop. | |
EAPI void | ecore_main_loop_quit (void) |
Quits the main loop once all the events currently on the queue have been processed. | |
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) |
Adds a callback for activity on the given file descriptor. | |
EAPI void * | ecore_main_fd_handler_del (Ecore_Fd_Handler *fd_handler) |
Deletes the given FD handler. | |
EAPI int | ecore_main_fd_handler_fd_get (Ecore_Fd_Handler *fd_handler) |
Retrieves the file descriptor that the given handler is handling. | |
EAPI int | ecore_main_fd_handler_active_get (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) |
Return if read, write or error, or a combination thereof, is active on the file descriptor of the given FD handler. | |
EAPI void | ecore_main_fd_handler_active_set (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) |
Set what active streams the given FD handler should be monitoring. | |
EAPI double | ecore_time_get (void) |
Retrieves the current system time as a floating point value in seconds. | |
EAPI Ecore_Timer * | ecore_timer_add (double in, int(*func)(void *data), const void *data) |
Creates a timer to call the given function in the given period of time. | |
EAPI void * | ecore_timer_del (Ecore_Timer *timer) |
Delete the specified timer from the timer list. | |
EAPI void | ecore_timer_interval_set (Ecore_Timer *timer, double in) |
Change the interval the timer ticks of. | |
EAPI Ecore_Animator * | ecore_animator_add (int(*func)(void *data), const void *data) |
Add a animator to tick off at every animaton tick during main loop execution. | |
EAPI void * | ecore_animator_del (Ecore_Animator *animator) |
Delete the specified animator from the animator list. | |
EAPI void | ecore_animator_frametime_set (double frametime) |
Set the animator call interval in seconds. | |
EAPI double | ecore_animator_frametime_get (void) |
Get the animator call interval in seconds. | |
Variables | |
EAPI int | ECORE_EXE_EVENT_ADD |
A child process has been added. | |
EAPI int | ECORE_EXE_EVENT_DEL |
A child process has been deleted (it exited, naming consistant with the rest of ecore). | |
EAPI int | ECORE_EXE_EVENT_DATA |
Data from a child process. | |
EAPI int | ECORE_EXE_EVENT_ERROR |
Errors from a child process. |
This header provides the Ecore event handling loop. For more details, see Main Loop Functions.
For the main loop to be of any use, you need to be able to add events and event handlers. Events for file descriptor events are covered in File Event Handling Functions.
Time functions are covered in Ecore Time Functions.
There is also provision for callbacks for when the loop enters or exits an idle state. See Idle Handlers for more information.
Functions are also provided for spawning child processes using fork. See Process Spawning Functions and Spawned Process Signal Functions for more details.
enum _Ecore_Exe_Flags |
EAPI Ecore_Animator* ecore_animator_add | ( | int(*)(void *data) | func, | |
const void * | data | |||
) |
Add a animator to tick off at every animaton tick during main loop execution.
func | The function to call when it ticks off | |
data | The data to pass to the function |
func
will be called every N seconds where N is the frametime interval set by ecore_animator_frametime_set(). The function will be passed the data
pointer as its parameter.
When the animator func
is called, it must return a value of either 1 or 0. If it returns 1, it will be called again at the next tick, or if it returns 0 it will be deleted automatically making any references/handles for it invalid.
EAPI void* ecore_animator_del | ( | Ecore_Animator * | animator | ) |
Delete the specified animator from the animator list.
animator | The animator to delete |
aqnimator
from the set of animators that are executed during main loop execution. This function returns the data parameter that was being passed to the callback on success, or NULL on failure. After this call returns the specified animator object animator
is invalid and should not be used again. It will not get called again after deletion.
EAPI double ecore_animator_frametime_get | ( | void | ) |
Get the animator call interval in seconds.
EAPI void ecore_animator_frametime_set | ( | double | frametime | ) |
Set the animator call interval in seconds.
frametime | The time in seconds in between animator ticks. |
EAPI void ecore_app_args_get | ( | int * | argc, | |
char *** | argv | |||
) |
Return the programs stored command-line arguments.
argc | A pointer to the return value to hold argc | |
argv | A pointer to the return value to hold argv |
argc
will be filled, if the pointer is not NULL, and the string array pointer argv
will be filled also if the pointer is not NULL. The values they are filled with will be the same set by ecore_app_args_set().
EAPI void ecore_app_args_set | ( | int | argc, | |
const char ** | argv | |||
) |
Set up the programs command-line arguments.
argc | The same as passed as argc to the programs main() function | |
argv | The same as passed as argv to the programs main() function |
EAPI void ecore_app_restart | ( | void | ) |
Restart the program executable with the command-line arguments stored.
This function will restart & re-execute this program in place of itself using the command-line arguments stored by ecore_app_args_set(). This is an easy way for a program to restart itself for cleanup purposes, configuration reasons or in the event of a crash.
EAPI Ecore_Event* ecore_event_add | ( | int | type, | |
void * | ev, | |||
void(*)(void *data, void *ev) | func_free, | |||
void * | data | |||
) |
Add an event to the event queue.
type | The event type to add to the end of the event queue | |
ev | The private data structure for this event type | |
func_free | The function to be called to free this private structure | |
data | The data pointer to be passed to the free function |
type
will be added to the queue for processing by event handlers added by ecore_event_handler_add(). The ev
parameter will be a pointer to the event private data that is specific to that event type. When the event is no longer needed, func_free
will be called and passed the private structure pointer for cleaning up. If func_free
is NULL, free() will be called with the private structure pointer. func_free is passed data
as its data parameter.
EAPI void* ecore_event_current_event_get | ( | void | ) |
Return the current event type pointer handled.
This is useful when certain Ecore modules such as Ecore_Evas "swallow" events and not all the original information is passed on. In special cases this extra information may be useful or needed and using this call can let the program access the event data if the type of the event is handled by the program.
EAPI int ecore_event_current_type_get | ( | void | ) |
Return the current event type being handled.
This is useful when certain Ecore modules such as Ecore_Evas "swallow" events and not all the original information is passed on. In special cases this extra information may be useful or needed and using this call can let the program know if the event type being handled is one it wants to get more information about.
EAPI void* ecore_event_del | ( | Ecore_Event * | event | ) |
Delete an event from the queue.
event | The event handle to delete |
event
from the event queue, and returns the data
parameer originally set when adding it with ecore_event_add(). This does not immediately call the free function, and it may be called later on cleanup, and so if the free function depends on the data pointer to work, you should defer cleaning of this till the free function is called later.
EAPI Ecore_Event_Filter* ecore_event_filter_add | ( | void *(*)(void *data) | func_start, | |
int(*)(void *data, void *loop_data, int type, void *event) | func_filter, | |||
void(*)(void *data, void *loop_data) | func_end, | |||
const void * | data | |||
) |
Add a filter the current event queue.
func_start | Function to call just before filtering and return data | |
func_filter | Function to call on each event | |
func_end | Function to call after the queu has been filtered | |
data | Data to pass to the filter functions |
func_start
is called and passed the data
pointer. This function returns a pointer that is used as loop_data that is now passed to func_filter
as loop_data. func_filter
is also passed data
and the event type and private event structure. If this callback returns 0, the event is removed from the queue. If it returns 1, the event is kept. When processing is finished func_end
is called and is passed the loop_data and data
pointer to clean up.
EAPI void* ecore_event_filter_del | ( | Ecore_Event_Filter * | ef | ) |
Delete an event filter.
ef | The event filter handle |
ef
handle. On success this will return the data pointer set when this filter was added. On failure NULL is returned.
EAPI Ecore_Event_Handler* ecore_event_handler_add | ( | int | type, | |
int(*)(void *data, int type, void *event) | func, | |||
const void * | data | |||
) |
Add an event handler.
type | The type of the event this handler will get called for | |
func | The function to call when the event is found in the queue | |
data | A data pointer to pass to the called function func |
type
parameter is the iteger of the event type that will trigger this callback to be called. The callback func
is called when this event is processed and will be passed the event type, a pointer to the private event structure that is specific to that event type, and a data pointer that is provided in this call as the data
parameter.
When the callback func
is called, it must return 1 or 0. If it returns 1, It will keep being called as per normal, for each handler set up for that event type. If it returns 0, it will cease processing handlers for that particular event, so all handler set to handle that event type that have not already been called, will not be.
EAPI void* ecore_event_handler_del | ( | Ecore_Event_Handler * | event_handler | ) |
Delete an event handler.
event_handler | Event handler handle to delete |
data
when the handler was added by ecore_event_handler_add(). On failure NULL will be returned. Once a handler is deleted it will no longer be called.
EAPI int ecore_event_type_new | ( | void | ) |
Allocate a new event type id sensibly and return the new id.
EAPI int ecore_init | ( | void | ) |
Set up connections, signal handlers, sockets etc.
#include <Ecore.h> int main(int argc, char **argv) { if (!ecore_init()) { printf("ERROR: Cannot init Ecore!\n"); return -1; } ecore_main_loop_begin(); ecore_shutdown(); }
EAPI int ecore_shutdown | ( | void | ) |
Shut down connections, signal handlers sockets etc.
This function shuts down all things set up in ecore_init() and cleans up all event queues, handlers, filters, timers, idlers, idle enterers/exiters etc. set up after ecore_init() was called.
Do not call this function from any callback that may be called from the main loop, as the main loop will then fall over and not function properly.