Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h backgrounds.c desktops.c dialog.c ecompmgr.c edge.c 
        events.c ewins.c focus.c fx.c groups.c iconify.c ipc.c menus.c 
        mod-trans.c moveresize.c pager.c snaps.c startup.c timers.c 
        tooltips.c 
Added Files:
        timers.h 


Log Message:
Split off timers.h

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.543
retrieving revision 1.544
diff -u -3 -r1.543 -r1.544
--- E.h 9 Apr 2006 10:18:33 -0000       1.543
+++ E.h 16 Apr 2006 13:27:37 -0000      1.544
@@ -560,17 +560,6 @@
 }
 EMode;
 
-typedef struct _qentry
-{
-   char               *name;
-   double              at_time;
-   void                (*func) (int val, void *data);
-   struct _qentry     *next;
-   int                 runtime_val;
-   void               *runtime_data;
-}
-Qentry;
-
 typedef struct _rectbox
 {
    void               *data;
@@ -961,20 +950,6 @@
 /* theme.c */
 void                ThemePathFind(void);
 char              **ThemesList(int *num);
-
-/* timers.c */
-double              GetTime(void);
-void                DoIn(const char *name, double in_time,
-                        void (*func) (int val, void *data), int runtime_val,
-                        void *runtime_data);
-Qentry             *GetHeadTimerQueue(void);
-void                HandleTimerEvent(void);
-int                 RemoveTimerEvent(const char *name);
-
-struct _idler;
-void                IdlerAdd(int order, void (*func) (void *data), void *data);
-void                IdlerDel(struct _idler *id);
-void                IdlersRun(void);
 
 /* warp.c */
 void                WarpFocus(int delta);
===================================================================
RCS file: /cvs/e/e16/e/src/backgrounds.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- backgrounds.c       9 Apr 2006 09:26:14 -0000       1.64
+++ backgrounds.c       16 Apr 2006 13:27:37 -0000      1.65
@@ -31,6 +31,7 @@
 #include "emodule.h"
 #include "iclass.h"
 #include "tclass.h"
+#include "timers.h"
 #include "xwin.h"
 
 typedef struct
===================================================================
RCS file: /cvs/e/e16/e/src/desktops.c,v
retrieving revision 1.232
retrieving revision 1.233
diff -u -3 -r1.232 -r1.233
--- desktops.c  15 Apr 2006 18:32:54 -0000      1.232
+++ desktops.c  16 Apr 2006 13:27:37 -0000      1.233
@@ -33,6 +33,7 @@
 #include "ewins.h"
 #include "hints.h"
 #include "iclass.h"
+#include "timers.h"
 #include "tooltips.h"
 #include "xwin.h"
 #include <time.h>
===================================================================
RCS file: /cvs/e/e16/e/src/dialog.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -3 -r1.144 -r1.145
--- dialog.c    9 Apr 2006 10:18:33 -0000       1.144
+++ dialog.c    16 Apr 2006 13:27:37 -0000      1.145
@@ -29,6 +29,7 @@
 #include "hints.h"
 #include "iclass.h"
 #include "tclass.h"
+#include "timers.h"
 #include "xwin.h"
 
 #define DEBUG_DIALOGS 0
===================================================================
RCS file: /cvs/e/e16/e/src/ecompmgr.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -3 -r1.109 -r1.110
--- ecompmgr.c  9 Apr 2006 10:18:33 -0000       1.109
+++ ecompmgr.c  16 Apr 2006 13:27:37 -0000      1.110
@@ -33,6 +33,7 @@
 #include "ecompmgr.h"
 #include "emodule.h"
 #include "eobj.h"
+#include "timers.h"
 #include "xwin.h"
 
 #include <stdlib.h>
===================================================================
RCS file: /cvs/e/e16/e/src/edge.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- edge.c      2 Feb 2006 18:38:03 -0000       1.27
+++ edge.c      16 Apr 2006 13:27:37 -0000      1.28
@@ -26,6 +26,7 @@
 #include "eobj.h"
 #include "ewins.h"
 #include "menus.h"             /* FIXME - Should not be here */
+#include "timers.h"
 #include "xwin.h"
 
 /* FIXME: Screen resizing not handled. */
===================================================================
RCS file: /cvs/e/e16/e/src/events.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -3 -r1.118 -r1.119
--- events.c    9 Apr 2006 10:18:33 -0000       1.118
+++ events.c    16 Apr 2006 13:27:37 -0000      1.119
@@ -24,6 +24,7 @@
 #include "E.h"
 #include "aclass.h"
 #include "emodule.h"
+#include "timers.h"
 #include "xwin.h"
 #include <sys/time.h>
 #if USE_XSYNC
@@ -611,7 +612,6 @@
    fd_set              fdset;
    struct timeval      tval;
    double              time1, time2, dt;
-   Qentry             *qe;
    int                 count, pfetch;
    int                 fdsize;
    int                 xfd, smfd;
@@ -658,20 +658,22 @@
           dt = 0.0;
        /* dt = time spent since we last were here */
 
-       qe = GetHeadTimerQueue();
-       if (qe)
+       count = TimersPending(&time2);
+       if (count >= 0)
          {
-            count = 0;
-            time2 = qe->at_time - time2;
-            if (time2 < 0.0)
-               time2 = 0.0;
-            if (time2 <= 0.0)
-               goto do_timer;
-            if (XPending(disp))
-               continue;
-            tval.tv_sec = (long)time2;
-            tval.tv_usec = (long)((time2 - ((double)tval.tv_sec)) * 1000000);
-            count = select(fdsize, &fdset, NULL, NULL, &tval);
+            if (count > 0)
+              {
+                 if (XPending(disp))
+                    continue;
+                 tval.tv_sec = (long)time2;
+                 tval.tv_usec =
+                    (long)((time2 - ((double)tval.tv_sec)) * 1000000);
+                 count = select(fdsize, &fdset, NULL, NULL, &tval);
+              }
+            if (count == 0)
+              {
+                 TimersRun();
+              }
          }
        else
          {
@@ -682,12 +684,9 @@
 
        if (EventDebug(EDBUG_TYPE_EVENTS))
           Eprintf
-             ("EventsMain - count=%d xfd=%d:%d smfd=%d:%d qe=%p dt=%lf 
time2=%lf\n",
+             ("EventsMain - count=%d xfd=%d:%d smfd=%d:%d dt=%lf time2=%lf\n",
               count, xfd, FD_ISSET(xfd, &fdset), smfd,
-              (smfd >= 0) ? FD_ISSET(smfd, &fdset) : 0, qe, dt, time2);
-
-       if (count < 0)
-          continue;
+              (smfd >= 0) ? FD_ISSET(smfd, &fdset) : 0, dt, time2);
 
        if (count > 0)
          {
@@ -697,15 +696,6 @@
                     Eprintf("EventsMain - ICE\n");
                  ProcessICEMSGS();
               }
-            continue;
-         }
-
-      do_timer:
-       if (qe)
-         {
-            if (EventDebug(EDBUG_TYPE_EVENTS))
-               Eprintf("EventsMain - Timers (%s)\n", qe->name);
-            HandleTimerEvent();
          }
      }
 }
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -3 -r1.152 -r1.153
--- ewins.c     15 Apr 2006 18:32:54 -0000      1.152
+++ ewins.c     16 Apr 2006 13:27:37 -0000      1.153
@@ -32,6 +32,7 @@
 #include "groups.h"
 #include "hints.h"
 #include "snaps.h"
