++ecore_event_handler_data_{set,get}
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 4 Nov 2010 20:51:17 +0000 (20:51 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 4 Nov 2010 20:51:17 +0000 (20:51 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@54162 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore/Ecore.h
src/lib/ecore/ecore_events.c

index b786de6..c96babd 100644 (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);
index 0c788cd..8256d94 100644 (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)
 {