Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h desktops.c dialog.c dialog.h ecompmgr.c emodule.h events.c 
        focus.c main.c moveresize.c pager.c timers.c 


Log Message:
Introduce idlers.

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.542
retrieving revision 1.543
diff -u -3 -r1.542 -r1.543
--- E.h 6 Apr 2006 21:20:16 -0000       1.542
+++ E.h 9 Apr 2006 10:18:33 -0000       1.543
@@ -971,6 +971,11 @@
 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/desktops.c,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -3 -r1.230 -r1.231
--- desktops.c  6 Apr 2006 21:20:16 -0000       1.230
+++ desktops.c  9 Apr 2006 10:18:33 -0000       1.231
@@ -1048,6 +1048,12 @@
 }
 
 static void
+_DesksIdler(void *data __UNUSED__)
+{
+   DesksStackingCheck();
+}
+
+static void
 DeskMove(Desk * dsk, int x, int y)
 {
    Desk               *dd;
@@ -2198,10 +2204,7 @@
      case ESIGNAL_START:
        /* Draw all the buttons that belong on the desktop */
        DeskShowButtons();
-       break;
-
-     case ESIGNAL_IDLE:
-       DesksStackingCheck();
+       IdlerAdd(50, _DesksIdler, NULL);
        break;
      }
 }
===================================================================
RCS file: /cvs/e/e16/e/src/dialog.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -3 -r1.143 -r1.144
--- dialog.c    3 Apr 2006 22:25:19 -0000       1.143
+++ dialog.c    9 Apr 2006 10:18:33 -0000       1.144
@@ -1725,8 +1725,8 @@
    d->xu2 = d->yu2 = 0;
 }
 
-void
-DialogsCheckUpdate(void)
+static void
+_DialogsCheckUpdate(void *data __UNUSED__)
 {
    Dialog             *d;
 
@@ -1740,6 +1740,12 @@
         DialogUpdate(d);
       d->redraw = 0;
    }
+}
+
+void
+DialogsInit(void)
+{
+   IdlerAdd(50, _DialogsCheckUpdate, NULL);
 }
 
 static void
===================================================================
RCS file: /cvs/e/e16/e/src/dialog.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- dialog.h    6 Apr 2006 21:20:16 -0000       1.6
+++ dialog.h    9 Apr 2006 10:18:33 -0000       1.7
@@ -127,7 +127,7 @@
 
 void                DialogCallbackClose(Dialog * d, int val, void *data);
 
-void                DialogsCheckUpdate(void);
+void                DialogsInit(void);
 
 EWin               *FindEwinByDialog(Dialog * d);
 
===================================================================
RCS file: /cvs/e/e16/e/src/ecompmgr.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -3 -r1.108 -r1.109
--- ecompmgr.c  9 Apr 2006 09:26:15 -0000       1.108
+++ ecompmgr.c  9 Apr 2006 10:18:33 -0000       1.109
@@ -2137,6 +2137,18 @@
 }
 
 static void
+_ECompMgrIdler(void *data __UNUSED__)
+{
+   /* Do we get here on auto? */
+   if (!allDamage /* || Conf_compmgr.mode == ECM_MODE_AUTO */ )
+      return;
+   ECompMgrRepaint();
+#if 0                          /* FIXME - Was here - Why? */
+   XSync(disp, False);
+#endif
+}
+
+static void
 ECompMgrRootConfigure(void *prm __UNUSED__, XEvent * ev)
 {
    Display            *dpy = disp;
@@ -2622,14 +2634,7 @@
        ECompMgrInit();
        if (Conf_compmgr.enable)
           ECompMgrStart();
-       break;
-
-     case ESIGNAL_IDLE:
-       /* Do we get here on auto? */
-       if (!allDamage /* || Conf_compmgr.mode == ECM_MODE_AUTO */ )
-          return;
-       ECompMgrRepaint();
-       XSync(disp, False);
+       IdlerAdd(50, _ECompMgrIdler, NULL);
        break;
      }
 }
===================================================================
RCS file: /cvs/e/e16/e/src/emodule.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- emodule.h   7 Jan 2006 07:20:58 -0000       1.8
+++ emodule.h   9 Apr 2006 10:18:33 -0000       1.9
@@ -49,7 +49,6 @@
    ESIGNAL_CONFIGURE,
    ESIGNAL_START,
    ESIGNAL_EXIT,
-   ESIGNAL_IDLE,
    ESIGNAL_AREA_CONFIGURED,
    ESIGNAL_AREA_SWITCH_START,
    ESIGNAL_AREA_SWITCH_DONE,
===================================================================
RCS file: /cvs/e/e16/e/src/events.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -3 -r1.117 -r1.118
--- events.c    19 Mar 2006 15:33:38 -0000      1.117
+++ events.c    9 Apr 2006 10:18:33 -0000       1.118
@@ -23,7 +23,6 @@
  */
 #include "E.h"
 #include "aclass.h"
-#include "dialog.h"            /* FIXME - Should not be here */
 #include "emodule.h"
 #include "xwin.h"
 #include <sys/time.h>
@@ -626,8 +625,7 @@
 
        if (EventDebug(EDBUG_TYPE_EVENTS))
           Eprintf("EventsMain - Idlers\n");
