Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore


Modified Files:
        Ecore.h ecore_exe.c 


Log Message:
* ecore_exe events now get allocated just like other events.
* added ECORE_EXE_EVENT_ADD and support code.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Ecore.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- Ecore.h     13 Jan 2006 06:38:44 -0000      1.41
+++ Ecore.h     13 Jan 2006 13:18:36 -0000      1.42
@@ -62,15 +62,17 @@
 #endif
 
 #define ECORE_EVENT_NONE            0
-#define ECORE_EXE_EVENT_DEL         1 /**< Spawned Exe has exit event */
-#define ECORE_EVENT_SIGNAL_USER     2 /**< User signal event */
-#define ECORE_EVENT_SIGNAL_HUP      3 /**< Hup signal event */
-#define ECORE_EVENT_SIGNAL_EXIT     4 /**< Exit signal event */
-#define ECORE_EVENT_SIGNAL_POWER    5 /**< Power signal event */
-#define ECORE_EVENT_SIGNAL_REALTIME 6 /**< Realtime signal event */
-#define ECORE_EXE_EVENT_DATA        7 /**< Data from a child process */
-#define ECORE_EXE_EVENT_ERROR       8 /**< Error from a child process */
-#define ECORE_EVENT_COUNT           9
+#define ECORE_EVENT_SIGNAL_USER     1 /**< User signal event */
+#define ECORE_EVENT_SIGNAL_HUP      2 /**< Hup signal event */
+#define ECORE_EVENT_SIGNAL_EXIT     3 /**< Exit signal event */
+#define ECORE_EVENT_SIGNAL_POWER    4 /**< Power signal event */
+#define ECORE_EVENT_SIGNAL_REALTIME 5 /**< Realtime signal event */
+#define ECORE_EVENT_COUNT           6
+
+   EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */
+   EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted 
(it exited, naming consistant with the rest of ecore). */
+   EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */
+   EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */
 
 #ifndef _ECORE_PRIVATE_H   
    enum _Ecore_Fd_Handler_Flags
@@ -106,6 +108,7 @@
    typedef void Ecore_Event; /**< A handle for an event */
    typedef void Ecore_Animator; /**< A handle for animators */
 #endif
+   typedef struct _Ecore_Exe_Event_Add         Ecore_Exe_Event_Add; /**< 
Spawned Exe add event */
    typedef struct _Ecore_Event_Exe_Exit        Ecore_Event_Exe_Exit; /**< 
Spawned Exe exit event */
    typedef struct _Ecore_Event_Signal_User     Ecore_Event_Signal_User; /**< 
User signal event */
    typedef struct _Ecore_Event_Signal_Hup      Ecore_Event_Signal_Hup; /**< 
Hup signal event */
@@ -116,6 +119,12 @@
    typedef struct _Ecore_Event_Exe_Data        Ecore_Event_Exe_Data; /**< Data 
from a child process */
 
 #ifndef WIN32
+   struct _Ecore_Exe_Event_Add /** Process add event */
+     {
+       Ecore_Exe *exe; /**< The handle to the added process */
+       void      *ext_data; /**< Extension data - not used */
+     };
+
    struct _Ecore_Event_Exe_Exit /** Process exit event */
      {
        pid_t      pid; /**< The process ID of the process that exited */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_exe.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- ecore_exe.c 13 Jan 2006 06:38:44 -0000      1.41
+++ ecore_exe.c 13 Jan 2006 13:18:36 -0000      1.42
@@ -5,6 +5,7 @@
 
 #ifndef WIN32
 
+
 struct _ecore_exe_dead_exe
 {
    pid_t        pid;
@@ -22,6 +23,13 @@
 static Ecore_Exe *_ecore_exe_is_it_alive(pid_t pid);
 static int _ecore_exe_make_sure_its_dead(void *data);
 static int _ecore_exe_make_sure_its_really_dead(void *data);
+static Ecore_Exe_Event_Add *_ecore_exe_event_add_new(void);
+static void _ecore_exe_event_add_free(void *data, void *ev);
+
+EAPI int ECORE_EXE_EVENT_ADD = 0;
+EAPI int ECORE_EXE_EVENT_DEL = 0;
+EAPI int ECORE_EXE_EVENT_DATA = 0;
+EAPI int ECORE_EXE_EVENT_ERROR = 0;
 
 static Ecore_Exe *exes = NULL;
 static char *shell = NULL;
@@ -406,7 +414,16 @@
        IF_FN_DEL(_ecore_exe_free, exe);
      }
    else
-     printf("Running as %d for %s.\n", exe->pid, exe->cmd);
+      {
+        Ecore_Exe_Event_Add *e;
+                      
+        e = _ecore_exe_event_add_new();
+        e->exe = exe;
+        if (e)   /* Send the event. */
+           ecore_event_add(ECORE_EXE_EVENT_ADD, e,
+                   _ecore_exe_event_add_free, NULL);
+         printf("Running as %d for %s.\n", exe->pid, exe->cmd);
+      }
    
    errno = n;
    return exe;
@@ -796,6 +813,10 @@
 void
 _ecore_exe_init(void)
 {
+   ECORE_EXE_EVENT_ADD = ecore_event_type_new();
+   ECORE_EXE_EVENT_DEL = ecore_event_type_new();
+   ECORE_EXE_EVENT_DATA = ecore_event_type_new();
+   ECORE_EXE_EVENT_ERROR = ecore_event_type_new();
 }
 
 void
@@ -1211,4 +1232,22 @@
    IF_FREE(e->data);
    free(e);
 }
+
+static Ecore_Exe_Event_Add *
+_ecore_exe_event_add_new(void)
+{
+   Ecore_Exe_Event_Add *e;
+   
+   e = calloc(1, sizeof(Ecore_Exe_Event_Add));
+   return e;
+}
+
+static void
+_ecore_exe_event_add_free(void *data __UNUSED__, void *ev)
+{
+   Ecore_Exe_Event_Add *e;
+   
+   e = ev;
+   free(e);
+}
 #endif




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to