Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
      Tag: branch-exp
        ewmh.c gnome.c icccm.c 


Log Message:
Behave.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewmh.c,v
retrieving revision 1.55.2.10
retrieving revision 1.55.2.11
diff -u -3 -r1.55.2.10 -r1.55.2.11
--- ewmh.c      20 Oct 2004 21:04:07 -0000      1.55.2.10
+++ ewmh.c      21 Oct 2004 17:25:46 -0000      1.55.2.11
@@ -284,18 +284,24 @@
 void
 EWMH_SetDesktopCount(void)
 {
-   int                 i;
+   int                 i, n_desks;
    CARD32              val;
-   Window              wl[Conf.desks.num];
+   Window             *wl;
 
    EDBUG(6, "EWMH_SetDesktopCount");
 
-   val = Conf.desks.num;
+   n_desks = DesksGetNumber();
+   val = n_desks;
    _ATOM_SET_CARD32(_NET_NUMBER_OF_DESKTOPS, VRoot.win, &val, 1);
 
-   for (i = 0; i < Conf.desks.num; i++)
+   wl = Emalloc(n_desks * sizeof(Window));
+   if (!wl)
+      EDBUG_RETURN_;
+
+   for (i = 0; i < n_desks; i++)
       wl[i] = DeskGetWin(i);
-   _ATOM_SET_WINDOW(_NET_VIRTUAL_ROOTS, VRoot.win, &wl, Conf.desks.num);
+   _ATOM_SET_WINDOW(_NET_VIRTUAL_ROOTS, VRoot.win, &wl, n_desks);
+   Efree(wl);
 
    EDBUG_RETURN_;
 }
@@ -303,16 +309,22 @@
 void
 EWMH_SetDesktopNames(void)
 {
-   char                buf[10 * Conf.desks.num], *s;
-   int                 i;
+   char               *buf, *s;
+   int                 i, n_desks;
 
    EDBUG(6, "EWMH_SetDesktopNames");
 
+   n_desks = DesksGetNumber();
+   buf = Emalloc(n_desks * 10);
+   if (!buf)
+      EDBUG_RETURN_;
+
    s = buf;
-   for (i = 0; i < Conf.desks.num; i++)
+   for (i = 0; i < n_desks; i++)
       s += sprintf(s, "Desk-%d", i) + 1;
 
    _ATOM_SET_UTF8_STRING_LIST(_NET_DESKTOP_NAMES, VRoot.win, buf, s - buf);
+   Efree(buf);
 
    EDBUG_RETURN_;
 }
