++ecore_event_handler_data_{set,get}

SVN revision: 54162
This commit is contained in:
Mike Blumenkrantz 2010-11-04 20:51:17 +00:00
parent da512dde9b
commit 8a66dd5b56
2 changed files with 41 additions and 0 deletions

View File

@ -361,6 +361,8 @@ extern "C" {
EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler);
EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
EAPI void *ecore_event_del(Ecore_Event *event);
EAPI void *ecore_event_handler_data_get(Ecore_Event_Handler *eh);
EAPI void *ecore_event_handler_data_set(Ecore_Event_Handler *eh, void *data);
EAPI int ecore_event_type_new(void);
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);
EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef);

View File

@ -170,6 +170,45 @@ ecore_event_handler_del(Ecore_Event_Handler *event_handler)
return event_handler->data;
}
/**
* @brief Get the data associated with an #Ecore_Event_Handler
* @param eh The event handler
* @return The data
* This function returns the data previously associated with @p eh.
*/
EAPI void *
ecore_event_handler_data_get(Ecore_Event_Handler *eh)
{
if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER))
{
ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_get");
return NULL;
}
return eh->data;
}
/**
* @brief Set the data associated with an #Ecore_Event_Handler
* @param eh The event handler
* @param data The data to associate
* @return The previous data
* This function sets @p data to @p eh and returns the old data pointer
* which was previously associated with @p eh.
*/
EAPI void *
ecore_event_handler_data_set(Ecore_Event_Handler *eh, void *data)
{
void *old;
if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER))
{
ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_get");
return NULL;
}
old = eh->data;
eh->data = data;
return old;
}
static void
_ecore_event_generic_free (void *data __UNUSED__, void *event)
{