Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_callback.h ewl_widget.h 


Log Message:
Slight change to callback chains to remove pointer hacks, and should help
improve output from valgrind and other memory use debuggers.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_callback.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_callback.h      9 Feb 2005 20:44:12 -0000       1.2
+++ ewl_callback.h      10 Apr 2005 05:24:09 -0000      1.3
@@ -21,16 +21,18 @@
 #define EWL_CALLBACK(callback) ((Ewl_Callback *) callback)
 
 /**
+ * A shortcut for declaring functions that take a callback funciton pointer.
+ */
+typedef void    (*Ewl_Callback_Function) (Ewl_Widget * widget, void *ev_data,
+                                         void *user_data);
+
+
+/**
  * @def EWL_CALLBACK_FUNCTION(cb_func)
  * Typecasts a pointer to an Ewl_Callback_Function pointer.
  */
 #define EWL_CALLBACK_FUNCTION(cb_func) ((Ewl_Callback_Function) cb_func)
 
-/**
- * A shortcut for declaring functions that take a callback funciton pointer.
- */
-typedef void    (*Ewl_Callback_Function) (Ewl_Widget * widget, void *ev_data,
-                                         void *user_data);
 struct Ewl_Callback
 {
        Ewl_Callback_Function func; /**< Function executed */
@@ -49,52 +51,40 @@
  * @def EWL_CALLBACK_LIST_POINTER(w, t)
  * Retrives the callback list from a widget for a certain event type.
  */
-#define EWL_CALLBACK_LIST_POINTER(w, t) \
-               (void *)((long)(w->callbacks[t]) & \
-                                       ~EWL_CALLBACK_NOTIFY_MASK)
+#define EWL_CALLBACK_LIST_POINTER(w, t) (w->callbacks[t].list)
 
 /**
  * @def EWL_CALLBACK_FLAGS(w, t)
  * Retrives the callback flags from a widget for a certain event type.
  */
-#define EWL_CALLBACK_FLAGS(w, t) \
-               ((long)(w->callbacks[t]) & \
-                                       EWL_CALLBACK_NOTIFY_MASK)
+#define EWL_CALLBACK_FLAGS(w, t) (w->callbacks[t].mask)
 /**
  * @def EWL_CALLBACK_FLAG_INTERCEPT(w, t)
  * Sets the callback intercept flag from a widget for a certain event type.
  */
 #define EWL_CALLBACK_FLAG_INTERCEPT(w, t) \
-               w->callbacks[t] = \
-                        (void *)((long)EWL_CALLBACK_LIST_POINTER(w, t) | \
-                        EWL_CALLBACK_NOTIFY_INTERCEPT)
+               w->callbacks[t].mask |= EWL_CALLBACK_NOTIFY_INTERCEPT
 
 /**
  * @def EWL_CALLBACK_FLAG_NOINTERCEPT(w, t)
  * Clears the callback intercept flag from a widget for a certain event type.
  */
 #define EWL_CALLBACK_FLAG_NOINTERCEPT(w, t) \
-               w->callbacks[t] = \
-                        (void *)((long)EWL_CALLBACK_LIST_POINTER(w, t) & \
-                        EWL_CALLBACK_NOTIFY_MASK & 
~EWL_CALLBACK_NOTIFY_INTERCEPT)
+               w->callbacks[t].mask = w->callbacks[t].mask & 
~EWL_CALLBACK_NOTIFY_INTERCEPT
 
 /**
  * @def EWL_CALLBACK_FLAG_NOTIFY(w, t)
  * Sets the callback notify flag from a widget for a certain event type.
  */
 #define EWL_CALLBACK_FLAG_NOTIFY(w, t) \
-               w->callbacks[t] = \
-                        (void *)((long)EWL_CALLBACK_LIST_POINTER(w, t) | \
-                        EWL_CALLBACK_NOTIFY_NOTIFY)
+               w->callbacks[t].mask |= EWL_CALLBACK_NOTIFY_NOTIFY
 
 /**
  * @def EWL_CALLBACK_LIST_ASSIGN(w, t, l)
  * Sets the callback list for a widget for a certain event type.
  */
 #define EWL_CALLBACK_LIST_ASSIGN(w, t, l) \
-               w->callbacks[t] = (void *)((long)l | \
-                       ((long)w->callbacks[t] & \
-                        EWL_CALLBACK_NOTIFY_MASK))
+               w->callbacks[t].list = l
 
 void            ewl_callbacks_init(void);
 void            ewl_callbacks_shutdown(void);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_widget.h        9 Feb 2005 20:44:12 -0000       1.2
+++ ewl_widget.h        10 Apr 2005 05:24:09 -0000      1.3
@@ -15,6 +15,17 @@
  */
 
 /**
+ * Callback chain container a list and bitmask of chain properties.
+ */
+typedef struct Ewl_Callback_Chain Ewl_Callback_Chain;
+
+struct Ewl_Callback_Chain
+{
+       Ecore_List *list;
+       unsigned int mask;
+};
+
+/**
  * The class that all widgets should inherit. Provides reference to a parent
  * widget/container, callbacks, and appearance information.
  */
@@ -36,7 +47,7 @@
        Ewl_Object      object; /**< Inherit the base Object class */
        Ewl_Widget     *parent; /**< The parent widget, actually a container */
 
-       Ecore_List       *callbacks[EWL_CALLBACK_MAX]; /**< Callback list array 
*/
+       Ewl_Callback_Chain callbacks[EWL_CALLBACK_MAX]; /**< Callback chain 
array */
 
        Evas_Object    *fx_clip_box; /**< Clipping rectangle of widget */
 




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to