+#include "timers.h"
 #include "xwin.h"
 
 #define EWIN_TOP_EVENT_MASK \
===================================================================
RCS file: /cvs/e/e16/e/src/focus.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -3 -r1.143 -r1.144
--- focus.c     9 Apr 2006 10:18:34 -0000       1.143
+++ focus.c     16 Apr 2006 13:27:37 -0000      1.144
@@ -27,6 +27,7 @@
 #include "emodule.h"
 #include "ewins.h"
 #include "hints.h"
+#include "timers.h"
 #include "xwin.h"
 
 #define EwinListFocusRaise(ewin) EobjListFocusRaise(EoObj(ewin))
===================================================================
RCS file: /cvs/e/e16/e/src/fx.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- fx.c        6 Apr 2006 21:20:16 -0000       1.62
+++ fx.c        16 Apr 2006 13:27:37 -0000      1.63
@@ -25,6 +25,7 @@
 #include "dialog.h"
 #include "eimage.h"
 #include "emodule.h"
+#include "timers.h"
 #include "xwin.h"
 #include <math.h>
 
===================================================================
RCS file: /cvs/e/e16/e/src/groups.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- groups.c    18 Feb 2006 08:30:08 -0000      1.77
+++ groups.c    16 Apr 2006 13:27:37 -0000      1.78
@@ -29,6 +29,7 @@
 #include "ewins.h"
 #include "groups.h"
 #include "snaps.h"
