Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        backgrounds.c backgrounds.h desktops.c desktops.h ecompmgr.c 


Log Message:
Fix external background on root at startup with CM enabled. Cleanups.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/backgrounds.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- backgrounds.c       27 Feb 2006 19:14:25 -0000      1.61
+++ backgrounds.c       1 Mar 2006 21:57:50 -0000       1.62
@@ -63,6 +63,9 @@
 static Ecore_List  *bg_list = NULL;
 static unsigned int bg_seq_no = 0;
 
+#define N_BG_ASSIGNED 32
+static Background  *bg_assigned[N_BG_ASSIGNED];
+
 char               *
 BackgroundGetUniqueString(const Background * bg)
 {
@@ -337,7 +340,7 @@
    return ecore_list_find(bg_list, _BackgroundMatchName, name);
 }
 
-Background         *
+static Background  *
 BackgroundCheck(Background * bg)
 {
    return ecore_list_goto(bg_list, bg);
@@ -1121,7 +1124,7 @@
    ECORE_LIST_FOR_EACH(bg_list, bg) BackgroundInvalidate(bg, refresh);
 }
 
-Background         *
+static Background  *
 BackgroundGetRandom(void)
 {
    Background         *bg;
@@ -1140,6 +1143,32 @@
    return bg;
 }
 
+void
+BackgroundSetForDesk(Background * bg, unsigned int desk)
+{
+   if (desk >= N_BG_ASSIGNED)
+      return;
+
+   bg_assigned[desk] = bg;
+}
+
+Background         *
+BackgroundGetForDesk(unsigned int desk)
+{
+   Background         *bg;
+
+   if (desk >= N_BG_ASSIGNED)
+      return NULL;
+
+   bg = bg_assigned[desk];
+   if (bg)
+      bg = BackgroundCheck(bg);
+   if (!bg)
+      bg = BackgroundGetRandom();
+
+   return bg;
+}
+
 /*
  * Config load/save
  */
@@ -1262,20 +1291,18 @@
 
          case BG_DESKNUM:
             desk = atoi(s2);
-            if (desk < DesksGetNumber())
+            if (desk >= N_BG_ASSIGNED)
+               break;
+            if (!bg_assigned[desk] || Conf.backgrounds.user)
               {
-                 if ((DeskBackgroundGet(DeskGet(desk)) == NULL) ||
-                     (Conf.backgrounds.user))
+                 if (!ignore)
                    {
-                      if (!ignore)
-                        {
-                           if (!bg)
-                              bg = BackgroundCreate(name, &xclr, bg1, i1, i2,
-                                                    i3, i4, i5, i6, bg2, j1,
-                                                    j2, j3, j4, j5);
-                        }
-                      DeskBackgroundAssign(desk, bg);
+                      if (!bg)
+                         bg = BackgroundCreate(name, &xclr, bg1, i1, i2,
+                                               i3, i4, i5, i6, bg2, j1,
+                                               j2, j3, j4, j5);
                    }
+                 bg_assigned[desk] = bg;
               }
             break;
 
@@ -1434,13 +1461,9 @@
          }
 #endif
 
-       for (j = 0; j < DesksGetNumber(); j++)
+       for (j = 0; j < N_BG_ASSIGNED; j++)
          {
-            Desk               *dsk = DeskGet(j);
-
-            if (BackgroundIsNone(bg) && !DeskBackgroundGet(dsk))
-               fprintf(fs, "564 %d\n", j);
-            if (DeskBackgroundGet(dsk) == bg)
+            if (bg == bg_assigned[j])
                fprintf(fs, "564 %d\n", j);
          }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/backgrounds.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- backgrounds.h       27 Feb 2006 19:14:25 -0000      1.8
+++ backgrounds.h       1 Mar 2006 21:57:50 -0000       1.9
@@ -28,8 +28,7 @@
 
 /* backgrounds.c */
 Background         *BackgroundFind(const char *name);
-Background         *BackgroundCheck(Background * bg);
-Background         *BackgroundGetRandom(void);
+
 char               *BackgroundGetUniqueString(const Background * bg);
 void                BackgroundPixmapSet(Background * bg, Pixmap pmap);
 void                BackgroundDestroyByName(const char *name);
@@ -54,6 +53,9 @@
                                               const char *file, char *thumb,
                                               int thlen);
 
+void                BackgroundSetForDesk(Background * bg, unsigned int desk);
+Background         *BackgroundGetForDesk(unsigned int desk);
+
 void                BackgroundsInvalidate(int refresh);
 int                 BackgroundsConfigLoad(FILE * fs);
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -3 -r1.227 -r1.228
--- desktops.c  27 Feb 2006 21:25:38 -0000      1.227
+++ desktops.c  1 Mar 2006 21:57:50 -0000       1.228
@@ -53,7 +53,6 @@
    Desk               *previous;
    Desk               *desk[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
    unsigned int        order[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
-   Background         *bg[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
    int                 drag_x0, drag_y0;
 }
 Desktops;
@@ -370,11 +369,7 @@
    DeskControlsCreate(dsk);
    DeskControlsShow(dsk, 1);
 
-   bg = desks.bg[dsk->num];
-   if (bg)
-      bg = BackgroundCheck(bg);
-   if (!bg)
-      bg = BackgroundGetRandom();
+   bg = BackgroundGetForDesk(dsk->num);
    DeskBackgroundSet(dsk, bg);
 
    if (dsk->num > 0)
@@ -427,8 +422,6 @@
        EventCallbackRegister(EobjGetWin(eo), 0, DeskHandleEvents, dsk);
        dsk->bg.o_bg = eo;
 #endif
-       if (Mode.root.ext_pmap_valid)
-          dsk->bg.pmap_set = Mode.root.ext_pmap;
 #endif
      }
    else
@@ -500,15 +493,6 @@
    return EobjGetWin(dsk->bg.o);
 }
 
-void
-DeskBackgroundAssign(unsigned int desk, Background * bg)
-{
-   if (desk >= ENLIGHTENMENT_CONF_NUM_DESKTOPS)
-      return;
-
-   desks.bg[desk] = bg;
-}
-
 Background         *
 DeskBackgroundGet(const Desk * dsk)
 {
@@ -677,6 +661,7 @@
    if (!dsk)
       return;
 
+   BackgroundSetForDesk(bg, dsk->num);
    if (bg && BackgroundIsNone(bg))
       bg = NULL;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- desktops.h  27 Feb 2006 21:25:38 -0000      1.24
+++ desktops.h  1 Mar 2006 21:57:50 -0000       1.25
@@ -79,8 +79,6 @@
 void                DeskRestack(Desk * dsk);
 Window              DeskGetBackgroundWin(const Desk * dsk);
 
-void                DeskBackgroundAssign(unsigned int desk,
-                                        struct _background *bg);
 struct _background *DeskBackgroundGet(const Desk * dsk);
 void                DeskBackgroundSet(Desk * dsk, struct _background *bg);
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -3 -r1.98 -r1.99
--- ecompmgr.c  27 Feb 2006 19:14:25 -0000      1.98
+++ ecompmgr.c  1 Mar 2006 21:57:50 -0000       1.99
@@ -29,7 +29,6 @@
 
 #include "E.h"
 #if USE_COMPOSITE
-#include "backgrounds.h"
 #include "desktops.h"
 #include "ecompmgr.h"
 #include "emodule.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