Ecore Event functions
[Ecore - Main Loop and Job Functions.]

Functions

EAPI Ecore_Event_Handlerecore_event_handler_add (int type, Ecore_Event_Handler_Cb func, const void *data)
 Add an event handler.
EAPI void * ecore_event_handler_del (Ecore_Event_Handler *event_handler)
 Delete an event handler.
EAPI Ecore_Eventecore_event_add (int type, void *ev, Ecore_End_Cb func_free, void *data)
 Add an event to the event queue.
EAPI void * ecore_event_del (Ecore_Event *event)
 Delete an event from the queue.
EAPI void * ecore_event_handler_data_get (Ecore_Event_Handler *eh)
 Get the data associated with an Ecore_Event_Handler.
EAPI void * ecore_event_handler_data_set (Ecore_Event_Handler *eh, void *data)
 Set the data associated with an Ecore_Event_Handler.
EAPI int ecore_event_type_new (void)
 Allocate a new event type id sensibly and return the new id.
EAPI Ecore_Event_Filterecore_event_filter_add (Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, 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.

Function Documentation

EAPI Ecore_Event * ecore_event_add ( int  type,
void *  ev,
Ecore_End_Cb  func_free,
void *  data 
)

Add an event to the event queue.

Parameters:
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
Returns:
A Handle for that event

On success this function returns a handle to an event on the event queue, or NULL if it fails. If it succeeds, an event of type 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.

Referenced by ecore_exe_pipe_run(), ecore_imf_context_commit_event_add(), ecore_imf_context_delete_surrounding_event_add(), ecore_imf_context_preedit_changed_event_add(), ecore_imf_context_preedit_end_event_add(), ecore_imf_context_preedit_start_event_add(), and ecore_job_add().

EAPI void * ecore_event_current_event_get ( void   ) 

Return the current event type pointer handled.

Returns:
The current event pointer being handled if inside a handler callback

If the program is currently inside an Ecore event handler callback this will return the pointer of the current event being processed. If Ecore is not inside an event handler, NULL will be returned.

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.

Returns:
The current event type being handled if inside a handler callback

If the program is currently inside an Ecore event handler callback this will return the type of the current event being processed. If Ecore is not inside an event handler, ECORE_EVENT_NONE is returned.

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.

Parameters:
event The event handle to delete
Returns:
The data pointer originally set for the event free function

This deletes the event 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.

Referenced by ecore_job_del().

EAPI Ecore_Event_Filter * ecore_event_filter_add ( Ecore_Data_Cb  func_start,
Ecore_Filter_Cb  func_filter,
Ecore_End_Cb  func_end,
const void *  data 
)

Add a filter the current event queue.

Parameters:
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
Returns:
A filter handle

This adds a filter to call callbacks to loop through the event queue and filter events out of the queue. On failure NULL is returned. On success a Filter handle is returned. Filters are called on the queue just before Event handler processing to try and remove redundant events. Just as processing starts 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.

Referenced by ecore_x_init().

EAPI void * ecore_event_filter_del ( Ecore_Event_Filter ef  ) 

Delete an event filter.

Parameters:
ef The event filter handle
Returns:
The data set for the filter

Delete a filter that has been added by its 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,
Ecore_Event_Handler_Cb  func,
const void *  data 
)

Add an event handler.

Parameters:
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
Returns:
A new Event handler, or NULL on failure

Add an event handler to the list of handlers. This will, on success, return a handle to the event handler object that was created, that can be used later to remove the handler using ecore_event_handler_del(). The type parameter is the integer 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 (or ECORE_CALLBACK_RENEW), It will keep being called as per normal, for each handler set up for that event type. If it returns 0 (or ECORE_CALLBACK_CANCEL), 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.

Examples:
ecore_con_client_example.c, and ecore_con_server_example.c.

Referenced by ecore_ipc_init().

EAPI void * ecore_event_handler_data_get ( Ecore_Event_Handler eh  ) 

Get the data associated with an Ecore_Event_Handler.

Parameters:
eh The event handler
Returns:
The data This function returns the data previously associated with eh.
EAPI void * ecore_event_handler_data_set ( Ecore_Event_Handler eh,
void *  data 
)

Set the data associated with an Ecore_Event_Handler.

Parameters:
eh The event handler
data The data to associate
Returns:
The previous data This function sets data to eh and returns the old data pointer which was previously associated with eh.
EAPI void * ecore_event_handler_del ( Ecore_Event_Handler event_handler  ) 

Delete an event handler.

Parameters:
event_handler Event handler handle to delete
Returns:
Data passed to handler

Delete a specified event handler from the handler list. On success this will delete the event handler and return the pointer passed as 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.

Referenced by ecore_ipc_shutdown().

EAPI int ecore_event_type_new ( void   ) 

Allocate a new event type id sensibly and return the new id.

Returns:
A new event type id.

This function allocates a new event type id and returns it. Once an event type has been allocated it can never be de-allocated during the life of the program. There is no guarantee of the contents of this event ID, or how it is calculated, except that the ID will be unique to the current instance of the process.

Referenced by ecore_con_url_init(), ecore_imf_init(), ecore_ipc_init(), ecore_sdl_init(), and ecore_x_init().