+#include "timers.h"
 #include <math.h>
 
 #define SET_OFF    0
===================================================================
RCS file: /cvs/e/e16/e/src/iconify.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -3 -r1.197 -r1.198
--- iconify.c   8 Apr 2006 18:47:17 -0000       1.197
+++ iconify.c   16 Apr 2006 13:27:37 -0000      1.198
@@ -33,6 +33,7 @@
 #include "iclass.h"
 #include "icons.h"
 #include "menus.h"
+#include "timers.h"
 #include "tooltips.h"
 #include "xwin.h"
 #include <math.h>
===================================================================
RCS file: /cvs/e/e16/e/src/ipc.c,v
retrieving revision 1.260
retrieving revision 1.261
diff -u -3 -r1.260 -r1.261
--- ipc.c       15 Apr 2006 18:32:54 -0000      1.260
+++ ipc.c       16 Apr 2006 13:27:37 -0000      1.261
@@ -31,6 +31,7 @@
 #include "ewin-ops.h"
 #include "hints.h"             /* FIXME - Should not be here */
 #include "snaps.h"
+#include "timers.h"
 #include "xwin.h"
 #include <ctype.h>
 
===================================================================
RCS file: /cvs/e/e16/e/src/menus.c,v
retrieving revision 1.234
retrieving revision 1.235
diff -u -3 -r1.234 -r1.235
--- menus.c     12 Apr 2006 15:19:40 -0000      1.234
+++ menus.c     16 Apr 2006 13:27:38 -0000      1.235
@@ -33,6 +33,7 @@
 #include "iclass.h"
 #include "menus.h"
 #include "tclass.h"
+#include "timers.h"
 #include "tooltips.h"
 #include "xwin.h"
 #include <time.h>
===================================================================
RCS file: /cvs/e/e16/e/src/mod-trans.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- mod-trans.c 18 Feb 2006 08:30:08 -0000      1.16
+++ mod-trans.c 16 Apr 2006 13:27:38 -0000      1.17
@@ -25,6 +25,7 @@
 #include "dialog.h"
 #include "emodule.h"
 #include "iclass.h"