@@ -335,15 +347,16 @@
 EWMH_SetWorkArea(void)
 {
    CARD32             *p_coord;
-   int                 n_coord, i;
+   int                 n_coord, i, n_desks;
 
    EDBUG(6, "EWMH_SetWorkArea");
 
-   n_coord = 4 * Conf.desks.num;
+   n_desks = DesksGetNumber();
+   n_coord = 4 * n_desks;
    p_coord = Emalloc(n_coord * sizeof(CARD32));
    if (p_coord)
      {
-       for (i = 0; i < Conf.desks.num; i++)
+       for (i = 0; i < n_desks; i++)
          {
             p_coord[4 * i] = 0;
             p_coord[4 * i + 1] = 0;
@@ -371,14 +384,16 @@
 EWMH_SetDesktopViewport(void)
 {
    CARD32             *p_coord;
-   int                 n_coord, i, ax, ay;
+   int                 n_coord, i, ax, ay, n_desks;
 
    EDBUG(6, "EWMH_SetDesktopViewport");
-   n_coord = 2 * Conf.desks.num;
+
+   n_desks = DesksGetNumber();
+   n_coord = 2 * n_desks;
    p_coord = Emalloc(n_coord * sizeof(CARD32));
    if (p_coord)
      {
-       for (i = 0; i < Conf.desks.num; i++)
+       for (i = 0; i < n_desks; i++)
          {
             DeskGetArea(i, &ax, &ay);
             p_coord[2 * i] = ax * VRoot.w;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/gnome.c,v
retrieving revision 1.39.2.4
retrieving revision 1.39.2.5
diff -u -3 -r1.39.2.4 -r1.39.2.5
--- gnome.c     20 Oct 2004 21:53:05 -0000      1.39.2.4
+++ gnome.c     21 Oct 2004 17:25:46 -0000      1.39.2.5
@@ -615,7 +615,7 @@
    EDBUG(6, "GNOME_SetDeskCount");
    if (!atom_set)
       atom_set = XInternAtom(disp, XA_WIN_WORKSPACE_COUNT, False);
-   val = Conf.desks.num;
+   val = DesksGetNumber();
    XChangeProperty(disp, VRoot.win, atom_set, XA_CARDINAL, 32, PropModeReplace,
                   (unsigned char *)&val, 1);
    EDBUG_RETURN_;
@@ -644,25 +644,36 @@
 {
    static Atom         atom_set = 0;
    XTextProperty       text;
-   char                s[1024], *names[Conf.desks.num];
-   int                 i;
+   char                s[1024], **names;
+   int                 i, n_desks;
 
    EDBUG(6, "GNOME_SetDeskNames");
+
    if (!atom_set)
       atom_set = XInternAtom(disp, XA_WIN_WORKSPACE_NAMES, False);
-   for (i = 0; i < Conf.desks.num; i++)
+
+   n_desks = DesksGetNumber();
+   names = Emalloc(n_desks * sizeof(char *));
+   if (!names)
+      EDBUG_RETURN_;
+
+   for (i = 0; i < n_desks; i++)
      {
        Esnprintf(s, sizeof(s), "%i", i);
        names[i] = Estrdup(s);
      }
-   if (XStringListToTextProperty(names, Conf.desks.num, &text))
+
+   if (XStringListToTextProperty(names, n_desks, &text))
      {
        XSetTextProperty(disp, VRoot.win, &text, atom_set);
        XFree(text.value);
      }
-   for (i = 0; i < Conf.desks.num; i++)
+
+   for (i = 0; i < n_desks; i++)
       if (names[i])
         Efree(names[i]);
+   Efree(names);
+
    EDBUG_RETURN_;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.76.2.9
retrieving revision 1.76.2.10
diff -u -3 -r1.76.2.9 -r1.76.2.10
--- icccm.c     20 Oct 2004 21:04:08 -0000      1.76.2.9
+++ icccm.c     21 Oct 2004 17:25:46 -0000      1.76.2.10
@@ -510,7 +510,7 @@
                       int                 dsk;
 
                       dsk = EoGetDesk(ewin);
-                      if ((dsk < 0) || (dsk >= Conf.desks.num))
+                      if ((dsk < 0) || (dsk >= DesksGetNumber()))
                          dsk = DesksGetCurrent();
                       ewin->client.x -= DeskGetX(dsk);
                       ewin->client.y -= DeskGetY(dsk);
@@ -1049,10 +1049,15 @@
 ICCCM_SetMainEInfo(void)
 {
    Atom                a;
-   int                 i, ax, ay;
-   CARD32              cc[Conf.desks.num * 2];
+   int                 i, ax, ay, n_desks;
+   CARD32             *cc;
 
-   for (i = 0; i < Conf.desks.num; i++)
+   n_desks = DesksGetNumber();
+   cc = Emalloc(2 * n_desks * sizeof(CARD32));
+   if (!cc)
+      return;
+
+   for (i = 0; i < n_desks; i++)
      {
        DeskGetArea(i, &ax, &ay);
        cc[(i * 2)] = ax;
@@ -1060,12 +1065,14 @@
      }
    a = XInternAtom(disp, "ENL_INTERNAL_AREA_DATA", False);
    XChangeProperty(disp, VRoot.win, a, XA_CARDINAL, 32, PropModeReplace,
-                  (unsigned char *)cc, Conf.desks.num * 2);
+                  (unsigned char *)cc, n_desks * 2);
 
    a = XInternAtom(disp, "ENL_INTERNAL_DESK_DATA", False);
    cc[0] = DesksGetCurrent();
    XChangeProperty(disp, VRoot.win, a, XA_CARDINAL, 32, PropModeReplace,
                   (unsigned char *)cc, 1);
+
+   Efree(cc);
 }
 
 void
@@ -1074,9 +1081,11 @@
    Atom                a, a2;
    CARD32             *c;
    unsigned long       lnum, ldummy;
-   int                 num, dummy, i;
+   int                 num, dummy, i, n_desks;
    unsigned char      *puc;
 
+   n_desks = DesksGetNumber();
+
    a = XInternAtom(disp, "ENL_INTERNAL_AREA_DATA", False);
    puc = NULL;
    XGetWindowProperty(disp, VRoot.win, a, 0, 0xffff, False, XA_CARDINAL, &a2,
@@ -1087,7 +1096,7 @@
      {
        for (i = 0; i < (num / 2); i++)
          {
-            if (i < Conf.desks.num)
+            if (i < n_desks)
                DeskSetArea(i, c[(i * 2)], c[(i * 2) + 1]);
          }
        XFree(c);




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to