From: <enl...@li...> - 2003-04-08 00:23:37
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore Modified Files: Tag: SPLIT ecore_events.c Log Message: Don't try to access the pointer if it doesn't exist. I'm not sure if this stops the segfault i was getting, but i'm not sure if i fixed it correctly. Is the Ecore_Evenet_Exe_Exit passed in as data or is it supposed to be ev? =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_events.c,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -3 -r1.1.2.10 -r1.1.2.11 --- ecore_events.c 5 Mar 2003 22:40:26 -0000 1.1.2.10 +++ ecore_events.c 8 Apr 2003 00:23:34 -0000 1.1.2.11 @@ -424,8 +424,11 @@ Ecore_Event_Exe_Exit *e; e = data; - if (e->exe) _ecore_exe_free(e->exe); - free(e); + if(e) + { + if (e->exe) _ecore_exe_free(e->exe); + free(e); + } } void * |
From: <enl...@li...> - 2003-04-15 20:35:31
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: Tag: SPLIT Ecore_X.h Log Message: That should be a Window event... (typedef fix) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/Ecore_X.h,v retrieving revision 1.1.2.23 retrieving revision 1.1.2.24 diff -u -3 -r1.1.2.23 -r1.1.2.24 --- Ecore_X.h 15 Apr 2003 11:38:49 -0000 1.1.2.23 +++ Ecore_X.h 15 Apr 2003 20:35:28 -0000 1.1.2.24 @@ -71,7 +71,7 @@ typedef struct _Ecore_X_Event_Window_Focus_Out Ecore_X_Event_Window_Focus_Out; typedef struct _Ecore_X_Event_Window_Keymap Ecore_X_Event_Window_Keymap; typedef struct _Ecore_X_Event_Window_Damage Ecore_X_Event_Window_Damage; -typedef struct _Ecore_X_Event_Window_Visibility_Change Ecore_X_Event_Visibility_Change; +typedef struct _Ecore_X_Event_Window_Visibility_Change Ecore_X_Event_Window_Visibility_Change; typedef struct _Ecore_X_Event_Window_Create Ecore_X_Event_Window_Create; typedef struct _Ecore_X_Event_Window_Destroy Ecore_X_Event_Window_Destroy; typedef struct _Ecore_X_Event_Window_Hide Ecore_X_Event_Window_Hide; |
From: <enl...@li...> - 2003-08-09 04:17:19
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_evas Modified Files: Tag: SPLIT ecore_evas.c Log Message: Documentation. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_evas/Attic/ecore_evas.c,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -u -3 -r1.1.2.19 -r1.1.2.20 --- ecore_evas.c 16 Jul 2003 04:49:07 -0000 1.1.2.19 +++ ecore_evas.c 9 Aug 2003 04:16:48 -0000 1.1.2.20 @@ -46,9 +46,10 @@ } /** - * To be documented. + * Free an Ecore_Evas + * @param ee The Ecore_Evas to free * - * FIXME: To be fixed. + * This frees up any memory used by the Ecore_Evas. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -80,9 +81,12 @@ #define IFE return;} /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas resize events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is resized. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -100,9 +104,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas move events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is moved. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -120,9 +127,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas show events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is shown. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -140,9 +150,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas hide events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is hidden. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -160,9 +173,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas delete request events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee gets a delete request. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -180,9 +196,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas destroy events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is destroyed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -200,9 +219,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas focus in events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee gets focus. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -220,9 +242,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas focus out events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee loses focus. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -240,9 +265,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas mouse in events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever the mouse enters @p ee. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -260,9 +288,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas mouse out events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever the mouse leaves @p ee. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -280,9 +311,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas mouse pre render events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called just before the evas in @p ee is rendered. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -300,9 +334,12 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set a callback for Ecore_Evas mouse post render events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called just after the evas in @p ee is rendered. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -320,9 +357,11 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Get an Ecore_Evas's Evas + * @param ee The Ecore_Evas whose Evas you wish to get + * @return The Evas wrapped by @p ee + * + * This function returns the Evas contained within @p ee. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ Evas * @@ -338,9 +377,12 @@ } /** - * To be documented. + * Move an Ecore_Evas + * @param ee The Ecore_Evas to move + * @param x The x coordinate to move to + * @param y The y coordinate to move to * - * FIXME: To be fixed. + * This moves @p ee to the screen coordinates (@p x, @p y) * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -357,9 +399,12 @@ } /** - * To be documented. + * Resize an Ecore_Evas + * @param ee The Ecore_Evas to move + * @param w The w coordinate to resize to + * @param h The h coordinate to resize to * - * FIXME: To be fixed. + * This resizes @p ee to @p w x @p h * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -386,9 +431,16 @@ } /** - * To be documented. + * Resize an Ecore_Evas + * @param ee The Ecore_Evas to move + * @param x The x coordinate to move to + * @param y The y coordinate to move to + * @param w The w coordinate to resize to + * @param h The h coordinate to resize to + * + * This moves @p ee to the screen coordinates (@p x, @p y) and resizes + * it to @p w x @p h. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -415,9 +467,21 @@ } /** - * To be documented. + * Get the geometry of an Ecore_Evas + * @param ee The Ecore_Evas whose geometry y + * @param x A pointer to an int to place the x coordinate in + * @param y A pointer to an int to place the y coordinate in + * @param w A pointer to an int to place the w size in + * @param h A pointer to an int to place the h size in + * + * This function takes four pointers to (already allocated) ints, and places + * the geometry of @p ee in them. + * + * @code + * int x, y, w, h; + * ecore_evas_geometry_get(ee, &x, &y, &w, &h); + * @endcode * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -446,9 +510,13 @@ } /** - * To be documented. + * Set the rotation of an Ecore_Evas' window + * + * @param ee The Ecore_Evas + * @param rot the angle (in degrees) of rotation. * - * FIXME: To be fixed. + * The allowed values of @p rot depend on the engine being used. Most only + * allow multiples of 90. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -468,9 +536,11 @@ } /** - * To be documented. + * Set the rotation of an Ecore_Evas' window + * + * @param ee The Ecore_Evas + * @return the angle (in degrees) of rotation. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -486,9 +556,16 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set whether an Ecore_Evas is shaped or not. + * @param ee The Ecore_Evas to shape + * @param shaped 1 to shape, 0 to not + * + * This function allows one to make an Ecore_Evas shaped to the contents of the + * evas. If @p shaped is 1, @p ee will be transparent in parts of the evas that + * contain no objects. If @p shaped is 0, then @p ee will be rectangular, and + * and parts with no data will show random framebuffer artifacting. For + * non-shaped Ecore_Evases, it is recommend to cover the entire evas with a + * background object. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -505,9 +582,11 @@ } /** - * To be documented. + * Query whether an Ecore_Evas is shaped or not. + * @param ee The Ecore_Evas to query. + * @return 1 if shaped, 0 if not. * - * FIXME: To be fixed. + * This function returns 1 if @p ee is shaped, and 0 if not. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -523,9 +602,10 @@ } /** - * To be documented. + * Show an Ecore_Evas' window + * @param ee The Ecore_Evas to show. * - * FIXME: To be fixed. + * This function makes @p ee visible. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -542,9 +622,10 @@ } /** - * To be documented. + * Hide an Ecore_Evas' window + * @param ee The Ecore_Evas to show. * - * FIXME: To be fixed. + * This function makes @p ee hidden. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -561,9 +642,11 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window is visible or not. + * @param ee The Ecore_Evas to query. + * @return 1 if visible, 0 if not. * - * FIXME: To be fixed. + * This function queries @p ee and returns 1 if it is visible, and 0 if not. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -579,9 +662,10 @@ } /** - * To be documented. + * Raise and Ecore_Evas' window. + * @param ee The Ecore_Evas to raise. * - * FIXME: To be fixed. + * This functions raises the Ecore_Evas to the front. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -598,9 +682,10 @@ } /** - * To be documented. + * Lower an Ecore_Evas' window. + * @param ee The Ecore_Evas to raise. * - * FIXME: To be fixed. + * This functions lowers the Ecore_Evas to the back. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -617,9 +702,11 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set the title of an Ecore_Evas' window + * @param ee The Ecore_Evas whose title you wish to set. + * @param t The title + * + * This function sets the title of @p ee to @p t. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -636,9 +723,11 @@ } /** - * To be documented. + * Get the title of an Ecore_Evas' window + * @param ee The Ecore_Evas whose title you wish to get. + * @return The title of @p ee. * - * FIXME: To be fixed. + * This function returns the title of @p ee. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ const char * @@ -654,9 +743,12 @@ } /** - * To be documented. + * Set the name and class of an Ecore_Evas' window + * @param ee the Ecore_Evas + * @param n the name + * @param c the class * - * FIXME: To be fixed. + * This function sets the name of @p ee to @p n, and its class to @p c. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -673,9 +765,13 @@ } /** - * To be documented. + * Get the name and class of an Ecore_Evas' window + * @p ee The Ecore_Evas to query + * @p n A pointer to a string to place the name in. + * @p c A pointer to a string to place the class in. * - * FIXME: To be fixed. + * This function gets puts the name of @p ee into @p n, and its class into + * @p c. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -692,9 +788,12 @@ } /** - * To be documented. + * Set the min size of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @param w The minimum width + * @param h The minimum height * - * FIXME: To be fixed. + * This function sets the minimum size of @p ee to @p w x @p h. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -721,9 +820,12 @@ } /** - * To be documented. + * Get the min size of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @param w A pointer to an int to place the min width in. + * @param h A pointer to an int to place the min height in. * - * FIXME: To be fixed. + * This function puts the minimum size of @p ee into @p w and @p h. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -748,9 +850,12 @@ } /** - * To be documented. + * Set the max size of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @param w The maximum width + * @param h The maximum height * - * FIXME: To be fixed. + * This function sets the maximum size of @p ee to @p w x @p h. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -777,9 +882,12 @@ } /** - * To be documented. + * Get the max size of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @param w A pointer to an int to place the max width in. + * @param h A pointer to an int to place the max height in. * - * FIXME: To be fixed. + * This function puts the maximum size of @p ee into @p w and @p h. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -804,9 +912,12 @@ } /** - * To be documented. + * Set the base size of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @param w The base width + * @param h The base height * - * FIXME: To be fixed. + * This function sets the base size of @p ee to @p w x @p h. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -833,9 +944,12 @@ } /** - * To be documented. + * Get the base size of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @param w A pointer to an int to place the base width in. + * @param h A pointer to an int to place the base height in. * - * FIXME: To be fixed. + * This function puts the base size of @p ee into @p w and @p h. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -860,9 +974,13 @@ } /** - * To be documented. + * Set the step size of an Ecore_Evas + * @param ee The Ecore_Evas to set + * @param w The step width + * @param h The step height * - * FIXME: To be fixed. + * This function sets the step size of @p ee to @p w x @p h. This limits the + * size of an Ecore_Evas to always being an integer multiple of the step size. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -889,9 +1007,12 @@ } /** - * To be documented. + * Get the step size of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @param w A pointer to an int to place the step width in. + * @param h A pointer to an int to place the step height in. * - * FIXME: To be fixed. + * This function puts the step size of @p ee into @p w and @p h. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -916,9 +1037,16 @@ } /** - * To be documented. - * - * FIXME: To be fixed. + * Set the cursor of an Ecore_Evas + * @param ee The Ecore_Evas + * @param file The path to an image file for the cursor + * @param hot_x The x coordinate of the cursor's hot spot + * @param hot_y The y coordinate of the cursor's hot spot + * + * This function makes the mouse cursor over @p ee be the image specified by + * @p file. The actual point within the image that the mouse is at is specified + * by @p hot_x and @p hot_y, which are coordinates with respect to the top left + * corner of the cursor image. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -935,9 +1063,14 @@ } /** - * To be documented. + * Get information about an Ecore_Evas' cursor + * @param ee The Ecore_Evas to set + * @param file A pointer to a string to place the cursor file name in. + * @param layer A pointer to an int to place the cursor's layer in.. + * @param hot_x A pointer to an int to place the cursor's hot_x coordinate in. + * @param hot_y A pointer to an int to place the cursor's hot_y coordinate in. * - * FIXME: To be fixed. + * This function queries information about an Ecore_Evas' cursor. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -956,9 +1089,11 @@ } /** - * To be documented. + * Set the layer of an Ecore_Evas' window + * @param ee The Ecore_Evas + * @param layer The layer to put @p ee on. * - * FIXME: To be fixed. + * This function moves @p ee to the layer @p layer. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -975,9 +1110,10 @@ } /** - * To be documented. + * Get the layer of an Ecore_Evas' window + * @param ee The Ecore_Evas to set + * @return the layer @p ee's window is on. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -993,9 +1129,11 @@ } /** - * To be documented. + * Set the focus of an Ecore_Evas' window + * @param ee The Ecore_Evas + * @param on 1 for focus, 0 to defocus. * - * FIXME: To be fixed. + * This function focuses @p ee if @p on is 1, or defocuses @p ee if @p on is 0. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -1012,9 +1150,10 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window is focused or not + * @param ee The Ecore_Evas to set + * @return 1 if @p ee if focused, 0 if not. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -1030,9 +1169,12 @@ } /** - * To be documented. + * Iconify or uniconify an Ecore_Evas' window + * @param ee The Ecore_Evas + * @param on 1 to iconify, 0 to uniconify. * - * FIXME: To be fixed. + * This function iconifies @p ee if @p on is 1, or uniconifies @p ee if @p on + * is 0. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -1049,9 +1191,10 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window is iconified or not + * @param ee The Ecore_Evas to set + * @return 1 if @p ee is iconified, 0 if not. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -1067,9 +1210,12 @@ } /** - * To be documented. + * Set whether an Ecore_Evas' window is borderless or not + * @param ee The Ecore_Evas + * @param on 1 for borderless, 0 for bordered. * - * FIXME: To be fixed. + * This function makes @p ee borderless if @p on is 1, or bordered if @p on + * is 0. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -1086,9 +1232,10 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window is borderless or not + * @param ee The Ecore_Evas to set + * @return 1 if @p ee is borderless, 0 if not. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -1104,9 +1251,12 @@ } /** - * To be documented. + * Tell the WM whether or not to ignore an Ecore_Evas' window + * @param ee The Ecore_Evas + * @param on 1 to ignore, 0 to not. * - * FIXME: To be fixed. + * This function causes the window manager to ignore @p ee if @p on is 1, + * or not ignore @p ee if @p on is 0. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -1123,9 +1273,10 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window is overridden or not + * @param ee The Ecore_Evas to set + * @return 1 if @p ee is overridden, 0 if not. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -1141,9 +1292,12 @@ } /** - * To be documented. + * Maximize (or unmaximize) an Ecore_Evas' window + * @param ee The Ecore_Evas + * @param on 1 to maximize, 0 to unmaximize. * - * FIXME: To be fixed. + * This function maximizes @p ee if @p on is 1, or unmaximizes @p ee + * if @p on is 0. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -1160,9 +1314,10 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window is maximized or not + * @param ee The Ecore_Evas to set + * @return 1 if @p ee is maximized, 0 if not. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -1178,9 +1333,12 @@ } /** - * To be documented. + * Set whether or not an Ecore_Evas' window is fullscreen + * @param ee The Ecore_Evas + * @param on 1 fullscreen, 0 not. * - * FIXME: To be fixed. + * This function causes @p ee to be fullscreen if @p on is 1, + * or not if @p on is 0. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -1197,9 +1355,10 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window is fullscreen or not + * @param ee The Ecore_Evas to set + * @return 1 if @p ee is fullscreen, 0 if not. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int @@ -1214,10 +1373,14 @@ return ee->prop.fullscreen; } -/** - * To be documented. +/** + * Set whether or not an Ecore_Evas' window should avoid damage * - * FIXME: To be fixed. + * @param ee The Ecore_Evas + * @param on 1 to avoid damage, 0 to not + * + * This function causes @p ee to be drawn to a pixmap to avoid recalculations. + * On expose events it will copy from the pixmap to the window. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ void @@ -1234,9 +1397,10 @@ } /** - * To be documented. + * Query whether an Ecore_Evas' window avoids damage or not + * @param ee The Ecore_Evas to set + * @return 1 if @p ee avoids damage, 0 if not. * - * FIXME: To be fixed. * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> */ int |
From: <enl...@li...> - 2004-02-06 18:51:38
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: edb.c Log Message: make sure that the file actually gets writting on save. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/edb.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- edb.c 20 Jan 2004 16:19:45 -0000 1.7 +++ edb.c 6 Feb 2004 18:48:55 -0000 1.8 @@ -114,6 +114,7 @@ } e_db_close(db); + e_db_flush(); return 1; } |
From: <enl...@li...> - 2004-02-13 17:13:30
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_config Modified Files: edb.c Log Message: use static buf's and snprintf =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/edb.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- edb.c 6 Feb 2004 18:48:55 -0000 1.8 +++ edb.c 13 Feb 2004 17:07:45 -0000 1.9 @@ -4,19 +4,18 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <limits.h> int ecore_config_load(void) { - char* file = malloc(1024); /* ### fixme */ - sprintf(file,"%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); + char file[PATH_MAX]; + snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); return ecore_config_load_file(file); - free(file); } int ecore_config_save(void) { - char* file = malloc(1024); /* ### fixme */ - sprintf(file,"%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); + char file[PATH_MAX]; + snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.db",getenv("HOME"),__app_name); return ecore_config_save_file(file); - free(file); } int ecore_config_load_file(char *file) { |
From: <enl...@li...> - 2005-09-06 00:52:50
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: ecore_x_window_prop.c Log Message: change this cast to an int so things will work on both 32 _and_ 64 bit processors. now all of us with athlon-64's can restart E without losing the desktop positions of all our windows :) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -3 -r1.73 -r1.74 --- ecore_x_window_prop.c 16 Aug 2005 08:40:55 -0000 1.73 +++ ecore_x_window_prop.c 6 Sep 2005 00:52:43 -0000 1.74 @@ -63,7 +63,7 @@ if (num_ret < len) len = num_ret; for (i = 0; i < len; i++) - val[i] = ((unsigned long *)prop_ret)[i]; + val[i] = ((unsigned int *)prop_ret)[i]; num = len; } else |
From: <enl...@li...> - 2005-09-06 03:25:11
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: ecore_x_window_prop.c Log Message: So, according to raster and the XGetWindowProperty man page, this should in fact be a long, not an int. (though this is still broken under ubuntu-64 here) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.74 retrieving revision 1.75 diff -u -3 -r1.74 -r1.75 --- ecore_x_window_prop.c 6 Sep 2005 00:52:43 -0000 1.74 +++ ecore_x_window_prop.c 6 Sep 2005 03:25:05 -0000 1.75 @@ -63,7 +63,7 @@ if (num_ret < len) len = num_ret; for (i = 0; i < len; i++) - val[i] = ((unsigned int *)prop_ret)[i]; + val[i] = ((unsigned long*)prop_ret)[i]; num = len; } else |
From: <enl...@li...> - 2005-09-06 03:43:13
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: ecore_x_window_prop.c Log Message: Get this fixed the proper way... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -3 -r1.75 -r1.76 --- ecore_x_window_prop.c 6 Sep 2005 03:25:05 -0000 1.75 +++ ecore_x_window_prop.c 6 Sep 2005 03:43:02 -0000 1.76 @@ -19,20 +19,16 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom, unsigned int *val, unsigned int num) { -#if SIZEOF_INT == 4 - _ATOM_SET_CARD32(win, atom, val, num); -#else - CARD32 *c32; + long *v2; unsigned int i; - c32 = malloc(num * sizeof(CARD32)); - if (!c32) + v2 = malloc(num * sizeof(long)); + if (!v2) return; for (i = 0; i < num; i++) - c32[i] = val[i]; - _ATOM_SET_CARD32(win, atom, c32, num); - free(c32); -#endif + v2[i] = val[i]; + _ATOM_SET_CARD32(win, atom, v2, num); + free(v2); } /* @@ -62,8 +58,10 @@ { if (num_ret < len) len = num_ret; + for (i = 0; i < len; i++) val[i] = ((unsigned long*)prop_ret)[i]; + num = len; } else |
From: <enl...@li...> - 2005-09-07 22:16:54
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: ecore_x_window_prop.c Log Message: avoid the malloc / copy routine when int's and longs are the same size =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -3 -r1.76 -r1.77 --- ecore_x_window_prop.c 6 Sep 2005 03:43:02 -0000 1.76 +++ ecore_x_window_prop.c 7 Sep 2005 22:16:49 -0000 1.77 @@ -22,6 +22,9 @@ long *v2; unsigned int i; +#if SIZEOF_INT == SIZEOF_LONG + _ATOM_SET_CARD32(win, atom, val, num); +#else v2 = malloc(num * sizeof(long)); if (!v2) return; @@ -29,6 +32,8 @@ v2[i] = val[i]; _ATOM_SET_CARD32(win, atom, v2, num); free(v2); +#endif + } /* |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:24:55
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Modified Files: Ecore_DBus.h Makefile.am ecore_dbus.c ecore_dbus_message.c ecore_dbus_methods.c ecore_dbus_private.h ecore_dbus_utils.c Log Message: Add abstract socket namespace support to ecore_con. Lots of work on ecore_dbus Hilights: - get the socket address for system/session/startup busses from the environment - can request/release a bus name - receive method calls (we need to add a way to register callbacks for specific methods) - send signals and method replies (untested) *** API BREAKAGE *** ecore_dbus_message_new_method_call() - the 'destination' param has moved to after the 'method' param to keep things consistent with newly supported message types and the param ordering in the spec. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/Ecore_DBus.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- Ecore_DBus.h 27 Jul 2006 15:28:44 -0000 1.15 +++ Ecore_DBus.h 24 Sep 2006 07:24:52 -0000 1.16 @@ -3,7 +3,9 @@ */ #ifndef _ECORE_DBUS_H #define _ECORE_DBUS_H -#endif + +#include "Ecore_Data.h" +#include "Ecore_Con.h" #ifdef EAPI #undef EAPI @@ -36,18 +38,13 @@ typedef struct _Ecore_DBus_Event_Server_Add Ecore_DBus_Event_Server_Add; typedef struct _Ecore_DBus_Event_Server_Del Ecore_DBus_Event_Server_Del; typedef struct _Ecore_DBus_Event_Server_Data Ecore_DBus_Event_Server_Data; - typedef struct _Ecore_DBus_Event_Server_Data Ecore_DBus_Event_Server_Signal; + typedef struct _Ecore_DBus_Event_Server_Data Ecore_DBus_Event_Signal; + typedef struct _Ecore_DBus_Event_Server_Data Ecore_DBus_Event_Method_Call; typedef struct _Ecore_DBus_Event_Server_Data Ecore_DBus_Method_Return; typedef struct _Ecore_DBus_Message Ecore_DBus_Message; typedef struct _Ecore_DBus_Message_Arg Ecore_DBus_Message_Arg; typedef struct _Ecore_DBus_Message_Field Ecore_DBus_Message_Field; - - typedef enum _Ecore_DBus_Type - { - ECORE_DBUS_BUS_SESSION, - ECORE_DBUS_BUS_SYSTEM, - ECORE_DBUS_BUS_ACTIVATION - } Ecore_DBus_Type; + typedef struct _Ecore_DBus_Address Ecore_DBus_Address; typedef enum _Ecore_DBus_Message_Type { @@ -58,6 +55,12 @@ ECORE_DBUS_MESSAGE_TYPE_SIGNAL } Ecore_DBus_Message_Type; + typedef enum _Ecore_DBus_Message_Flag + { + ECORE_DBUS_MESSAGE_FLAG_NO_REPLY_EXPECTED, + ECORE_DBUS_MESSAGE_FLAG_NO_AUTO_START + } Ecore_DBus_Message_Flag; + typedef enum _Ecore_DBus_Data_Type { ECORE_DBUS_DATA_TYPE_INVALID = ((int) '\0'), @@ -130,9 +133,18 @@ ECORE_DBUS_HEADER_FIELD_SIGNATURE } Ecore_DBus_Message_Header_Field; + + struct _Ecore_DBus_Address + { + char *transport; + Ecore_List *keys; + Ecore_List *vals; + }; + EAPI extern int ECORE_DBUS_EVENT_SERVER_ADD; EAPI extern int ECORE_DBUS_EVENT_SERVER_DEL; - EAPI extern int ECORE_DBUS_EVENT_SERVER_SIGNAL; + EAPI extern int ECORE_DBUS_EVENT_METHOD_CALL; + EAPI extern int ECORE_DBUS_EVENT_SIGNAL; /* callback */ typedef void (*Ecore_DBus_Method_Return_Cb)(void *data, Ecore_DBus_Method_Return *reply); @@ -143,19 +155,39 @@ EAPI int ecore_dbus_shutdown(void); /* connection */ - EAPI Ecore_DBus_Server *ecore_dbus_server_connect(Ecore_DBus_Type type, char *name, int port, const void *data); + EAPI Ecore_DBus_Server *ecore_dbus_server_system_connect(const void *data); + EAPI Ecore_DBus_Server *ecore_dbus_server_session_connect(const void *data); + EAPI Ecore_DBus_Server *ecore_dbus_server_starter_connect(const void *data); + + EAPI Ecore_DBus_Server *ecore_dbus_server_connect(Ecore_Con_Type type, const char *name, int port, const void *data); + + EAPI void ecore_dbus_server_del(Ecore_DBus_Server *svr); /* message */ EAPI int ecore_dbus_server_send(Ecore_DBus_Server *svr, char *command, int length); - EAPI unsigned int ecore_dbus_message_new_method_call(Ecore_DBus_Server *svr, - char *destination, char *path, - char *interface, char *method, - Ecore_DBus_Method_Return_Cb method_cb, - Ecore_DBus_Error_Cb error_cb, - void *data, - char *fmt, ...); + + EAPI unsigned int ecore_dbus_message_new_method_call(Ecore_DBus_Server *svr, + char *path, char *interface, + char *method, char *destination, + Ecore_DBus_Method_Return_Cb method_cb, + Ecore_DBus_Error_Cb error_cb, + void *data, + char *signature, ...); + EAPI unsigned int ecore_dbus_message_new_method_return(Ecore_DBus_Server *svr, + int reply_serial, char *destination, + char *signature, ...); + EAPI unsigned int ecore_dbus_message_new_error(Ecore_DBus_Server *svr, + char *error_name, + int reply_serial, char *destination, + char *signature, ...); + EAPI unsigned int ecore_dbus_message_new_signal(Ecore_DBus_Server *svr, + char *path, + char *interface, char *signal_name, + char *destination, void *data, + char *signature, ...); + EAPI void ecore_dbus_message_del(Ecore_DBus_Message *msg); EAPI void ecore_dbus_message_print(Ecore_DBus_Message *msg); EAPI void *ecore_dbus_message_header_field_get(Ecore_DBus_Message *msg, Ecore_DBus_Message_Header_Field field); @@ -170,7 +202,22 @@ EAPI int ecore_dbus_method_get_connection_unix_user(Ecore_DBus_Server *svr, char *connection, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb, void *data); EAPI int ecore_dbus_method_add_match(Ecore_DBus_Server *svr, char *match, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb, void *data); EAPI int ecore_dbus_method_remove_match(Ecore_DBus_Server *svr, char *match, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb, void *data); + EAPI int ecore_dbus_method_request_name(Ecore_DBus_Server *svr, char *name, int flags, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb, void *data); + EAPI int ecore_dbus_method_release_name(Ecore_DBus_Server *svr, char *name, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb, void *data); + + /* addresses */ + EAPI Ecore_DBus_Address *ecore_dbus_address_new(); + EAPI void ecore_dbus_address_free(Ecore_DBus_Address *address); + + EAPI Ecore_List *ecore_dbus_address_parse(const char *address); + + EAPI char *ecore_dbus_address_value_get(Ecore_DBus_Address *address, + char *key); + EAPI void ecore_dbus_print_address_list(Ecore_List *addresses); + EAPI Ecore_DBus_Server *ecore_dbus_address_list_connect(Ecore_List *addrs, const void *data); + EAPI Ecore_DBus_Server *ecore_dbus_address_connect(Ecore_DBus_Address *addr, const void *data); #ifdef __cplusplus } +#endif #endif =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- Makefile.am 25 Jul 2006 14:34:47 -0000 1.6 +++ Makefile.am 24 Sep 2006 07:24:52 -0000 1.7 @@ -26,6 +26,7 @@ ecore_dbus_unmarshal.c \ ecore_dbus_methods.c \ ecore_dbus_utils.c \ +ecore_dbus_address.c \ ecore_dbus_private.h libecore_dbus_la_LIBADD = \ =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- ecore_dbus.c 27 Jul 2006 15:34:16 -0000 1.22 +++ ecore_dbus.c 24 Sep 2006 07:24:52 -0000 1.23 @@ -1,6 +1,7 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#include "config.h" #include "Ecore.h" #include "ecore_private.h" #include "Ecore_Con.h" @@ -11,7 +12,8 @@ /* About */ /********************************************************************************/ /* Author: Jorge Luis Zapata */ -/* Version: 0.2.1 */ +/* Author: Brian Mattern (rephorm) */ +/* Version: 0.3.0 */ /********************************************************************************/ /* Todo */ /********************************************************************************/ @@ -37,12 +39,16 @@ /* */ /* 29-03-05 */ /* 0.2.1 some segfault fixes, new tests */ +/* 0.3.0 add ability to send signals, receive method class and respond to them */ +/* add address parsing and functions to connect to standard busses */ +/* change API of ecore_dbus_message_new_method_call() */ /* global variables */ EAPI int ECORE_DBUS_EVENT_SERVER_ADD = 0; EAPI int ECORE_DBUS_EVENT_SERVER_DEL = 0; -EAPI int ECORE_DBUS_EVENT_SERVER_SIGNAL = 0; +EAPI int ECORE_DBUS_EVENT_SIGNAL = 0; +EAPI int ECORE_DBUS_EVENT_METHOD_CALL = 0; /* private function declaration */ @@ -89,7 +95,8 @@ ECORE_DBUS_EVENT_SERVER_ADD = ecore_event_type_new(); ECORE_DBUS_EVENT_SERVER_DEL = ecore_event_type_new(); - ECORE_DBUS_EVENT_SERVER_SIGNAL = ecore_event_type_new(); + ECORE_DBUS_EVENT_SIGNAL = ecore_event_type_new(); + ECORE_DBUS_EVENT_METHOD_CALL = ecore_event_type_new(); handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _ecore_dbus_event_server_add, NULL); @@ -118,37 +125,103 @@ return init_count; } +/** + * Connect to the system bus. + */ EAPI Ecore_DBus_Server * -ecore_dbus_server_connect(Ecore_DBus_Type compl_type, char *name, int port, +ecore_dbus_server_system_connect(const void *data) +{ + Ecore_List *addrs; + Ecore_DBus_Server *svr; + char *bus_env; + + /* get the system bus address from the environment */ + bus_env = getenv("DBUS_SYSTEM_BUS_ADDRESS"); + if (bus_env) + { + addrs = ecore_dbus_address_parse(bus_env); + if (addrs) + { + svr = ecore_dbus_address_list_connect(addrs, data); + ecore_list_destroy(addrs); + if (svr) return svr; + } + } + + /* if we haven't returned already, try the default location */ + return ecore_dbus_server_connect(ECORE_CON_LOCAL_SYSTEM, "/var/run/dbus/system_bus_socket", -1, data); +} + +/** + * Connect to the session bus. + */ +EAPI Ecore_DBus_Server * +ecore_dbus_server_session_connect(const void *data) +{ + Ecore_List *addrs; + Ecore_DBus_Server *svr; + char *bus_env; + + /* get the session bus address from the environment */ + bus_env = getenv("DBUS_SESSION_BUS_ADDRESS"); + if (bus_env) + { + addrs = ecore_dbus_address_parse(bus_env); + if (addrs) + { + svr = ecore_dbus_address_list_connect(addrs, data); + ecore_list_destroy(addrs); + if (svr) return svr; + } + } + + /* + * XXX try getting address from _DBUS_SESSION_BUS_ADDRESS property (STRING) set + * on the root window + */ + + return NULL; +} + +EAPI Ecore_DBus_Server * +ecore_dbus_server_starter_connect(const void *data) +{ + Ecore_List *addrs; + Ecore_DBus_Server *svr; + char *bus_env; + + /* get the session bus address from the environment */ + bus_env = getenv("DBUS_STARTER_ADDRESS"); + if (bus_env) + { + addrs = ecore_dbus_address_parse(bus_env); + if (addrs) + { + svr = ecore_dbus_address_list_connect(addrs, data); + ecore_list_destroy(addrs); + if (svr) return svr; + } + } + return NULL; +} + + +EAPI Ecore_DBus_Server * +ecore_dbus_server_connect(Ecore_Con_Type con_type, const char *name, int port, const void *data) { + /* XXX data isn't used! */ Ecore_DBus_Server *svr; - Ecore_DBus_Type type; - Ecore_Con_Type extra = 0; - + svr = calloc(1, sizeof(Ecore_DBus_Server)); if (!svr) return NULL; - type = compl_type; - switch (type) - { -#if 0 - /* Get address from DBUS_SESSION_BUS_ADDRESS env */ - case ECORE_DBUS_BUS_SESSION: - svr->server = - ecore_con_server_connect(ECORE_CON_LOCAL_USER | extra, name, port, svr); - break; -#endif - case ECORE_DBUS_BUS_SYSTEM: - svr->server = - ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM | extra, name, port, svr); - break; - default: - free(svr); - return NULL; - } + + svr->server = + ecore_con_server_connect(con_type, name, port, svr); + if (!svr->server) { - printf("Couldn't connect to server\n"); + fprintf(stderr, "Ecore_DBus Error: Couldn't connect to server\n"); free(svr); return NULL; } @@ -373,7 +446,7 @@ } else { - printf("Ecore_DBus: Reply without reply serial!\n"); + printf("[ecore_dbus] Reply without reply serial!\n"); } if (sent) _ecore_dbus_message_free(sent); _ecore_dbus_event_server_data_free(NULL, ev2); @@ -391,7 +464,7 @@ } else { - printf("Ecore_DBus: Error without reply serial!\n"); + printf("[ecore_dbus] Error without reply serial!\n"); } if (sent) _ecore_dbus_message_free(sent); _ecore_dbus_event_server_data_free(NULL, ev2); @@ -400,7 +473,14 @@ { Ecore_DBus_Event_Server_Data *ev2; ev2 = _ecore_dbus_event_create(svr, msg); - ecore_event_add(ECORE_DBUS_EVENT_SERVER_SIGNAL, ev2, + ecore_event_add(ECORE_DBUS_EVENT_SIGNAL, ev2, + _ecore_dbus_event_server_data_free, NULL); + } + else if (msg->type == ECORE_DBUS_MESSAGE_TYPE_METHOD_CALL) + { + Ecore_DBus_Event_Server_Data *ev2; + ev2 = _ecore_dbus_event_create(svr, msg); + ecore_event_add(ECORE_DBUS_EVENT_METHOD_CALL, ev2, _ecore_dbus_event_server_data_free, NULL); } else @@ -410,7 +490,7 @@ } } } - return 0; + return 1; } static void =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_message.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ecore_dbus_message.c 27 Jul 2006 15:28:44 -0000 1.8 +++ ecore_dbus_message.c 24 Sep 2006 07:24:52 -0000 1.9 @@ -8,7 +8,18 @@ #include "Ecore_DBus.h" #include "ecore_dbus_private.h" -static void _ecore_dbus_message_common_header(Ecore_DBus_Message *msg, int type, int flags); +/* message helpers */ +static Ecore_DBus_Message *_ecore_dbus_message_create(Ecore_DBus_Server *svr, + int type, int flags, char *path, char *interface, + char *member, char *error_name, int reply_serial, + char *destination, char *signature, va_list args); +static void _ecore_dbus_message_header(Ecore_DBus_Message *msg, int type, + int flags, char *path, char *interface, + char *member, char *error_name, int reply_serial, + char *destination, char *format); +static void _ecore_dbus_message_body(Ecore_DBus_Message *msg, + char *signature, va_list args); + static void _ecore_dbus_message_field_free(void *data); /* printing functions */ @@ -16,108 +27,167 @@ static void _ecore_dbus_message_header_field_print(Ecore_DBus_Message_Field_Container *arr); static void _ecore_dbus_message_print_raw(Ecore_DBus_Message *msg); +/* + * Message types and allowed fields (* indicates required field): + * + * METHOD_CALL + * *path + * interface + * member + * destination + * signature + * + * METHOD_RETURN + * member + * *reply_serial + * destination + * signature + * + * ERROR + * *error_name + * *reply_serial + * destination + * signature + * + * SIGNAL + * *path + * *interface + * *member + * destination + * signature + * + */ +EAPI unsigned int +ecore_dbus_message_new_method_return(Ecore_DBus_Server *svr, int reply_serial, + char *destination, char *signature, ...) +{ + va_list args; + Ecore_DBus_Message *msg; + + va_start(args, signature); + msg = _ecore_dbus_message_create(svr, ECORE_DBUS_MESSAGE_TYPE_METHOD_RETURN, 0, NULL, NULL, NULL, NULL, reply_serial, destination, signature, args); + va_end(args); + + ecore_dbus_server_send(svr, (char *)msg->buffer, msg->length); + ecore_hash_set(svr->messages, (void *)msg->serial, msg); + + return msg->serial; +} + EAPI unsigned int -ecore_dbus_message_new_method_call(Ecore_DBus_Server *svr, char *destination, - char *path, char *interface, char *method, +ecore_dbus_message_new_error(Ecore_DBus_Server *svr, char *error_name, + int reply_serial, char *destination, + char *signature, ...) +{ + va_list args; + Ecore_DBus_Message *msg; + + va_start(args, signature); + msg = _ecore_dbus_message_create(svr, ECORE_DBUS_MESSAGE_TYPE_ERROR, 0, NULL, NULL, NULL, error_name, reply_serial, destination, signature, args); + va_end(args); + + ecore_dbus_server_send(svr, (char *)msg->buffer, msg->length); + ecore_hash_set(svr->messages, (void *)msg->serial, msg); + + return msg->serial; +} + +EAPI unsigned int +ecore_dbus_message_new_signal(Ecore_DBus_Server *svr, char *path, + char *interface, char *signal_name, + char *destination, void *data, + char *signature, ...) +{ + va_list args; + Ecore_DBus_Message *msg; + + va_start(args, signature); + msg = _ecore_dbus_message_create(svr, ECORE_DBUS_MESSAGE_TYPE_SIGNAL, 0, path, interface, signal_name, NULL, 0, destination, signature, args); + va_end(args); + + ecore_dbus_server_send(svr, (char *)msg->buffer, msg->length); + ecore_hash_set(svr->messages, (void *)msg->serial, msg); + + return msg->serial; +} + +EAPI unsigned int +ecore_dbus_message_new_method_call(Ecore_DBus_Server *svr, + char *path, char *interface, + char *method, char *destination, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb error_cb, void *data, - char *fmt, ...) + char *signature, ...) { - unsigned int body_start; - char buf[1024]; - Ecore_DBus_Message_Field_Array *arr; + va_list args; + Ecore_DBus_Message *msg; + int flags = 0; if (!method) return 0; - /* init message */ - Ecore_DBus_Message *msg = _ecore_dbus_message_new(svr); - if (method_cb) + if (!method_cb && !error_cb) flags |= ECORE_DBUS_MESSAGE_FLAG_NO_REPLY_EXPECTED; + + va_start(args, signature); + msg = _ecore_dbus_message_create(svr, ECORE_DBUS_MESSAGE_TYPE_METHOD_CALL, flags, path, interface, method, NULL, 0, destination, signature, args); + va_end(args); + + if (method_cb || error_cb) { msg->cb.method_return = method_cb; msg->cb.error = error_cb; msg->cb.data = data; } - /* common header */ - _ecore_dbus_message_common_header(msg, ECORE_DBUS_MESSAGE_TYPE_METHOD_CALL, 0); - - arr = _ecore_dbus_message_marshal_array_begin(msg, ECORE_DBUS_DATA_TYPE_STRUCT); - /* custom header */ - if (path) - { - Ecore_DBus_Message_Field_Struct *s; - - s = _ecore_dbus_message_marshal_struct_begin(msg); - _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_PATH); - _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_OBJECT_PATH, path); - _ecore_dbus_message_marshal_struct_end(msg, s); - } - if (destination) - { - Ecore_DBus_Message_Field_Struct *s; - - s = _ecore_dbus_message_marshal_struct_begin(msg); - _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_DESTINATION); - _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_STRING, destination); - _ecore_dbus_message_marshal_struct_end(msg, s); - } - if (interface) - { - Ecore_DBus_Message_Field_Struct *s; + /* send message */ + ecore_dbus_server_send(svr, (char *)msg->buffer, msg->length); + ecore_hash_set(svr->messages, (void *)msg->serial, msg); - s = _ecore_dbus_message_marshal_struct_begin(msg); - _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_INTERFACE); - _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_STRING, interface); - _ecore_dbus_message_marshal_struct_end(msg, s); - } - if (method) - { - Ecore_DBus_Message_Field_Struct *s; + return msg->serial; +} - s = _ecore_dbus_message_marshal_struct_begin(msg); - _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_MEMBER); - _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_STRING, method); - _ecore_dbus_message_marshal_struct_end(msg, s); - } - if (fmt) - { - Ecore_DBus_Message_Field_Struct *s; +static Ecore_DBus_Message * +_ecore_dbus_message_create(Ecore_DBus_Server *svr, int type, int flags, char *path, char *interface, char *member, char *error_name, int reply_serial, char *destination, char *signature, va_list args) +{ + /* init message */ + Ecore_DBus_Message *msg; + + msg = _ecore_dbus_message_new(svr); + _ecore_dbus_message_header(msg, type, flags, path, interface, member, error_name, reply_serial, destination, signature); + _ecore_dbus_message_body(msg, signature, args); - s = _ecore_dbus_message_marshal_struct_begin(msg); - _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_SIGNATURE); - _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_SIGNATURE, fmt); - _ecore_dbus_message_marshal_struct_end(msg, s); - } - _ecore_dbus_message_marshal_array_end(msg, arr); - msg->header = ecore_list_remove_first(msg->fields); - _ecore_dbus_message_padding(msg, 8); + /* show message */ + //ecore_dbus_message_print(msg); + return msg; +} +static void +_ecore_dbus_message_body(Ecore_DBus_Message *msg, char *signature, va_list args) +{ + unsigned int body_start; /* message body */ body_start = msg->length; - if (fmt) + if (signature) { - va_list ap; - va_start(ap, fmt); - while (*fmt) + while (*signature) { - Ecore_DBus_Data_Type type = *fmt; + Ecore_DBus_Data_Type type = *signature; switch (type) { case ECORE_DBUS_DATA_TYPE_BYTE: - _ecore_dbus_message_marshal_byte(msg, va_arg(ap, int)); + _ecore_dbus_message_marshal_byte(msg, va_arg(args, int)); break; case ECORE_DBUS_DATA_TYPE_UINT32: - _ecore_dbus_message_marshal_uint32(msg, va_arg(ap, unsigned int)); + _ecore_dbus_message_marshal_uint32(msg, va_arg(args, unsigned int)); break; case ECORE_DBUS_DATA_TYPE_STRING: - _ecore_dbus_message_marshal_string(msg, (char *)va_arg(ap, char *)); + _ecore_dbus_message_marshal_string(msg, (char *)va_arg(args, char *)); break; case ECORE_DBUS_DATA_TYPE_OBJECT_PATH: - _ecore_dbus_message_marshal_object_path(msg, (char *)va_arg(ap, char *)); + _ecore_dbus_message_marshal_object_path(msg, (char *)va_arg(args, char *)); break; case ECORE_DBUS_DATA_TYPE_SIGNATURE: - _ecore_dbus_message_marshal_signature(msg, (char *)va_arg(ap, char *)); + _ecore_dbus_message_marshal_signature(msg, (char *)va_arg(args, char *)); break; case ECORE_DBUS_DATA_TYPE_INVALID: case ECORE_DBUS_DATA_TYPE_BOOLEAN: @@ -138,27 +208,14 @@ #if 0 default: #endif - printf("[ecore_dbus] unknown/unhandled data type %c\n", *fmt); + printf("[ecore_dbus] unknown/unhandled data type %c\n", *signature); break; } - fmt++; + signature++; } - va_end(ap); } /* set body length */ *(unsigned int *)(msg->buffer + 4) = msg->length - body_start; - - /* show message */ - //ecore_dbus_message_print(msg); - /* send message */ - ecore_dbus_server_send(svr, (char *)msg->buffer, msg->length); - if (interface) - snprintf(buf, sizeof(buf), "%s.%s", interface, method); - else - strcpy(buf, method); - ecore_hash_set(svr->messages, (void *)msg->serial, msg); - - return msg->serial; } EAPI void @@ -375,14 +432,22 @@ /* header functions */ static void -_ecore_dbus_message_common_header(Ecore_DBus_Message *msg, int type, int flags) +_ecore_dbus_message_header(Ecore_DBus_Message *msg, int type, int flags, + char *path, char *interface, char *member, + char *error_name, int reply_serial, + char *destination, char *signature) { - /* endiannes (1) */ + Ecore_DBus_Message_Field_Array *arr; + + if (!msg) return; + + /* endianness (1) */ + /* XXX we need to detect for endianess and send 'B' for Bigendian machines */ msg->buffer[0] = msg->byte_order = 'l'; /* type (1) */ msg->buffer[1] = msg->type = (char)type; /* flags (1) 0x1 = no reply expected, 0x2 auto activation */ - msg->buffer[2] = msg->flags = 0x0; + msg->buffer[2] = msg->flags = flags; /* protocol (1) */ msg->buffer[3] = msg->protocol = ECORE_DBUS_MAJOR_PROTOCOL_VERSION; /* autoincrement the client_serial (0 is invalid) */ @@ -390,6 +455,61 @@ *(unsigned int *)(msg->buffer + 8) = msg->serial = msg->server->cnt_msg; msg->length = 12; + + /* header fields */ + arr = _ecore_dbus_message_marshal_array_begin(msg, ECORE_DBUS_DATA_TYPE_STRUCT); + if (path) + { + Ecore_DBus_Message_Field_Struct *s; + + s = _ecore_dbus_message_marshal_struct_begin(msg); + _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_PATH); + _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_OBJECT_PATH, path); + _ecore_dbus_message_marshal_struct_end(msg, s); + } + if (interface) + { + Ecore_DBus_Message_Field_Struct *s; + + s = _ecore_dbus_message_marshal_struct_begin(msg); + _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_INTERFACE); + _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_STRING, interface); + _ecore_dbus_message_marshal_struct_end(msg, s); + } + if (member) + { + Ecore_DBus_Message_Field_Struct *s; + + s = _ecore_dbus_message_marshal_struct_begin(msg); + _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_MEMBER); + _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_STRING, member); + _ecore_dbus_message_marshal_struct_end(msg, s); + } + if (destination) + { + Ecore_DBus_Message_Field_Struct *s; + + s = _ecore_dbus_message_marshal_struct_begin(msg); + _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_DESTINATION); + _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_STRING, destination); + _ecore_dbus_message_marshal_struct_end(msg, s); + } + if (signature) + { + Ecore_DBus_Message_Field_Struct *s; + + s = _ecore_dbus_message_marshal_struct_begin(msg); + _ecore_dbus_message_marshal_byte(msg, ECORE_DBUS_HEADER_FIELD_SIGNATURE); + _ecore_dbus_message_marshal_variant(msg, ECORE_DBUS_DATA_TYPE_SIGNATURE, signature); + _ecore_dbus_message_marshal_struct_end(msg, s); + } + _ecore_dbus_message_marshal_array_end(msg, arr); + + /* move the header fields to the header */ + msg->header = ecore_list_remove_last(msg->fields); + + /* pad to an 8 bit boundary */ + _ecore_dbus_message_padding(msg, 8); } static void @@ -581,3 +701,4 @@ printf("\n"); printf("[ecore_dbus] end raw message\n"); } + =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_methods.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- ecore_dbus_methods.c 27 Jul 2006 15:28:44 -0000 1.5 +++ ecore_dbus_methods.c 24 Sep 2006 07:24:52 -0000 1.6 @@ -20,10 +20,10 @@ return 0; } return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "Hello" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, NULL /*fmt*/); } @@ -35,10 +35,10 @@ void *data) { return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "ListNames" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, NULL /*fmt*/); } @@ -50,10 +50,10 @@ void *data) { return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "NameHasOwner" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, "s" /*fmt*/, name); } @@ -65,10 +65,10 @@ void *data) { return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "StartServiceByName" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, "su" /*fmt*/, name, flags); } @@ -80,10 +80,10 @@ void *data) { return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "GetNameOwner" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, "s" /*fmt*/, name); } @@ -95,10 +95,10 @@ void *data) { return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "GetConnectionUnixUser" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, "s" /*fmt*/, connection); } @@ -110,10 +110,10 @@ void *data) { return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "AddMatch" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, "s" /*fmt*/, match); } @@ -125,10 +125,40 @@ void *data) { return ecore_dbus_message_new_method_call(svr, - "org.freedesktop.DBus" /*destination*/, "/org/freedesktop/DBus" /*path*/, "org.freedesktop.DBus" /*interface*/, "RemoveMatch" /*method*/, + "org.freedesktop.DBus" /*destination*/, method_cb, error_cb, data, "s" /*fmt*/, match); +} + +EAPI int +ecore_dbus_method_request_name(Ecore_DBus_Server *svr, char *name, int flags, + Ecore_DBus_Method_Return_Cb method_cb, + Ecore_DBus_Error_Cb error_cb, + void *data) +{ + return ecore_dbus_message_new_method_call(svr, + "/org/freedesktop/DBus" /*path*/, + "org.freedesktop.DBus" /*interface*/, + "RequestName" /*method*/, + "org.freedesktop.DBus" /*destination*/, + method_cb, error_cb, data, + "su" /*fmt*/, name, flags); +} + +EAPI int +ecore_dbus_method_release_name(Ecore_DBus_Server *svr, char *name, + Ecore_DBus_Method_Return_Cb method_cb, + Ecore_DBus_Error_Cb error_cb, + void *data) +{ + return ecore_dbus_message_new_method_call(svr, + "/org/freedesktop/DBus" /*path*/, + "org.freedesktop.DBus" /*interface*/, + "RequestName" /*method*/, + "org.freedesktop.DBus" /*destination*/, + method_cb, error_cb, data, + "s" /*fmt*/, name); } =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_private.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ecore_dbus_private.h 27 Jul 2006 15:28:44 -0000 1.12 +++ ecore_dbus_private.h 24 Sep 2006 07:24:52 -0000 1.13 @@ -4,6 +4,9 @@ #ifndef _ECORE_DBUS_PRIVATE_H #define _ECORE_DBUS_PRIVATE_H +#include "Ecore_Con.h" +#include "Ecore_Data.h" + typedef unsigned char *(*Ecore_DBus_Auth_Transaction)(void *); typedef struct _Ecore_DBus_Auth Ecore_DBus_Auth; @@ -56,7 +59,7 @@ struct _Ecore_DBus_Server { - Ecore_List2 __list_data; + Ecore_List2 __list_data; Ecore_Con_Server *server; int authenticated; int auth_type; =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_utils.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ecore_dbus_utils.c 27 Jul 2006 13:29:44 -0000 1.4 +++ ecore_dbus_utils.c 24 Sep 2006 07:24:52 -0000 1.5 @@ -202,3 +202,4 @@ } return NULL; } + |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:25:24
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore Modified Files: AUTHORS configure.in Log Message: Add abstract socket namespace support to ecore_con. Lots of work on ecore_dbus Hilights: - get the socket address for system/session/startup busses from the environment - can request/release a bus name - receive method calls (we need to add a way to register callbacks for specific methods) - send signals and method replies (untested) *** API BREAKAGE *** ecore_dbus_message_new_method_call() - the 'destination' param has moved to after the 'method' param to keep things consistent with newly supported message types and the param ordering in the spec. =================================================================== RCS file: /cvs/e/e17/libs/ecore/AUTHORS,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- AUTHORS 3 Jan 2006 00:18:42 -0000 1.20 +++ AUTHORS 24 Sep 2006 07:24:51 -0000 1.21 @@ -18,3 +18,4 @@ Michael 'Mickey' Lauer <mi...@tm...> David 'onefang' Seikel <on...@gm...> Hisham 'CodeWarrior' Mardam Bey <hi...@hi...> +Brian 'rephorm' Mattern <re...@re...> =================================================================== RCS file: /cvs/e/e17/libs/ecore/configure.in,v retrieving revision 1.151 retrieving revision 1.152 diff -u -3 -r1.151 -r1.152 --- configure.in 17 Aug 2006 23:41:47 -0000 1.151 +++ configure.in 24 Sep 2006 07:24:51 -0000 1.152 @@ -889,6 +889,11 @@ ) fi +AC_ABSTRACT_SOCKET_TEST( + [AC_DEFINE(HAVE_ABSTRACT_SOCKETS, 1, [Have abstract socket namespace])], + [] +) + want_ecore_ipc="yes"; have_ecore_ipc="no"; ecore_ipc_cflags=""; |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:25:24
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/bin Modified Files: Makefile.am ecore_dbus_hal_test.c ecore_dbus_test.c Log Message: Add abstract socket namespace support to ecore_con. Lots of work on ecore_dbus Hilights: - get the socket address for system/session/startup busses from the environment - can request/release a bus name - receive method calls (we need to add a way to register callbacks for specific methods) - send signals and method replies (untested) *** API BREAKAGE *** ecore_dbus_message_new_method_call() - the 'destination' param has moved to after the 'method' param to keep things consistent with newly supported message types and the param ordering in the spec. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/bin/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- Makefile.am 26 Jul 2006 20:43:28 -0000 1.21 +++ Makefile.am 24 Sep 2006 07:24:51 -0000 1.22 @@ -95,7 +95,8 @@ ecore_evas_test \ ecore_config \ ecore_dbus_test \ -ecore_dbus_hal_test +ecore_dbus_hal_test \ +ecore_dbus_receiver_test ecore_test_SOURCES = \ ecore_test.c @@ -200,3 +201,19 @@ $(top_builddir)/src/lib/ecore/libecore.la \ $(ECORE_DBUS_LIB) + +ecore_dbus_receiver_test_SOURCES = \ +ecore_dbus_receiver_test.c \ +ecore_dbus_test.h + +ecore_dbus_receiver_test_LDADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(ECORE_DBUS_LIB) + +ecore_dbus_receiver_test_CFLAGS = \ +$(CFLAGS) \ +$(INCLUDES) + +ecore_dbus_receiver_test_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(ECORE_DBUS_LIB) =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/bin/ecore_dbus_hal_test.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ecore_dbus_hal_test.c 27 Jul 2006 15:28:43 -0000 1.4 +++ ecore_dbus_hal_test.c 24 Sep 2006 07:24:51 -0000 1.5 @@ -23,8 +23,7 @@ { ecore_dbus_init(); - svr = ecore_dbus_server_connect(ECORE_DBUS_BUS_SYSTEM, - "/var/run/dbus/system_dbus_socket", -1, NULL); + svr = ecore_dbus_server_system_connect(NULL); if (!svr) { printf("Couldn't connect to dbus system server!\n"); @@ -40,7 +39,7 @@ ecore_dbus_event_server_add, NULL); handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_DEL, ecore_dbus_event_server_del, NULL); - handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_SIGNAL, + handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SIGNAL, ecore_dbus_event_server_signal, NULL); ecore_main_loop_begin(); @@ -126,7 +125,7 @@ static int ecore_dbus_event_server_signal(void *udata, int ev_type, void *ev) { - Ecore_DBus_Event_Server_Signal *event; + Ecore_DBus_Event_Signal *event; event = ev; printf("ecore_dbus_event_server_signal %s %s.%s\n", event_type_get(event->type), =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/bin/ecore_dbus_test.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ecore_dbus_test.c 27 Jul 2006 15:34:15 -0000 1.11 +++ ecore_dbus_test.c 24 Sep 2006 07:24:51 -0000 1.12 @@ -9,6 +9,7 @@ static int ecore_dbus_event_server_del(void *udata, int ev_type, void *ev); static void ecore_dbus_method_list_names_cb(void *data, Ecore_DBus_Method_Return *reply); +static void ecore_dbus_method_test_cb(void *data, Ecore_DBus_Method_Return *reply); static void ecore_dbus_method_error_cb(void *data, const char *error); static const char *event_type_get(Ecore_DBus_Message_Type type); @@ -18,12 +19,13 @@ int main(int argc, char **argv) { + char *bus_addr = NULL, *socket_name = NULL; ecore_dbus_init(); - svr = ecore_dbus_server_connect(ECORE_DBUS_BUS_SYSTEM, - "/var/run/dbus/system_dbus_socket", -1, NULL); + + svr = ecore_dbus_server_session_connect(NULL); if (!svr) { - printf("Couldn't connect to dbus system server!\n"); + printf("Couldn't connect to dbus system server (%s)!\n", socket_name); } else { @@ -59,11 +61,11 @@ ecore_dbus_method_list_names_cb, ecore_dbus_method_error_cb, NULL); ecore_dbus_message_new_method_call(event->server, - "org.freedesktop.DBus" /*destination*/, - "/org/freedesktop/DBus" /*path*/, - "org.freedesktop.DBus" /*interface*/, - "ListName" /*method*/, - ecore_dbus_method_list_names_cb, + "/org/enlightenment/Test" /*path*/, + "org.enlightenment.Test" /*interface*/, + "Test" /*method*/, + "org.enlightenment.Test" /*destination*/, + ecore_dbus_method_test_cb, ecore_dbus_method_error_cb, NULL, NULL /*fmt*/); return 0; @@ -79,6 +81,13 @@ svr = NULL; ecore_main_loop_quit(); return 0; +} + +static void +ecore_dbus_method_test_cb(void *data, + Ecore_DBus_Method_Return *reply) +{ + printf("test reply cb\n"); } static void |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:25:25
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_con Modified Files: Ecore_Con.h ecore_con.c ecore_con_private.h Log Message: Add abstract socket namespace support to ecore_con. Lots of work on ecore_dbus Hilights: - get the socket address for system/session/startup busses from the environment - can request/release a bus name - receive method calls (we need to add a way to register callbacks for specific methods) - send signals and method replies (untested) *** API BREAKAGE *** ecore_dbus_message_new_method_call() - the 'destination' param has moved to after the 'method' param to keep things consistent with newly supported message types and the param ordering in the spec. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/Ecore_Con.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- Ecore_Con.h 30 Mar 2006 06:48:45 -0000 1.18 +++ Ecore_Con.h 24 Sep 2006 07:24:52 -0000 1.19 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _ECORE_CON_H #define _ECORE_CON_H @@ -69,9 +72,14 @@ typedef enum _Ecore_Con_Type { ECORE_CON_LOCAL_USER, - ECORE_CON_LOCAL_SYSTEM, - ECORE_CON_REMOTE_SYSTEM, - ECORE_CON_USE_SSL = 16 + ECORE_CON_LOCAL_SYSTEM, +#ifdef HAVE_ABSTRACT_SOCKETS + ECORE_CON_LOCAL_ABSTRACT, +#endif + ECORE_CON_REMOTE_SYSTEM +#ifdef USE_OPENSSL + ,ECORE_CON_USE_SSL = 16 +#endif } Ecore_Con_Type; #endif =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -3 -r1.78 -r1.79 --- ecore_con.c 20 Jul 2006 16:47:02 -0000 1.78 +++ ecore_con.c 24 Sep 2006 07:24:52 -0000 1.79 @@ -53,6 +53,7 @@ static int ssl_init_count = 0; #define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path)) +#define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + (size_t)(((struct sockaddr_un *)NULL)->sun_path)) /** * @defgroup Ecore_Con_Lib_Group Ecore Connection Library Functions @@ -168,18 +169,24 @@ /* unset the SSL flag for the following checks */ type &= ~ECORE_CON_USE_SSL; #endif - + if ((type == ECORE_CON_LOCAL_USER) || - (type == ECORE_CON_LOCAL_SYSTEM)) + (type == ECORE_CON_LOCAL_SYSTEM) +#ifdef HAVE_ABSTRACT_SOCKETS + || (type == ECORE_CON_LOCAL_ABSTRACT) +#endif + ) { const char *homedir; struct stat st; mode_t pmode, mask; + int socket_unix_len; if (!name) goto error; mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH; + if (type == ECORE_CON_LOCAL_USER) { homedir = getenv("HOME"); @@ -229,11 +236,28 @@ goto error; } socket_unix.sun_family = AF_UNIX; - strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); - if (bind(svr->fd, (struct sockaddr *)&socket_unix, LENGTH_OF_SOCKADDR_UN(&socket_unix)) < 0) +#ifdef HAVE_ABSTRACT_SOCKET + if (type == ECORE_CON_LOCAL_ABSTRACT) + { + /* . is a placeholder */ + snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name); + /* first char null indicates abstract namespace */ + socket_unix.sun_path[0] = '\0'; + socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name); + } + else + { + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); + } +#else + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); +#endif + if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) { if (connect(svr->fd, (struct sockaddr *)&socket_unix, - LENGTH_OF_SOCKADDR_UN(&socket_unix)) < 0) + socket_unix_len) < 0) { if ((type == ECORE_CON_LOCAL_USER) || (type == ECORE_CON_LOCAL_SYSTEM)) @@ -401,9 +425,14 @@ if ((type == ECORE_CON_REMOTE_SYSTEM) && (port < 0)) return NULL; if ((type == ECORE_CON_LOCAL_USER) || - (type == ECORE_CON_LOCAL_SYSTEM)) + (type == ECORE_CON_LOCAL_SYSTEM) +#ifdef HAVE_ABSTRACT_SOCKETS + || (type == ECORE_CON_LOCAL_ABSTRACT) +#endif + ) { const char *homedir; + int socket_unix_len; if (type == ECORE_CON_LOCAL_USER) { @@ -435,8 +464,26 @@ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error; if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) goto error; socket_unix.sun_family = AF_UNIX; - strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); - if (connect(svr->fd, (struct sockaddr *)&socket_unix, LENGTH_OF_SOCKADDR_UN(&socket_unix)) < 0) goto error; + +#ifdef HAVE_ABSTRACT_SOCKETS + if (type == ECORE_CON_LOCAL_ABSTRACT) + { + /* copy name insto sun_path, prefixed by null to indicate abstract namespace */ + snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name); + socket_unix.sun_path[0] = '\0'; + socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name); + } + else + { + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); + } +#else + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); +#endif + + if (connect(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) goto error; svr->path = strdup(buf); if (!svr->path) goto error; svr->fd_handler = ecore_main_fd_handler_add(svr->fd, =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con_private.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ecore_con_private.h 20 Mar 2006 07:45:58 -0000 1.14 +++ ecore_con_private.h 24 Sep 2006 07:24:52 -0000 1.15 @@ -27,6 +27,9 @@ { ECORE_CON_LOCAL_USER, ECORE_CON_LOCAL_SYSTEM, +#ifdef HAVE_ABSTRACT_SOCKETS + ECORE_CON_LOCAL_ABSTRACT, +#endif ECORE_CON_REMOTE_SYSTEM #if USE_OPENSSL ,ECORE_CON_USE_SSL = 16 |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:28:09
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Added Files: ecore_dbus_address.c Log Message: missed a few files |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:28:09
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/m4 Added Files: ac_abstract_socket.m4 Log Message: missed a few files |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:28:39
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/bin Modified Files: .cvsignore Added Files: ecore_dbus_receiver_test.c Log Message: missed a few files =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/bin/.cvsignore,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- .cvsignore 27 Jul 2006 15:38:47 -0000 1.4 +++ .cvsignore 24 Sep 2006 07:28:07 -0000 1.5 @@ -7,3 +7,4 @@ ecore_test ecore_dbus_test ecore_dbus_hal_test +ecore_dbus_receiver_test |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:35:53
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_con Modified Files: Ecore_Con.h Log Message: don't include ifdefs in the main header =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/Ecore_Con.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- Ecore_Con.h 24 Sep 2006 07:24:52 -0000 1.19 +++ Ecore_Con.h 24 Sep 2006 07:35:50 -0000 1.20 @@ -73,13 +73,9 @@ { ECORE_CON_LOCAL_USER, ECORE_CON_LOCAL_SYSTEM, -#ifdef HAVE_ABSTRACT_SOCKETS ECORE_CON_LOCAL_ABSTRACT, -#endif ECORE_CON_REMOTE_SYSTEM -#ifdef USE_OPENSSL ,ECORE_CON_USE_SSL = 16 -#endif } Ecore_Con_Type; #endif |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:53:49
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_con Modified Files: Ecore_Con.h ecore_con.c ecore_con_private.h Log Message: cleaner handling of optional features =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/Ecore_Con.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- Ecore_Con.h 24 Sep 2006 07:35:50 -0000 1.20 +++ Ecore_Con.h 24 Sep 2006 07:53:47 -0000 1.21 @@ -74,8 +74,8 @@ ECORE_CON_LOCAL_USER, ECORE_CON_LOCAL_SYSTEM, ECORE_CON_LOCAL_ABSTRACT, - ECORE_CON_REMOTE_SYSTEM - ,ECORE_CON_USE_SSL = 16 + ECORE_CON_REMOTE_SYSTEM, + ECORE_CON_USE_SSL = 16 } Ecore_Con_Type; #endif =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -3 -r1.79 -r1.80 --- ecore_con.c 24 Sep 2006 07:24:52 -0000 1.79 +++ ecore_con.c 24 Sep 2006 07:53:47 -0000 1.80 @@ -171,11 +171,8 @@ #endif if ((type == ECORE_CON_LOCAL_USER) || - (type == ECORE_CON_LOCAL_SYSTEM) -#ifdef HAVE_ABSTRACT_SOCKETS - || (type == ECORE_CON_LOCAL_ABSTRACT) -#endif - ) + (type == ECORE_CON_LOCAL_SYSTEM) || + (type == ECORE_CON_LOCAL_ABSTRACT)) { const char *homedir; struct stat st; @@ -236,24 +233,25 @@ goto error; } socket_unix.sun_family = AF_UNIX; -#ifdef HAVE_ABSTRACT_SOCKET if (type == ECORE_CON_LOCAL_ABSTRACT) { +#ifdef HAVE_ABSTRACT_SOCKET /* . is a placeholder */ snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name); /* first char null indicates abstract namespace */ socket_unix.sun_path[0] = '\0'; socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name); +#else + fprintf(stderr, "Your system does not support abstract sockets!\n"); + umask(pmode); + goto error; +#endif } else { strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); } -#else - strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); - socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); -#endif if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) { if (connect(svr->fd, (struct sockaddr *)&socket_unix, @@ -425,11 +423,8 @@ if ((type == ECORE_CON_REMOTE_SYSTEM) && (port < 0)) return NULL; if ((type == ECORE_CON_LOCAL_USER) || - (type == ECORE_CON_LOCAL_SYSTEM) -#ifdef HAVE_ABSTRACT_SOCKETS - || (type == ECORE_CON_LOCAL_ABSTRACT) -#endif - ) + (type == ECORE_CON_LOCAL_SYSTEM) || + (type == ECORE_CON_LOCAL_ABSTRACT)) { const char *homedir; int socket_unix_len; @@ -465,23 +460,23 @@ if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) goto error; socket_unix.sun_family = AF_UNIX; -#ifdef HAVE_ABSTRACT_SOCKETS if (type == ECORE_CON_LOCAL_ABSTRACT) { +#ifdef HAVE_ABSTRACT_SOCKETS /* copy name insto sun_path, prefixed by null to indicate abstract namespace */ snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name); socket_unix.sun_path[0] = '\0'; socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name); +#else + fprintf(stderr, "Your system does not support abstract sockets!\n"); + goto error; +#endif } else { strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); } -#else - strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); - socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); -#endif if (connect(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) goto error; svr->path = strdup(buf); =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con_private.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- ecore_con_private.h 24 Sep 2006 07:24:52 -0000 1.15 +++ ecore_con_private.h 24 Sep 2006 07:53:47 -0000 1.16 @@ -27,13 +27,9 @@ { ECORE_CON_LOCAL_USER, ECORE_CON_LOCAL_SYSTEM, -#ifdef HAVE_ABSTRACT_SOCKETS ECORE_CON_LOCAL_ABSTRACT, -#endif - ECORE_CON_REMOTE_SYSTEM -#if USE_OPENSSL - ,ECORE_CON_USE_SSL = 16 -#endif + ECORE_CON_REMOTE_SYSTEM, + ECORE_CON_USE_SSL = 16 } Ecore_Con_Type; struct _Ecore_Con_Client |
From: Enlightenment C. <no...@cv...> - 2006-09-24 07:53:50
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Modified Files: ecore_dbus_address.c Log Message: cleaner handling of optional features =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_address.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ecore_dbus_address.c 24 Sep 2006 07:28:07 -0000 1.1 +++ ecore_dbus_address.c 24 Sep 2006 07:53:47 -0000 1.2 @@ -184,13 +184,11 @@ type = ECORE_CON_LOCAL_SYSTEM; name = ecore_dbus_address_value_get(addr, "path"); -#ifdef HAVE_ABSTRACT_SOCKETS if (!name) { name = ecore_dbus_address_value_get(addr, "abstract"); type = ECORE_CON_LOCAL_ABSTRACT; } -#endif if (!name) return NULL; port = -1; |
From: Enlightenment C. <no...@cv...> - 2006-09-25 01:53:53
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Modified Files: ecore_dbus.c Log Message: oops. didn't mean to change this =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- ecore_dbus.c 24 Sep 2006 08:06:57 -0000 1.24 +++ ecore_dbus.c 25 Sep 2006 01:53:47 -0000 1.25 @@ -490,7 +490,7 @@ } } } - return 1; + return 0; } static void |
From: Enlightenment C. <no...@cv...> - 2006-09-25 05:21:15
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_con Modified Files: ecore_con.c Log Message: copy the name into the buffer so that svr->path gets set correctly later =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -3 -r1.81 -r1.82 --- ecore_con.c 24 Sep 2006 08:16:01 -0000 1.81 +++ ecore_con.c 25 Sep 2006 05:21:14 -0000 1.82 @@ -207,6 +207,10 @@ else snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", name, port); } + else if (type == ECORE_CON_LOCAL_ABSTRACT) + { + strncpy(buf, name, sizeof(buf)); + } pmode = umask(mask); start: svr->fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -453,6 +457,11 @@ snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", name, port); } } + else if (type == ECORE_CON_LOCAL_ABSTRACT) + { + strncpy(buf, name, sizeof(buf)); + } + svr->fd = socket(AF_UNIX, SOCK_STREAM, 0); if (svr->fd < 0) goto error; if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error; |
From: Enlightenment C. <no...@cv...> - 2006-09-25 05:24:48
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Modified Files: Ecore_DBus.h Log Message: add const =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/Ecore_DBus.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- Ecore_DBus.h 24 Sep 2006 07:24:52 -0000 1.16 +++ Ecore_DBus.h 25 Sep 2006 05:24:47 -0000 1.17 @@ -211,7 +211,7 @@ EAPI Ecore_List *ecore_dbus_address_parse(const char *address); - EAPI char *ecore_dbus_address_value_get(Ecore_DBus_Address *address, + EAPI const char *ecore_dbus_address_value_get(Ecore_DBus_Address *address, char *key); EAPI void ecore_dbus_print_address_list(Ecore_List *addresses); EAPI Ecore_DBus_Server *ecore_dbus_address_list_connect(Ecore_List *addrs, const void *data); |
From: Enlightenment C. <no...@cv...> - 2006-09-25 05:30:50
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Modified Files: Ecore_DBus.h ecore_dbus_address.c Log Message: const on key also namespace static functions for the hell of it properly encode/decode address values add function to print address as a string =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/Ecore_DBus.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- Ecore_DBus.h 25 Sep 2006 05:24:47 -0000 1.17 +++ Ecore_DBus.h 25 Sep 2006 05:30:48 -0000 1.18 @@ -210,9 +210,9 @@ EAPI void ecore_dbus_address_free(Ecore_DBus_Address *address); EAPI Ecore_List *ecore_dbus_address_parse(const char *address); + EAPI char *ecore_dbus_address_string(Ecore_DBus_Address *address); - EAPI const char *ecore_dbus_address_value_get(Ecore_DBus_Address *address, - char *key); + EAPI const char *ecore_dbus_address_value_get(Ecore_DBus_Address *address, const char *key); EAPI void ecore_dbus_print_address_list(Ecore_List *addresses); EAPI Ecore_DBus_Server *ecore_dbus_address_list_connect(Ecore_List *addrs, const void *data); EAPI Ecore_DBus_Server *ecore_dbus_address_connect(Ecore_DBus_Address *addr, const void *data); =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_address.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ecore_dbus_address.c 24 Sep 2006 07:53:47 -0000 1.2 +++ ecore_dbus_address.c 25 Sep 2006 05:30:48 -0000 1.3 @@ -8,9 +8,16 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> +#include <ctype.h> + +static void _ecore_dbus_address_list_free_cb(void *data); + +static int _ecore_dbus_address_value_char_optional_encode(char c); +static char * _ecore_dbus_address_value_decode(const char *value); +static char * _ecore_dbus_address_value_encode(const char *value); static void -_list_free_cb(void *data) +_ecore_dbus_address_list_free_cb(void *data) { if (data) free(data); } @@ -23,9 +30,9 @@ if (!a) return NULL; a->keys = ecore_list_new(); - ecore_list_set_free_cb(a->keys, _list_free_cb); + ecore_list_set_free_cb(a->keys, _ecore_dbus_address_list_free_cb); a->vals = ecore_list_new(); - ecore_list_set_free_cb(a->vals, _list_free_cb); + ecore_list_set_free_cb(a->vals, _ecore_dbus_address_list_free_cb); return a; } @@ -84,7 +91,7 @@ break; } *p = '\0'; - ecore_list_append(a->vals, strdup(val)); + ecore_list_append(a->vals, _ecore_dbus_address_value_decode(val)); val = NULL; if (sep == ',') @@ -130,8 +137,8 @@ return alist; } -char * -ecore_dbus_address_value_get(Ecore_DBus_Address *address, char *key) +const char * +ecore_dbus_address_value_get(Ecore_DBus_Address *address, const char *key) { int i; char *s; @@ -150,6 +157,33 @@ return NULL; } +EAPI char * +ecore_dbus_address_string(Ecore_DBus_Address *address) +{ + char buf[PATH_MAX]; + char *key, *val; + int left = PATH_MAX - 1; /* space left in the buffer, leaving room for a final null */ + + if (!address) return NULL; + + snprintf(buf, PATH_MAX, "%s:", address->transport); + left -= strlen(address->transport) + 1; + ecore_list_goto_first(address->keys); + ecore_list_goto_first(address->vals); + while ((key = ecore_list_next(address->keys)) && (val = ecore_list_next(address->vals))) + { + char *encval; + strncat(buf, key, left); + left -= strlen(key); + strncat(buf, "=", left); + left -= 1; + encval = _ecore_dbus_address_value_encode(val); + strncat(buf, encval, left); + left -= strlen(encval); + free(encval); + } + return strdup(buf); +} /** * Connect to the first successful server in a list of addresses. @@ -179,6 +213,11 @@ int type; int port; + char *addr_string; + addr_string = ecore_dbus_address_string(addr); + printf("[ecore_dbus] connecting to address: %s\n", addr_string); + free(addr_string); + if (!strcmp(addr->transport, "unix")) { type = ECORE_CON_LOCAL_SYSTEM; @@ -229,3 +268,94 @@ } } +static int +_ecore_dbus_address_value_char_optional_encode(char c) +{ + /* addl optional chars (other than 0-9A-Za-z) */ + char OPTIONAL_CHARS[] = {'_', '-', '/', '.', '\\'}; + int i; + + if (isascii(c) && (isalpha(c) || isdigit(c))) return 1; + for (i = 0; i < sizeof(OPTIONAL_CHARS); i++) + if (c == OPTIONAL_CHARS[i]) return 1; + + return 0; + + +} + +static char * +_ecore_dbus_address_value_encode(const char *value) +{ + char *buf; + const char *p; + int i; + + const char hexdigits[16] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f' + }; + + + if (!value) return NULL; + buf = malloc(3 * strlen(value) + 1); + + p = value; + i = 0; + while (*p) + { + if (_ecore_dbus_address_value_char_optional_encode(*p)) + buf[i++] = *p; + else + { + buf[i++] = '%'; + buf[i++] = hexdigits[(*p >> 4)]; + buf[i++] = hexdigits[(*p & 0xf)]; + } + p++; + } + + buf[i] = '\0'; + return buf; +} + +static char * +_ecore_dbus_address_value_decode(const char *value) +{ + char *buf; + const char *p; + int i; + + buf = malloc(strlen(value) + 1); + + *buf = '\0'; + p = value; + i = 0; + while (*p) + { + if (*p == '%') + { + char c = 0; + int j; + for (j = 0; j < 2; j++) + { + p++; + c = c << 4; + if ('0' <= *p && *p <= '9') + c |= *p - '0'; + else if ('A' <= *p && *p <= 'F') + c |= 10 + *p - 'A'; + else if ('a' <= *p && *p <= 'f') /* a-f */ + c |= 10 + *p - 'a'; + } + buf[i++] = c; + } + else + buf[i++] = *p; + + p++; + } + + buf[i] = '\0'; + return buf; +} |
From: Enlightenment C. <no...@cv...> - 2006-09-25 05:39:51
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Modified Files: ecore_dbus_address.c Log Message: make these static const =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_address.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ecore_dbus_address.c 25 Sep 2006 05:30:48 -0000 1.3 +++ ecore_dbus_address.c 25 Sep 2006 05:39:50 -0000 1.4 @@ -272,7 +272,7 @@ _ecore_dbus_address_value_char_optional_encode(char c) { /* addl optional chars (other than 0-9A-Za-z) */ - char OPTIONAL_CHARS[] = {'_', '-', '/', '.', '\\'}; + static const char OPTIONAL_CHARS[] = {'_', '-', '/', '.', '\\'}; int i; if (isascii(c) && (isalpha(c) || isdigit(c))) return 1; @@ -291,7 +291,7 @@ const char *p; int i; - const char hexdigits[16] = { + static const char hexdigits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
From: Enlightenment C. <no...@cv...> - 2006-09-27 00:01:01
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_dbus Modified Files: Ecore_DBus.h Makefile.am ecore_dbus.c ecore_dbus_message.c ecore_dbus_private.h ecore_dbus_unmarshal.c Log Message: add simple object/method creation API =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/Ecore_DBus.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- Ecore_DBus.h 25 Sep 2006 05:30:48 -0000 1.18 +++ Ecore_DBus.h 27 Sep 2006 00:00:59 -0000 1.19 @@ -46,6 +46,33 @@ typedef struct _Ecore_DBus_Message_Field Ecore_DBus_Message_Field; typedef struct _Ecore_DBus_Address Ecore_DBus_Address; + typedef void (*Ecore_DBus_Method_Call_Cb) (Ecore_DBus_Event_Method_Call *event); + + typedef struct _Ecore_DBus_Object Ecore_DBus_Object; + typedef struct _Ecore_DBus_Object_Method Ecore_DBus_Object_Method; + typedef struct _Ecore_DBus_Object_Registry Ecore_DBus_Object_Registry; + + struct _Ecore_DBus_Object + { + Ecore_DBus_Server *server; + char *path; /* dbus path name */ + Ecore_List *methods; + }; + + struct _Ecore_DBus_Object_Method + { + Ecore_DBus_Object *object; + char *interface; + char *name; + + Ecore_DBus_Method_Call_Cb func; + }; + struct _Ecore_DBus_Object_Registry + { + Ecore_Hash *objects; + }; + + typedef enum _Ecore_DBus_Message_Type { ECORE_DBUS_MESSAGE_TYPE_INVALID, @@ -216,6 +243,14 @@ EAPI void ecore_dbus_print_address_list(Ecore_List *addresses); EAPI Ecore_DBus_Server *ecore_dbus_address_list_connect(Ecore_List *addrs, const void *data); EAPI Ecore_DBus_Server *ecore_dbus_address_connect(Ecore_DBus_Address *addr, const void *data); + + /* object */ + EAPI Ecore_DBus_Object *ecore_dbus_object_add(Ecore_DBus_Server *svr, const char *path); + EAPI void ecore_dbus_object_free(Ecore_DBus_Object *obj); + + EAPI Ecore_DBus_Object_Method *ecore_dbus_object_method_add(Ecore_DBus_Object *obj, const char *interface, const char *method_name, Ecore_DBus_Method_Call_Cb func); + EAPI void ecore_dbus_object_method_remove(Ecore_DBus_Object *obj, Ecore_DBus_Object_Method *method); + EAPI void ecore_dbus_object_method_free(Ecore_DBus_Object_Method *method); #ifdef __cplusplus } =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- Makefile.am 24 Sep 2006 07:24:52 -0000 1.7 +++ Makefile.am 27 Sep 2006 00:00:59 -0000 1.8 @@ -27,6 +27,7 @@ ecore_dbus_methods.c \ ecore_dbus_utils.c \ ecore_dbus_address.c \ +ecore_dbus_object.c \ ecore_dbus_private.h libecore_dbus_la_LIBADD = \ =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- ecore_dbus.c 25 Sep 2006 01:53:47 -0000 1.25 +++ ecore_dbus.c 27 Sep 2006 00:00:59 -0000 1.26 @@ -105,6 +105,7 @@ handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _ecore_dbus_event_server_data, NULL); + ecore_dbus_objects_init(); return init_count; } @@ -115,6 +116,7 @@ if (--init_count != 0) return init_count; + ecore_dbus_objects_shutdown(); /* FIXME: Delete servers */ for (i = 0; i < 3; i++) @@ -231,6 +233,9 @@ svr->auth_type_transaction = 0; svr->messages = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); ecore_hash_set_free_value(svr->messages, ECORE_FREE_CB(_ecore_dbus_message_free)); + svr->objects = ecore_hash_new(ecore_str_hash, ecore_str_compare); + ecore_hash_set_free_key(svr->objects, free); + ecore_hash_set_free_value(svr->objects, ECORE_FREE_CB(ecore_dbus_object_free)); servers = _ecore_list2_append(servers, svr); return svr; @@ -243,6 +248,7 @@ servers = _ecore_list2_remove(servers, svr); if (svr->unique_name) free(svr->unique_name); ecore_hash_destroy(svr->messages); + ecore_hash_destroy(svr->objects); free(svr); } =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_message.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ecore_dbus_message.c 24 Sep 2006 07:24:52 -0000 1.9 +++ ecore_dbus_message.c 27 Sep 2006 00:00:59 -0000 1.10 @@ -298,6 +298,12 @@ return NULL; } +EAPI int +ecore_dbus_message_serial_get(Ecore_DBus_Message *m) +{ + return m->serial; +} + /* message functions */ Ecore_DBus_Message * =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_private.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ecore_dbus_private.h 24 Sep 2006 07:24:52 -0000 1.13 +++ ecore_dbus_private.h 27 Sep 2006 00:00:59 -0000 1.14 @@ -67,6 +67,8 @@ int cnt_msg; Ecore_Hash *messages; + Ecore_Hash *objects; + char *unique_name; }; @@ -286,6 +288,9 @@ Ecore_DBus_Message_Field *_ecore_dbus_message_unmarshal_custom_header(unsigned char *buf, unsigned int *old_length); */ Ecore_DBus_Message *_ecore_dbus_message_unmarshal(Ecore_DBus_Server *svr, unsigned char *message, int size); + + +int ecore_dbus_object_method_dispatch(Ecore_DBus_Server *server, const char *path, const char *interface, const char *method); /* Errors */ #define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed" =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_dbus/ecore_dbus_unmarshal.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ecore_dbus_unmarshal.c 27 Jul 2006 13:29:44 -0000 1.6 +++ ecore_dbus_unmarshal.c 27 Sep 2006 00:00:59 -0000 1.7 @@ -384,7 +384,7 @@ _ecore_dbus_message_append_bytes(msg, message, size); msg->length = 12; size -= 12; - /* Parse custom header */ + /* Parse header fields */ if (!(arr = _ecore_dbus_message_unmarshal_array_begin(msg, ECORE_DBUS_DATA_TYPE_STRUCT, &size))) { printf("Could not parse custom header.\n"); @@ -461,10 +461,10 @@ case ECORE_DBUS_DATA_TYPE_DICT_ENTRY: case ECORE_DBUS_DATA_TYPE_DICT_ENTRY_BEGIN: case ECORE_DBUS_DATA_TYPE_DICT_ENTRY_END: -#if 0 + printf("[ecore_dbus] unhandled data type %c\n", type); + break; default: -#endif - printf("[ecore_dbus] unknown/unhandled data type %c\n", type); + printf("[ecore_dbus] unknown data type %c\n", type); break; } sig++; |