+#include "timers.h"
 
 #ifdef ENABLE_THEME_TRANSPARENCY
 /*
===================================================================
RCS file: /cvs/e/e16/e/src/moveresize.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- moveresize.c        12 Apr 2006 15:19:40 -0000      1.67
+++ moveresize.c        16 Apr 2006 13:27:38 -0000      1.68
@@ -27,6 +27,7 @@
 #include "ewins.h"
 #include "groups.h"
 #include "hints.h"
+#include "timers.h"
 #include "xwin.h"
 
 static struct
===================================================================
RCS file: /cvs/e/e16/e/src/pager.c,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -3 -r1.202 -r1.203
--- pager.c     15 Apr 2006 18:32:54 -0000      1.202
+++ pager.c     16 Apr 2006 13:27:38 -0000      1.203
@@ -34,6 +34,7 @@
 #include "hiwin.h"
 #include "iclass.h"
 #include "menus.h"
+#include "timers.h"
 #include "tooltips.h"
 #include "xwin.h"
 
===================================================================
RCS file: /cvs/e/e16/e/src/snaps.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- snaps.c     2 Apr 2006 09:45:40 -0000       1.116
+++ snaps.c     16 Apr 2006 13:27:38 -0000      1.117
@@ -29,6 +29,7 @@
 #include "ewins.h"
 #include "groups.h"
 #include "snaps.h"
+#include "timers.h"
 #include "xwin.h"
 
 struct _snapshot
===================================================================
RCS file: /cvs/e/e16/e/src/startup.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -3 -r1.69 -r1.70
--- startup.c   18 Feb 2006 08:30:09 -0000      1.69
+++ startup.c   16 Apr 2006 13:27:38 -0000      1.70
@@ -25,6 +25,7 @@
 #include "backgrounds.h"
 #include "eobj.h"
 #include "iclass.h"
+#include "timers.h"
 #include "xwin.h"
 
 static EObj        *init_win1 = NULL;
===================================================================
RCS file: /cvs/e/e16/e/src/timers.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- timers.c    9 Apr 2006 10:18:34 -0000       1.22
+++ timers.c    16 Apr 2006 13:27:38 -0000      1.23
@@ -22,8 +22,20 @@
  */
 #include "E.h"
 #include "e16-ecore_list.h"
+#include "timers.h"
 #include <sys/time.h>
 
+typedef struct _qentry Qentry;
+struct _qentry
+{
+   char               *name;
+   double              at_time;
+   void                (*func) (int val, void *data);
+   struct _qentry     *next;
+   int                 runtime_val;
+   void               *runtime_data;
+};
+
 double
 GetTime(void)
 {
@@ -77,27 +89,46 @@
      }
 }
 
-Qentry             *
-GetHeadTimerQueue(void)
+/*
+ * Returns:
+ *  -1: No timers pending
+ *   0: Expired timer pending
+ *   1: Non-expired timers pending
+ */
+int
+TimersPending(double *t)
 {
-   return q_first;
+   Qentry             *qe;
+   double              dt;
+
+   qe = q_first;
+   if (!qe)
+      return -1;
+
+   dt = qe->at_time - *t;
+   *t = dt;
+
+   return (dt > 0.) ? 1 : 0;
 }
 
 void
-HandleTimerEvent(void)
+TimersRun(void)
 {
    Qentry             *qe;
 
-   /* no timers - exit */
+   qe = q_first;
    if (!q_first)
       return;
 
-   /* get the first timer */
-   qe = q_first;
+   if (EventDebug(EDBUG_TYPE_EVENTS))
+      Eprintf("EventsMain - Timers (%s)\n", qe->name);
+
    /* remove it */
    q_first = q_first->next;
+
    /* run this callback */
    qe->func(qe->runtime_val, qe->runtime_data);
+
    /* free the timer */
    if (qe->name)
       Efree(qe->name);
@@ -136,7 +167,6 @@
 
 static Ecore_List  *idler_list = NULL;
 
-typedef struct _idler Idler;
 typedef void        (IdlerFunc) (void *data);
 
 struct _idler
@@ -146,14 +176,14 @@
    void               *data;
 };
 
-void
+Idler              *
 IdlerAdd(int order, IdlerFunc * func, void *data)
 {
    Idler              *id;
 
    id = Emalloc(sizeof(Idler));
    if (!id)
-      return;
+      return NULL;
 
    id->order = order;          /* Not used atm. */
    id->func = func;
@@ -163,6 +193,8 @@
       idler_list = ecore_list_new();
 
    ecore_list_append(idler_list, id);
+
+   return id;
 }
 
 void
===================================================================
RCS file: /cvs/e/e16/e/src/tooltips.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -3 -r1.96 -r1.97
--- tooltips.c  2 Apr 2006 09:45:40 -0000       1.96
+++ tooltips.c  16 Apr 2006 13:27:38 -0000      1.97
@@ -30,6 +30,7 @@
 #include "eobj.h"
 #include "iclass.h"
 #include "tclass.h"
+#include "timers.h"
 #include "tooltips.h"
 #include "xwin.h"
 




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to