Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

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


Modified Files:
      Tag: SPLIT
        Ecore.h ecore_main.c 


Log Message:


we have a main loop iteration call now :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/Ecore.h,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -3 -r1.1.2.8 -r1.1.2.9
--- Ecore.h     8 Jul 2003 04:26:08 -0000       1.1.2.8
+++ Ecore.h     8 Sep 2003 03:05:18 -0000       1.1.2.9
@@ -109,7 +109,8 @@
    
    Ecore_Idle_Enterer *ecore_idle_enterer_add(int (*func) (void *data), const void 
*data);
    void               *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
-       
+
+   void              ecore_main_loop_interate(void);
    void              ecore_main_loop_begin(void);
    void              ecore_main_loop_quit(void);
    Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, 
int (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data, int 
(*buf_func) (void *buf_data, Ecore_Fd_Handler *fd_handler), const void *buf_data);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_main.c,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -3 -r1.1.2.13 -r1.1.2.14
--- ecore_main.c        19 Jun 2003 13:00:00 -0000      1.1.2.13
+++ ecore_main.c        8 Sep 2003 03:05:18 -0000       1.1.2.14
@@ -9,7 +9,8 @@
 static int  _ecore_main_select(double timeout);
 static void _ecore_main_fd_handlers_cleanup(void);
 static void _ecore_main_fd_handlers_call(void);
-static int _ecore_main_fd_handlers_buf_call(void);
+static int  _ecore_main_fd_handlers_buf_call(void);
+static void _ecore_main_loop_interate_internal(int once_only);
 
 static  int               in_main_loop = 0;
 static  int               do_quit = 0;
@@ -17,6 +18,19 @@
 static  int               fd_handlers_delete_me = 0;
 
 /**
+ * Run 1 iteration of the main loop and process everything on the queue.
+ * 
+ * This function Processes 1 iteration of the main loop, handling anything on
+ * the queue. See ecore_main_loop_begin() for more information.
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+void
+ecore_main_loop_interate(void)
+{
+   _ecore_main_loop_interate_internal(1);
+}
+
+/**
  * Run the application main loop.
  * 
  * This function does not return until ecore_main_loop_quit() is called. It
@@ -28,129 +42,10 @@
 void
 ecore_main_loop_begin(void)
 {
-   in_main_loop = 1;
-   for (;do_quit == 0;)
-     {
-       double next_time;
-       int    have_event;
-       int    have_signal;
-       
-       /* expire any timers */
-         {
-            double now;
-            
-            now = ecore_time_get();
-            while (_ecore_timer_call(now));
-            _ecore_timer_cleanup();
-         }
-       /* any timers re-added as a result of these are allowed to go */
-       _ecore_timer_enable_new();
-       /* process signals into events .... */
-       while (_ecore_signal_count_get()) _ecore_signal_call();
-       if (_ecore_event_exist())
-         {
-            have_event = 1;
-            have_signal = 1;
-            goto process_events;
-         }
-       /* call idle enterers ... */
-       _ecore_idle_enterer_call();
-       /* if these calls caused any biuffered events to appear - deal with them */    
 
-       while (_ecore_main_fd_handlers_buf_call());
-       /* if ther are any - jump to processing them */
-       if (_ecore_event_exist())
-         {
-            have_event = 1;
-            have_signal = 1;
-            goto process_events;
-         }     
-       
-       start_loop:
-       /* init flags */
-       have_event = have_signal = 0;
-       next_time = _ecore_timer_next_get();    
-       /* no timers */
-       if (next_time < 0)
-         {
-            /* no idlers */
-            if (!_ecore_idler_exist())
-              {
-                 int ret;
-                 
-                 ret = _ecore_main_select(-1);
-                 if (ret > 0) have_event = 1;
-                 if (_ecore_signal_count_get() > 0) have_signal = 1;
-              }
-            /* idlers */
-            else
-              {
-                 for (;;)
-                   {
-                      int ret;
-                      
-                      if (!_ecore_idler_call()) goto start_loop;
-                      if (_ecore_event_exist()) break;
-                      ret = _ecore_main_select(0);
-                      if (ret > 0) have_event = 1;
-                      if (_ecore_signal_count_get() > 0) have_signal = 1;
-                      if (have_event || have_signal) break;
-                      next_time = _ecore_timer_next_get();
-                      if (next_time >= 0) goto start_loop;
-                   }
-              }
-         }
-       /* timers */
-       else
-         {
-            /* no idlers */
-            if (!_ecore_idler_exist())
-              {
-                 int ret;
-                 
-                 ret = _ecore_main_select(next_time);
-                 if (ret > 0) have_event = 1;
-                 if (_ecore_signal_count_get() > 0) have_signal = 1;
-              }
-            /* idlers */
-            else
-              {
-                 for (;;)
-                   {
-                      double cur_time, t;
-                      int ret;
-                      
-                      if (!_ecore_idler_call()) goto start_loop;
-                      if (_ecore_event_exist()) break;
-                      ret = _ecore_main_select(0);
-                      if (ret > 0) have_event = 1;
-                      if (_ecore_signal_count_get() > 0) have_signal = 1;
-                      if ((have_event) || (have_signal)) break;
-                      cur_time = ecore_time_get();
-                      t = ecore_time_get() - cur_time;
-                      if (t >= next_time) break;
-                      next_time = _ecore_timer_next_get();
-                      if (next_time < 0) goto start_loop;
-                   }
-              }
-         }
-       /* call the fd handler per fd that became alive... */
-       /* this should read or write any data to the monitored fd and then */
-       /* post events onto the ecore event pipe if necessary */
-       process_events:
-       if (have_event) _ecore_main_fd_handlers_call();
-       do
-         {
-            /* process signals into events .... */
-            while (_ecore_signal_count_get()) _ecore_signal_call();
-            
-            /* handle events ... */
-            _ecore_event_call();       
-            _ecore_main_fd_handlers_cleanup();
-         }
-       while (_ecore_main_fd_handlers_buf_call());
-     }
+   in_main_loop++;
+   for (;do_quit == 0;) _ecore_main_loop_interate_internal(0);
    do_quit = 0;
