Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h desktops.c econfig.c econfig.h 


Log Message:
Enable function calls on "eesh set ..." to do reconfiguration.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.366
retrieving revision 1.367
diff -u -3 -r1.366 -r1.367
--- E.h 12 Feb 2005 23:47:58 -0000      1.366
+++ E.h 13 Feb 2005 11:19:50 -0000      1.367
@@ -808,8 +808,8 @@
       int                 num;
       int                 dragdir;
       int                 dragbar_width;
-      int                 dragbar_ordering;
       int                 dragbar_length;
+      int                 dragbar_ordering;
       char                desks_wraparound;
       char                slidein;
       int                 slidespeed;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -3 -r1.121 -r1.122
--- desktops.c  2 Feb 2005 17:11:35 -0000       1.121
+++ desktops.c  13 Feb 2005 11:19:50 -0000      1.122
@@ -69,6 +69,19 @@
    int                 x[3], y[3], w[3], h[3], m, n, o;
    const char         *t;
 
+   if (Conf.desks.dragdir < 0 || Conf.desks.dragdir > 3)
+      Conf.desks.dragdir = 2;
+   if (Conf.desks.dragbar_ordering < 0 || Conf.desks.dragbar_ordering > 5)
+      Conf.desks.dragbar_ordering = 1;
+   if (Conf.desks.dragbar_width < 0)
+      Conf.desks.dragbar_width = 0;
+   else if (Conf.desks.dragbar_width > 64)
+      Conf.desks.dragbar_width = 64;
+   if (Conf.desks.dragbar_length < 0)
+      Conf.desks.dragbar_length = 0;
+   else if (Conf.desks.dragbar_length > VRoot.w)
+      Conf.desks.dragbar_length = VRoot.w;
+
    Esnprintf(s, sizeof(s), "DRAGBAR_DESKTOP_%i", d->num);
 
    ac = FindItem(s, 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS);
@@ -1524,7 +1537,7 @@
 static void
 DeskDragbarOrderSet(const char *params)
 {
-   char                pd;
+   int                 pd;
 
    pd = Conf.desks.dragbar_ordering;
 
@@ -2367,18 +2380,54 @@
 };
 #define N_IPC_FUNCS (sizeof(DesktopsIpcArray)/sizeof(IpcItem))
 
+static void
+DesksCfgFuncCount(void *item __UNUSED__, const char *value)
+{
+   ChangeNumberOfDesktops(atoi(value));
+}
+
+static void
+DesksCfgFuncDragdir(void *item __UNUSED__, const char *value)
+{
+   DeskDragdirSet(value);
+}
+
+static void
+DesksCfgFuncDragdbarOrder(void *item __UNUSED__, const char *value)
+{
+   DeskDragbarOrderSet(value);
+}
+
+static void
+AreasCfgFuncSizeX(void *item __UNUSED__, const char *value)
+{
+   int                 ax, ay;
+
+   GetAreaSize(&ax, &ay);
+   SetNewAreaSize(atoi(value), ay);
+}
+
+static void
+AreasCfgFuncSizeY(void *item __UNUSED__, const char *value)
+{
+   int                 ax, ay;
+
+   GetAreaSize(&ax, &ay);
+   SetNewAreaSize(ax, atoi(value));
+}
+
 static const CfgItem DesktopsCfgItems[] = {
-   CFG_ITEM_INT(Conf.desks, num, 2),
-   CFG_ITEM_INT(Conf.desks, dragdir, 2),
+   CFG_FUNC_INT(Conf.desks, num, 2, DesksCfgFuncCount),
+   CFG_FUNC_INT(Conf.desks, dragdir, 2, DesksCfgFuncDragdir),
    CFG_ITEM_INT(Conf.desks, dragbar_width, 16),
-   CFG_ITEM_INT(Conf.desks, dragbar_ordering, 1),
    CFG_ITEM_INT(Conf.desks, dragbar_length, 0),
+   CFG_FUNC_INT(Conf.desks, dragbar_ordering, 1, DesksCfgFuncDragdbarOrder),
    CFG_ITEM_BOOL(Conf.desks, desks_wraparound, 0),
    CFG_ITEM_BOOL(Conf.desks, slidein, 1),
    CFG_ITEM_INT(Conf.desks, slidespeed, 6000),
 
-   CFG_ITEM_INT(Conf.desks, areas_nx, 2),
-   CFG_ITEM_INT(Conf.desks, areas_ny, 1),
+   CFG_FUNC_INT(Conf.desks, areas_nx, 2, AreasCfgFuncSizeX),
+   CFG_FUNC_INT(Conf.desks, areas_ny, 1, AreasCfgFuncSizeY),
    CFG_ITEM_BOOL(Conf.desks, areas_wraparound, 0),
 };
 #define N_CFG_ITEMS (sizeof(DesktopsCfgItems)/sizeof(CfgItem))
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/econfig.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- econfig.c   28 Dec 2004 23:46:44 -0000      1.2
+++ econfig.c   13 Feb 2005 11:19:51 -0000      1.3
@@ -432,7 +432,11 @@
    ci = CfgItemFind(pcl, ncl, item);
    if (!ci)
       return -1;
-   CfgItemSetFromString(ci, value);
+
+   if (ci->func)
+      ci->func(ci->ptr, value);
+   else
+      CfgItemSetFromString(ci, value);
 
    return 0;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/econfig.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- econfig.h   28 Dec 2004 23:46:44 -0000      1.2
+++ econfig.h   13 Feb 2005 11:19:51 -0000      1.3
@@ -30,6 +30,7 @@
    void               *ptr;
    char                type;
    long                dflt;
+   void                (*func) (void *item, const char *value);
 } CfgItem;
 
 typedef enum
@@ -40,12 +41,16 @@
    ITEM_TYPE_STRING
 } cfg_item_type_e;
 
-#define CFG_ITEM_BOOL(conf, name, dflt)  { #name, &conf.name, ITEM_TYPE_BOOL, 
dflt }
-#define CFG_ITEM_INT(conf, name, dflt)   { #name, &conf.name, ITEM_TYPE_INT, 
dflt }
-#define CFG_ITEM_STR(conf, name)         { #name, &conf.name, 
ITEM_TYPE_STRING, 0 }
+#define CFG_ITEM_BOOL(conf, name, dflt)  { #name, &conf.name, ITEM_TYPE_BOOL, 
dflt, NULL }
+#define CFG_ITEM_INT(conf, name, dflt)   { #name, &conf.name, ITEM_TYPE_INT, 
dflt, NULL }
+#define CFG_ITEM_STR(conf, name)         { #name, &conf.name, 
ITEM_TYPE_STRING, 0, NULL }
+
+#define CFG_FUNC_BOOL(conf, name, dflt, func)  { #name, &conf.name, 
ITEM_TYPE_BOOL, dflt, func }
+#define CFG_FUNC_INT(conf, name, dflt, func)   { #name, &conf.name, 
ITEM_TYPE_INT, dflt, func }
+#define CFG_FUNC_STR(conf, name, func)         { #name, &conf.name, 
ITEM_TYPE_STRING, 0, func }
 
 /* Change to this? */
-#define CFR_ITEM_BOOL(conf, name, dflt)  { #name, &conf, ITEM_TYPE_BOOL, dflt }
+#define CFR_ITEM_BOOL(conf, name, dflt)  { #name, &conf, ITEM_TYPE_BOOL, dflt, 
NULL }
 
 const CfgItem      *CfgItemFind(const CfgItem * pcl, int ncl, const char 
*name);
 void                CfgItemToString(const CfgItem * ci, char *buf, int len);




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to