-       DialogsCheckUpdate();   /* FIXME - Shouldn't be here */
-       ModulesSignal(ESIGNAL_IDLE, NULL);
+       IdlersRun();
 
        if (pfetch)
          {
===================================================================
RCS file: /cvs/e/e16/e/src/focus.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -3 -r1.142 -r1.143
--- focus.c     2 Apr 2006 09:45:40 -0000       1.142
+++ focus.c     9 Apr 2006 10:18:34 -0000       1.143
@@ -864,24 +864,27 @@
 }
 
 static void
+_FocusIdler(void *data __UNUSED__)
+{
+   if (!focus_inhibit && focus_pending_why)
+      FocusSet();
+   if (focus_pending_update_grabs)
+      doFocusGrabsUpdate();
+}
+
+static void
 FocusSighan(int sig, void *prm __UNUSED__)
 {
    switch (sig)
      {
      case ESIGNAL_START:
        /* Delay focusing a bit to allow things to settle down */
+       IdlerAdd(50, _FocusIdler, NULL);
        DoIn("FOCUS_INIT_TIMEOUT", 0.5, FocusInitTimeout, 0, NULL);
        break;
 
      case ESIGNAL_EXIT:
        FocusExit();
-       break;
-
-     case ESIGNAL_IDLE:
-       if (!focus_inhibit && focus_pending_why)
-          FocusSet();
-       if (focus_pending_update_grabs)
-          doFocusGrabsUpdate();
        break;
      }
 }
===================================================================
RCS file: /cvs/e/e16/e/src/main.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -3 -r1.140 -r1.141
--- main.c      12 Mar 2006 17:57:32 -0000      1.140
+++ main.c      9 Apr 2006 10:18:34 -0000       1.141
@@ -23,6 +23,7 @@
  */
 #include "E.h"
 #include "desktops.h"
+#include "dialog.h"
 #include "emodule.h"
 #include "hints.h"
 #include "snaps.h"
@@ -286,6 +287,7 @@
 #endif
 
    ModulesSignal(ESIGNAL_START, NULL);
+   DialogsInit();
 
    /* Map the clients */
    MapUnmap(1);
===================================================================
RCS file: /cvs/e/e16/e/src/moveresize.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- moveresize.c        7 Apr 2006 19:48:10 -0000       1.65
+++ moveresize.c        9 Apr 2006 10:18:34 -0000       1.66
@@ -282,7 +282,7 @@
        EGrabServer();
        ModulesSignal(ESIGNAL_ANIMATION_SUSPEND, NULL);
        /* Run idlers (stacking, border updates, ...) before drawing lines */
-       ModulesSignal(ESIGNAL_IDLE, NULL);
+       IdlersRun();
      }
    else
      {
===================================================================
RCS file: /cvs/e/e16/e/src/pager.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -3 -r1.199 -r1.200
--- pager.c     29 Mar 2006 19:13:17 -0000      1.199
+++ pager.c     9 Apr 2006 10:18:34 -0000       1.200
@@ -776,6 +776,12 @@
 }
 
 static void
+_PagersIdler(void *data __UNUSED__)
+{
+   PagersCheckUpdate();
+}
+
+static void
 PagerEwinUpdateFromPager(Pager * p, EWin * ewin)
 {
    int                 x, y, w, h;
@@ -1904,11 +1910,7 @@
           break;
        Conf_pagers.enable = 0;
        PagersShow(1);
-       PagersCheckUpdate();
-       break;
-
-     case ESIGNAL_IDLE:
-       PagersCheckUpdate();
+       IdlerAdd(50, _PagersIdler, NULL);
        break;
 
      case ESIGNAL_AREA_CONFIGURED:
===================================================================
RCS file: /cvs/e/e16/e/src/timers.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- timers.c    8 Jan 2006 16:13:21 -0000       1.21
+++ timers.c    9 Apr 2006 10:18:34 -0000       1.22
@@ -21,6 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include "E.h"
+#include "e16-ecore_list.h"
 #include <sys/time.h>
 
 double
@@ -131,4 +132,50 @@
      }
 
    return 0;
+}
+
+static Ecore_List  *idler_list = NULL;
+
+typedef struct _idler Idler;
+typedef void        (IdlerFunc) (void *data);
+
+struct _idler
+{
+   int                 order;
+   IdlerFunc          *func;
+   void               *data;
+};
+
+void
+IdlerAdd(int order, IdlerFunc * func, void *data)
+{
+   Idler              *id;
+
+   id = Emalloc(sizeof(Idler));
+   if (!id)
+      return;
+
+   id->order = order;          /* Not used atm. */
+   id->func = func;
+   id->data = data;
+
+   if (!idler_list)
+      idler_list = ecore_list_new();
+
+   ecore_list_append(idler_list, id);
+}
+
+void
+IdlerDel(Idler * id)
+{
+   ecore_list_remove_node(idler_list, id);
+   Efree(id);
+}
+
+void
+IdlersRun(void)
+{
+   Idler              *id;
+
+   ECORE_LIST_FOR_EACH(idler_list, id) id->func(id->data);
 }




-------------------------------------------------------
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