-   in_main_loop = 0;
+   in_main_loop--;
 }
 
 /**
@@ -481,4 +376,129 @@
          }
      }
    return ret;
+}
+
+static void
+_ecore_main_loop_interate_internal(int once_only)
+{
+   double next_time;
+   int    have_event;
+   int    have_signal;
+   
+   in_main_loop++;
+   /* expire any timers */
+     {
+       double now;
+       
+       now = ecore_time_get();
+       while (_ecore_timer_call(now));
+       _ecore_timer_cleanup();
+     }
+   /* any timers re-added as a result of these are allowed to go */
+   _ecore_timer_enable_new();
+   /* process signals into events .... */
+   while (_ecore_signal_count_get()) _ecore_signal_call();
+   if (_ecore_event_exist())
+     {
+       have_event = 1;
+       have_signal = 1;
+       goto process_events;
+     }
+   /* call idle enterers ... */
+   _ecore_idle_enterer_call();
+   /* if these calls caused any biuffered events to appear - deal with them */
+   while (_ecore_main_fd_handlers_buf_call());
+   /* if ther are any - jump to processing them */
+   if (_ecore_event_exist())
+     {
+       have_event = 1;
+       have_signal = 1;
+       goto process_events;
+     }
+   if (once_only) return;
+   
+   start_loop:
+   /* init flags */
+   have_event = have_signal = 0;
+   next_time = _ecore_timer_next_get();        
+   /* no timers */
+   if (next_time < 0)
+     {
+       /* no idlers */
+       if (!_ecore_idler_exist())
+         {
+            int ret;
+            
+            ret = _ecore_main_select(-1);
+            if (ret > 0) have_event = 1;
+            if (_ecore_signal_count_get() > 0) have_signal = 1;
+         }
+       /* idlers */
+       else
+         {
+            for (;;)
+              {
+                 int ret;
+                 
+                 if (!_ecore_idler_call()) goto start_loop;
+                 if (_ecore_event_exist()) break;
+                 ret = _ecore_main_select(0);
+                 if (ret > 0) have_event = 1;
+                 if (_ecore_signal_count_get() > 0) have_signal = 1;
+                 if (have_event || have_signal) break;
+                 next_time = _ecore_timer_next_get();
+                 if (next_time >= 0) goto start_loop;
+              }
+         }
+     }
+   /* timers */
+   else
+     {
+       /* no idlers */
+       if (!_ecore_idler_exist())
+         {
+            int ret;
+            
+            ret = _ecore_main_select(next_time);
+            if (ret > 0) have_event = 1;
+            if (_ecore_signal_count_get() > 0) have_signal = 1;
+         }
+       /* idlers */
+       else
+         {
+            for (;;)
+              {
+                 double cur_time, t;
+                 int ret;
+                 
+                 if (!_ecore_idler_call()) goto start_loop;
+                 if (_ecore_event_exist()) break;
+                 ret = _ecore_main_select(0);
+                 if (ret > 0) have_event = 1;
+                 if (_ecore_signal_count_get() > 0) have_signal = 1;
+                 if ((have_event) || (have_signal)) break;
+                 cur_time = ecore_time_get();
+                 t = ecore_time_get() - cur_time;
+                 if (t >= next_time) break;
+                 next_time = _ecore_timer_next_get();
+                 if (next_time < 0) goto start_loop;
+              }
+         }
+     }
+   /* call the fd handler per fd that became alive... */
+   /* this should read or write any data to the monitored fd and then */
+   /* post events onto the ecore event pipe if necessary */
+   process_events:
+   if (have_event) _ecore_main_fd_handlers_call();
+   do
+     {
+       /* process signals into events .... */
+       while (_ecore_signal_count_get()) _ecore_signal_call();
+       
+       /* handle events ... */
+       _ecore_event_call();    
+       _ecore_main_fd_handlers_cleanup();
+     }
+   while (_ecore_main_fd_handlers_buf_call());
+   in_main_loop--;
 }




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to