add E_LIST_HANDLERS_APPEND for simplifying adding event handlers to a list
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 10 Sep 2012 08:18:12 +0000 (08:18 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 10 Sep 2012 08:18:12 +0000 (08:18 +0000)
SVN revision: 76375

src/bin/e.h

index 9d438e5..dc2cafe 100644 (file)
@@ -184,6 +184,18 @@ typedef struct _E_Rect         E_Rect;
     }                               \
   while (0)
 
+# define E_LIST_HANDLERS_APPEND(list, type, callback, data) \
+  do \
+    { \
+       Ecore_Event_Handler *_eh; \
+       _eh = ecore_event_handler_add(type, (Ecore_Event_Handler_Cb)callback, data); \
+       if (_eh) \
+         list = eina_list_append(list, _eh); \
+       else \
+         ERR("E_LIST_HANDLERS_APPEND"); \
+    } \
+  while (0)
+
 # define E_CLAMP(x, min, max) (x < min ? min : (x > max ? max : x))
 # define E_RECTS_CLIP_TO_RECT(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \
   {                                                               \