Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
      Tag: branch-exp
        E.h alert.c backgrounds.c config.c cursors.c draw.c ewins.c 
        extinitwin.c fx.c iclass.c iconify.c ipc.c main.c menus-misc.c 
        menus.c mod-menus.c mod-misc.c pager.c setup.c sound.c text.c 
        theme.c 


Log Message:
Shuffle, fix.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.314.2.42
retrieving revision 1.314.2.43
diff -u -3 -r1.314.2.42 -r1.314.2.43
--- E.h 17 Sep 2004 16:13:41 -0000      1.314.2.42
+++ E.h 18 Sep 2004 13:32:25 -0000      1.314.2.43
@@ -1491,9 +1491,13 @@
 /* config.c */
 int                 ConfigSkipIfExists(FILE * fs, const char *name, int type);
 char               *GetLine(char *s, int size, FILE * f);
-char               *FindFile(const char *file);
-int                 LoadConfigFile(const char *file);
-int                 LoadEConfig(void);
+void                ConfigAlertLoad(const char *txt);
+char               *FindFile(const char *file, const char *themepath);
+char               *ThemeFileFind(const char *file);
+char               *ConfigFileFind(const char *name, const char *themepath);
+int                 ConfigFileLoad(const char *name, const char *themepath,
+                                  int (*parse) (FILE * fs));
+int                 ThemeConfigLoad(void);
 void                SaveUserControlConfig(FILE * autosavefile);
 void                RecoverUserConfig(void);
 
@@ -1515,16 +1519,10 @@
 #define ECSR_ACT_MOVE       4
 #define ECSR_ACT_RESIZE     5
 #define ECSR_COUNT          6
-void                ECursorsInit(void);
-ECursor            *ECursorCreate(const char *name, const char *image,
-                                 int native_id, XColor * fg, XColor * bg);
-void                ECursorDestroy(ECursor * ec);
-int                 ECursorConfigLoad(FILE * fs);
+
 void                ECursorApply(ECursor * ec, Window win);
 void                ECursorIncRefcount(ECursor * ec);
 void                ECursorDecRefcount(ECursor * ec);
-int                 ECursorGetRefcount(ECursor * ec);
-const char         *ECursorGetName(ECursor * ec);
 Cursor              ECsrGet(int which);
 void                ECsrApply(int which, Window win);
 
@@ -2254,6 +2252,7 @@
                             int y, int w, int h, int fsize, int justification);
 
 /* theme.c */
+void                ThemePathFind(void);
 char              **ThemesList(int *num);
 
 /* timers.c */
@@ -2409,6 +2408,9 @@
 
 #endif
 
+#define _EFREE(p) do { if (p) { Efree(p); p = NULL; } } while (0)
+#define _EFDUP(p, s) do { if (p) Efree(p); p = Estrdup(s); } while (0)
+
 #if USE_LIBC_STRDUP
 #define Estrdup(s) ((s) ? strdup(s) : NULL)
 #else
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/alert.c,v
retrieving revision 1.34.2.4
retrieving revision 1.34.2.5
diff -u -3 -r1.34.2.4 -r1.34.2.5
--- alert.c     17 Sep 2004 16:13:42 -0000      1.34.2.4
+++ alert.c     18 Sep 2004 13:32:25 -0000      1.34.2.5
@@ -276,7 +276,7 @@
       XSetForeground(dd, gc, att.border_pixel);
 
    xfs = XCreateFontSet(dd, "-*-sans unicode-*-r-*-*-12-*-*-*-*-*-*-*,"
-                           "-*-helvetica-*-r-*-*-12-*-*-*-*-*-*-*,fixed",
+                       "-*-helvetica-*-r-*-*-12-*-*-*-*-*-*-*,fixed",
                        &missing_charset_list_return,
                        &missing_charset_count_return, &def_string_return);
    if (!xfs)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/backgrounds.c,v
retrieving revision 1.5.2.8
retrieving revision 1.5.2.9
diff -u -3 -r1.5.2.8 -r1.5.2.9
--- backgrounds.c       7 Sep 2004 20:06:53 -0000       1.5.2.8
+++ backgrounds.c       18 Sep 2004 13:32:25 -0000      1.5.2.9
@@ -73,7 +73,7 @@
      {
        char               *f;
 
-       f = FindFile(bg->bg.file);
+       f = ThemeFileFind(bg->bg.file);
        if (f)
          {
             f1 = fileinode(f);
@@ -86,7 +86,7 @@
      {
        char               *f;
 
-       f = FindFile(bg->top.file);
+       f = ThemeFileFind(bg->top.file);
        if (f)
          {
             f4 = fileinode(f);
@@ -241,7 +241,7 @@
    /* And delete the actual image files */
    if (bg->bg.file)
      {
-       f = FindFile(bg->bg.file);
+       f = ThemeFileFind(bg->bg.file);
        if (f)
          {
             E_rm(f);
@@ -250,7 +250,7 @@
      }
    if (bg->top.file)
      {
-       f = FindFile(bg->top.file);
+       f = ThemeFileFind(bg->top.file);
        if (f)
          {
             E_rm(f);
@@ -513,14 +513,14 @@
        if (bg->bg.file && !bg->bg.im)
          {
             if (!bg->bg.real_file)
-               bg->bg.real_file = FindFile(bg->bg.file);
+               bg->bg.real_file = ThemeFileFind(bg->bg.file);
             bg->bg.im = ELoadImage(bg->bg.real_file);
          }
 
        if (bg->top.file && !bg->top.im)
          {
             if (!bg->top.real_file)
-               bg->top.real_file = FindFile(bg->top.file);
+               bg->top.real_file = ThemeFileFind(bg->top.file);
             bg->top.im = ELoadImage(bg->top.real_file);
          }
 
@@ -958,7 +958,7 @@
                       /* check first if we can actually find the files */
                       if (bg1)
                         {
-                           tmp = FindFile(bg1);
+                           tmp = ThemeFileFind(bg1);
                            if (!tmp)
                              {
                                 ok = 0;
@@ -970,7 +970,7 @@
                         }
                       if (bg2)
                         {
-                           tmp = FindFile(bg2);
+                           tmp = ThemeFileFind(bg2);
                            if (!tmp)
                              {
                                 ok = 0;
@@ -1156,10 +1156,10 @@
        fprintf(fs, "560 %d %d %d\n", r, g, b);
 
        if ((bglist[i]->bg.file) && (!bglist[i]->bg.real_file))
-          bglist[i]->bg.real_file = FindFile(bglist[i]->bg.file);
+          bglist[i]->bg.real_file = ThemeFileFind(bglist[i]->bg.file);
 
        if ((bglist[i]->top.file) && (!bglist[i]->top.real_file))
-          bglist[i]->top.real_file = FindFile(bglist[i]->top.file);
+          bglist[i]->top.real_file = ThemeFileFind(bglist[i]->top.file);
 
        if ((bglist[i]->bg.file) && (bglist[i]->bg.real_file))
          {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.111.2.18
retrieving revision 1.111.2.19
diff -u -3 -r1.111.2.18 -r1.111.2.19
--- config.c    5 Sep 2004 22:24:35 -0000       1.111.2.18
+++ config.c    18 Sep 2004 13:32:26 -0000      1.111.2.19
@@ -24,8 +24,6 @@
 #include "conf.h"
 #include <ctype.h>
 
-static char         is_autosave = 0;
-
 #define SKIP_If_EXISTS(name, type) \
    if (ConfigSkipIfExists(ConfigFile, name, type)) return
 
@@ -174,7 +172,7 @@
    return s;
 }
 
-static void
+void
 ConfigAlertLoad(const char *txt)
 {
    RecoverUserConfig();
@@ -220,103 +218,81 @@
           "Done loading an Extras block.  Outcome is likely not good.\n"));
 }
 
-static char        *cfg_tmpfile = NULL;
-
-static FILE        *
-OpenConfigFileForReading(const char *path, char preprocess)
+static int
+ConfigFilePreparse(const char *path, const char *dest)
 {
-   /* This function will open a file at location path for */
-   /* reading. */
-   /* All output is passed through epp for preprocessing however. */
-   FILE               *fpin /*, *fpout */ ;
+   static char         have_epp = 0;
    char                execline[FILEPATH_LEN_MAX];
    const char         *epp_path = ENLIGHTENMENT_BIN "/epp";
+   char               *def_home, *def_user, *def_shell;
 
-   EDBUG(5, "OpenConfigFileForReading");
-
-   if (!path)
-      EDBUG_RETURN(0);
+   if (EventDebug(EDBUG_TYPE_CONFIG))
+      Eprintf("ConfigFilePreparse %s->%s\n", path, dest);
 
-   if (preprocess)
+   if ((!have_epp) && (!(isfile(epp_path)) && (canexec(epp_path))))
      {
-       char               *def_home, *def_user, *def_shell, *s;
-       int                 i = 0;
-       static char         have_epp = 0;
+       Alert(_("Help! Cannot find epp!\n"
+               "Enlightenment is looking for epp here:\n" "%s\n"
+               "This is a FATAL ERROR.\n"
+               "This is probably due to either the program not existing or\n"
+               "it not being able to be executed by you.\n"), epp_path);
+       SessionExit("error");
+     }
+   have_epp = 1;
+
+   def_home = homedir(getuid());
+   def_user = username(getuid());
+   def_shell = usershell(getuid());
+
+   Esnprintf(execline, sizeof(execline), "%s " "-P " "-nostdinc " "-undef "
+            "-include %s/config/definitions " "-I%s " "-I%s/config "
+            "-D ENLIGHTENMENT_VERSION=%s " "-D ENLIGHTENMENT_ROOT=%s "
+            "-D ENLIGHTENMENT_BIN=%s "
+            "-D ENLIGHTENMENT_THEME=%s " "-D ECONFDIR=%s "
+            "-D ECACHEDIR=%s " "-D SCREEN_RESOLUTION_%ix%i=1 "
+            "-D SCREEN_WIDTH_%i=1 " "-D SCREEN_HEIGHT_%i=1 "
+            "-D SCREEN_DEPTH_%i=1 " "-D USER_NAME=%s " "-D HOME_DIR=%s "
+            "-D USER_SHELL=%s " "-D ENLIGHTENMENT_VERSION_015=1 "
+            "%s %s",
+            epp_path, EDirRoot(), Mode.theme.path, EDirRoot(),
+            ENLIGHTENMENT_VERSION, EDirRoot(), EDirBin(),
+            Mode.theme.path, EDirUser(), EDirUserCache(), VRoot.w,
+            VRoot.h, VRoot.w, VRoot.h, VRoot.depth, def_user, def_home,
+            def_shell, path, dest);
+   system(execline);
+
+   if (def_user)
+      Efree(def_user);
+   if (def_shell)
+      Efree(def_shell);
+   if (def_home)
+      Efree(def_home);
 
-       if ((!have_epp) && (!(isfile(epp_path)) && (canexec(epp_path))))
-         {
-            Alert(_("Help! Cannot find epp!\n"
-                    "Enlightenment is looking for epp here:\n" "%s\n"
-                    "This is a FATAL ERROR.\n"
-                    "This is probably due to either the program not existing or\n"
-                    "it not being able to be executed by you.\n"), epp_path);
-            SessionExit("error");
-         }
-       else
-          have_epp = 1;
-
-       def_home = homedir(getuid());
-       def_user = username(getuid());
-       def_shell = usershell(getuid());
-
-       s = Estrdup(path);
-       while (s[i])
-         {
-            if (s[i] == '/')
-               s[i] = '.';
-            i++;
-         }
-       Esnprintf(execline, sizeof(execline), "%s " "-P " "-nostdinc " "-undef "
-                 "-include %s/config/definitions " "-I%s " "-I%s/config "
-                 "-D ENLIGHTENMENT_VERSION=%s " "-D ENLIGHTENMENT_ROOT=%s "
-                 "-D ENLIGHTENMENT_BIN=%s "
-                 "-D ENLIGHTENMENT_THEME=%s " "-D ECONFDIR=%s "
-                 "-D ECACHEDIR=%s " "-D SCREEN_RESOLUTION_%ix%i=1 "
-                 "-D SCREEN_WIDTH_%i=1 " "-D SCREEN_HEIGHT_%i=1 "
-                 "-D SCREEN_DEPTH_%i=1 " "-D USER_NAME=%s " "-D HOME_DIR=%s "
-                 "-D USER_SHELL=%s " "-D ENLIGHTENMENT_VERSION_015=1 "
-                 "%s %s/cached/cfg/%s.preparsed",
-                 epp_path, EDirRoot(), Mode.theme.path, EDirRoot(),
-                 ENLIGHTENMENT_VERSION, EDirRoot(), EDirBin(),
-                 Mode.theme.path, EDirUser(), EDirUserCache(), VRoot.w,
-                 VRoot.h, VRoot.w, VRoot.h, VRoot.depth, def_user, def_home,
-                 def_shell, path, EDirUserCache(), s);
-       system(execline);
-       Esnprintf(execline, sizeof(execline), "%s/cached/cfg/%s.preparsed",
-                 EDirUserCache(), s);
-       fpin = fopen(execline, "r");
-       if (s)
-          Efree(s);
-       if (def_user)
-          Efree(def_user);
-       if (def_shell)
-          Efree(def_shell);
-       if (def_home)
-          Efree(def_home);
-       EDBUG_RETURN(fpin);
-     }
-   else
-     {
-       fpin = fopen(path, "r");
-       EDBUG_RETURN(fpin);
-     }
-   EDBUG_RETURN(0);
+   return exists(dest) ? 0 : 1;
 }
 
 /* Split the process of finding the file from the process of loading it */
-static int
-LoadOpenConfigFile(FILE * ConfigFile)
+static void
+ConfigFileRead(const char *name)
 {
+   FILE               *fs;
    int                 err;
    int                 i1, i2, fields;
    char                s[FILEPATH_LEN_MAX];
    int                 e_cfg_ver = 0;
    int                 min_e_cfg_ver = 0;
 
-   if (!ConfigFile)
-      return 0;
+   if (!name)
+      return;
 
-   while (GetLine(s, sizeof(s), ConfigFile))
+   if (EventDebug(EDBUG_TYPE_CONFIG))
+      Eprintf("ConfigFileRead %s\n", name);
+
+   fs = fopen(name, "r");
+   if (!fs)
+      return;
+
+   while (GetLine(s, sizeof(s), fs))
      {
        if (IsWhitespace(s))
           continue;
@@ -351,169 +327,123 @@
          {
             if (e_cfg_ver != min_e_cfg_ver)
               {
-                 if (!is_autosave)
-                   {
-                      AlertX(_("Theme versioning ERROR"),
-                             _("Restart with Defaults"), " ",
-                             _("Abort and Exit"),
-                             _("ERROR:\n" "\n"
-                               "The configuration for the theme you are "
-                               "running is\n"
-                               "incompatible. It's config revision is %i.  "
-                               "It needs to\n"
-                               "be marked as being revision %i\n" "\n"
-                               "Please contact the theme author or "
-                               "maintainer and\n"
-                               "inform them that in order for their theme "
-                               "to function\n"
-                               "with this version of Enlightenment, they "
-                               "have to\n"
-                               "update it to the current settings, and "
-                               "then match\n" "the revision number.\n" "\n"
-                               "If the theme revision is higher than "
-                               "Enlightenment's\n"
-                               "it may be that you haven't upgraded "
-                               "Enlightenment for\n"
-                               "a while and this theme takes advantages of new\n"
-                               "features in Enlightenment in new versions.\n"),
-                             e_cfg_ver, min_e_cfg_ver);
-                      SessionExit("restart_theme DEFAULT");
-                   }
-                 else
-                   {
-                      Conf.autosave = 0;
-                      AlertX(_("User Config Version ERROR"),
-                             _("Restart with Defaults"), " ",
-                             _("Abort and Exit"),
-                             _("ERROR:\n" "\n"
-                               "The settings you are using are "
-                               "incompatible with\n"
-                               "this version of Enlightenment.\n"
-                               "It's revision is %i It needs to be revision "
-                               "%i to\n" "be compatible.\n" "\n"
-                               "If you just upgraded to a new version of E\n"
-                               "Restarting with Defaults will remove your current\n"
-                               "user preferences and start cleanly with system\n"
-                               "defaults. You can then modify your "
-                               "configuration to\n"
-                               "your liking again safely.\n"), e_cfg_ver,
-                             min_e_cfg_ver);
-                      SessionExit("restart");
-                   }
+                 AlertX(_("Theme versioning ERROR"),
+                        _("Restart with Defaults"), " ",
+                        _("Abort and Exit"),
+                        _("ERROR:\n" "\n"
+                          "The configuration for the theme you are "
+                          "running is\n"
+                          "incompatible. It's config revision is %i.  "
+                          "It needs to\n"
+                          "be marked as being revision %i\n" "\n"
+                          "Please contact the theme author or "
+                          "maintainer and\n"
+                          "inform them that in order for their theme "
+                          "to function\n"
+                          "with this version of Enlightenment, they "
+                          "have to\n"
+                          "update it to the current settings, and "
+                          "then match\n" "the revision number.\n" "\n"
+                          "If the theme revision is higher than "
+                          "Enlightenment's\n"
+                          "it may be that you haven't upgraded "
+                          "Enlightenment for\n"
+                          "a while and this theme takes advantages of new\n"
+                          "features in Enlightenment in new versions.\n"),
+                        e_cfg_ver, min_e_cfg_ver);
+                 SessionExit("restart_theme DEFAULT");
               }
             else
               {
                  switch (i1)
                    {
                    case CONFIG_CLOSE:
-                      if (pclose(ConfigFile) == -1)
-                         fclose(ConfigFile);
-                      EDBUG_RETURN(1);
+                      goto done;
+
                    case CONFIG_IMAGECLASS:
-                      err = ModuleConfigLoad("ic", ConfigFile);
+                      err = ModuleConfigLoad("ic", fs);
                       if (err)
                          ConfigAlertLoad(_("Image class"));
                       break;
-                   case CONFIG_FX:
-                      /* Ignore */
-                      break;
                    case CONFIG_EXTRAS:
-                      Config_Extras(ConfigFile);
+                      Config_Extras(fs);
                       break;
                    case CONFIG_TOOLTIP:
-                      err = ModuleConfigLoad("tt", ConfigFile);
+                      err = ModuleConfigLoad("tt", fs);
                       if (err)
                          ConfigAlertLoad(_("Tooltip"));
                       break;
                    case CONFIG_TEXT:
-                      err = ModuleConfigLoad("tc", ConfigFile);
+                      err = ModuleConfigLoad("tc", fs);
                       if (err)
                          ConfigAlertLoad(_("Text class"));
                       break;
-                   case CONFIG_MENU:
-                      err = MenuConfigLoad(ConfigFile);
-                      if (err)
-                         ConfigAlertLoad(_("Menu"));
-                      break;
                    case MENU_STYLE:
-                      err = MenuStyleConfigLoad(ConfigFile);
+                      err = MenuStyleConfigLoad(fs);
                       if (err)
                          ConfigAlertLoad(_("Menu style"));
                       break;
                    case CONFIG_BORDER:
-                      err = BorderConfigLoad(ConfigFile);
+                      err = BorderConfigLoad(fs);
                       if (err)
                          ConfigAlertLoad(_("Border"));
                       break;
                    case CONFIG_BUTTON:
-                      err = ModuleConfigLoad("btn", ConfigFile);
+                      err = ModuleConfigLoad("btn", fs);
                       if (err)
                          ConfigAlertLoad(_("Button"));
                       break;
                    case CONFIG_DESKTOP:
-                      err = ModuleConfigLoad("bg", ConfigFile);
+                      err = ModuleConfigLoad("bg", fs);
                       if (err)
                          ConfigAlertLoad(_("Background"));
                       break;
+#if 1                          /* FIXME - Doesn't belong here */
                    case CONFIG_IBOX:
                    case CONFIG_ICONBOX:
-                      err = ModuleConfigLoad("ibox", ConfigFile);
+                      err = ModuleConfigLoad("ibox", fs);
                       if (err)
                          ConfigAlertLoad(_("Iconbox"));
                       break;
-                   case CONFIG_CONTROL:
-#if 0
-                      Config_Control(ConfigFile);
 #endif
+#if 0
+                   case CONFIG_CONTROL:
+                      Config_Control(fs);
                       break;
+#endif
                    case CONFIG_WINDOWMATCH:
-                      err = WindowMatchConfigLoad(ConfigFile);
+                      err = WindowMatchConfigLoad(fs);
                       if (err)
                          ConfigAlertLoad(_("Window match"));
                       break;
                    case CONFIG_COLORMOD:
-#if 0                          // FIXME
-                      Config_ColorModifier(ConfigFile);
+#if 0                          /* FIXME - ? */
+                      Config_ColorModifier(fs);
 #endif
                       break;
-                   case CONFIG_SOUND:
-                      err = ModuleConfigLoad("sound", ConfigFile);
-                      if (err)
-                         ConfigAlertLoad(_("Sound"));
-                      break;
                    case CONFIG_ACTIONCLASS:
-                      err = ActionClassConfigLoad(ConfigFile);
+                      err = ActionClassConfigLoad(fs);
                       if (err)
                          ConfigAlertLoad(_("Action class"));
                       break;
                    case CONFIG_SLIDEOUT:
-                      err = ModuleConfigLoad("slideouts", ConfigFile);
+                      err = ModuleConfigLoad("slideouts", fs);
                       if (err)
                          ConfigAlertLoad(_("Slideout"));
                       break;
-                   case CONFIG_CURSOR:
-                      err = ECursorConfigLoad(ConfigFile);
-                      if (err)
-                         ConfigAlertLoad(_("Cursor"));
-                      break;
                    default:
                       break;
                    }
               }
          }
      }
-   fclose(ConfigFile);
-   if (cfg_tmpfile)
-     {
-       E_rm(cfg_tmpfile);
-       Efree(cfg_tmpfile);
-       cfg_tmpfile = NULL;
-     }
-   EDBUG_RETURN(1);
+
+ done:
+   fclose(fs);
 }
 
 char               *
-FindFile(const char *file)
+FindFile(const char *file, const char *themepath)
 {
    char                s[FILEPATH_LEN_MAX];
 
@@ -533,10 +463,13 @@
    if (findLocalizedFile(s) || isfile(s))
       EDBUG_RETURN(Estrdup(s));
 
-   /* look in theme dir */
-   Esnprintf(s, sizeof(s), "%s/%s", Mode.theme.path, file);
-   if (findLocalizedFile(s) || isfile(s))
-      EDBUG_RETURN(Estrdup(s));
+   if (themepath)
+     {
+       /* look in theme dir */
+       Esnprintf(s, sizeof(s), "%s/%s", themepath, file);
+       if (findLocalizedFile(s) || isfile(s))
+          EDBUG_RETURN(Estrdup(s));
+     }
 
    /* look in system config dir */
    Esnprintf(s, sizeof(s), "%s/config/%s", EDirRoot(), file);
@@ -547,110 +480,112 @@
    EDBUG_RETURN(NULL);
 }
 
-static char        *
-FindNoThemeFile(const char *file)
+char               *
+ThemeFileFind(const char *file)
+{
+   return FindFile(file, Mode.theme.path);
+}
+
+char               *
+ConfigFileFind(const char *name, const char *themepath)
 {
    char                s[FILEPATH_LEN_MAX];
+   char               *fullname, *file, *ppfile;
+   int                 i, err;
 
-   EDBUG(6, "FindFile");
+   EDBUG(5, "FindConfigFile");
 
-   /* if absolute path - and file exists - return it */
-   if (isabspath(file))
+   fullname = FindFile(name, themepath);
+   if (!fullname)
+      EDBUG_RETURN(NULL);
+
+   /* The file exists. Now check the preparsed one. */
+   file = Estrdup(fullname);
+   for (i = 0; file[i]; i++)
+      if (file[i] == '/')
+        file[i] = '.';
+
+   Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", EDirUserCache(), file);
+   ppfile = Estrdup(s);
+   if (exists(s) && moddate(s) > moddate(fullname))
+      goto done;
+
+   /* No preparesd file or source is newer. Do preparsing. */
+   err = ConfigFilePreparse(fullname, ppfile);
+   if (err)
      {
-       strcpy(s, file);
-       if (findLocalizedFile(s) || isfile(s))
-          EDBUG_RETURN(Estrdup(s));
+       Efree(ppfile);
+       ppfile = NULL;
      }
 
-   /* look in ~/.e16 first */
-   Esnprintf(s, sizeof(s), "%s/%s", EDirUser(), file);
-   if (findLocalizedFile(s) || isfile(s))
-      EDBUG_RETURN(Estrdup(s));
-
-   /* look in system config dir */
-   Esnprintf(s, sizeof(s), "%s/config/%s", EDirRoot(), file);
-   if (findLocalizedFile(s) || isfile(s))
-      EDBUG_RETURN(Estrdup(s));
-
-   /* not found.... NULL */
-   EDBUG_RETURN(NULL);
+ done:
+   Efree(fullname);
+   Efree(file);
+   return ppfile;
 }
 
 int
-LoadConfigFile(const char *f)
+ConfigFileLoad(const char *name, const char *themepath,
+              int (*parse) (FILE * fs))
 {
-   FILE               *ConfigFile;
-   char                s[FILEPATH_LEN_MAX], s2[FILEPATH_LEN_MAX];
-   char               *file, *ppfile;
-   int                 i;
-   char                notheme = 0;
+   int                 err = -1;
+   char               *file;
+   FILE               *fs;
 
-   EDBUG(5, "LoadConfigFile");
+   if (EventDebug(EDBUG_TYPE_CONFIG))
+      Eprintf("ConfigFileLoad %s\n", name);
 
-   Esnprintf(s, sizeof(s), "%s", f);
-   file = FindFile(s);
+   file = ConfigFileFind(name, themepath);
    if (!file)
-      EDBUG_RETURN(0);
+      goto done;
+   fs = fopen(file, "r");
+   Efree(file);
+   if (!fs)
+      goto done;
 
-   strcpy(s2, file);
-   i = 0;
+   err = parse(fs);
 
-   while (s2[i])
-     {
-       if (s2[i] == '/')
-          s2[i] = '.';
-       i++;
-     }
+   fclose(fs);
 
-   Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", EDirUserCache(), s2);
+ done:
+   return err;
+}
 
-   if (strstr(f, "control.cfg"))
-      notheme = 1;
-   else if (strstr(f, "menus.cfg"))
-      notheme = 1;
-   else if (strstr(f, "keybindings.cfg"))
-      notheme = 1;
-   if (notheme)
-      ppfile = FindNoThemeFile(s);
-   else
-      ppfile = FindFile(s);
-
-   if (!ppfile)
-     {
-       if (file)
-          Efree(file);
-       if (notheme)
-          file = FindNoThemeFile(f);
-       else
-          file = FindFile(f);
-     }
-   if ((ppfile) && (exists(ppfile)) && (moddate(file) < moddate(ppfile)))
-      ConfigFile = OpenConfigFileForReading(ppfile, 0);
-   else
-      ConfigFile = OpenConfigFileForReading(file, 1);
-   if (ppfile)
-      Efree(ppfile);
-   if (file)
-      Efree(file);
-   return LoadOpenConfigFile(ConfigFile);
+static void
+ThemeConfigFileLoad(const char *name)
+{
+   char               *themepath, *file;
+
+   if (EventDebug(EDBUG_TYPE_CONFIG))
+      Eprintf("ThemeConfigFileLoad %s\n", name);
+
+   themepath = Mode.theme.path;
+
+   if (strstr(name, "keybindings.cfg"))
+      themepath = NULL;
+
+   file = ConfigFileFind(name, themepath);
+   if (!file)
+      return;
+
+   ConfigFileRead(file);
+
+   Efree(file);
 }
 
 int
-LoadEConfig(void)
+ThemeConfigLoad(void)
 {
    static const char  *const config_files[] = {
       "init.cfg",
-      "control.cfg",
       "textclasses.cfg",
       "backup-textclasses.cfg",
       "colormodifiers.cfg",
       "backup-colormodifiers.cfg",
       "imageclasses.cfg",
       "backup-imageclasses.cfg",
-      "sound.cfg",
       "desktops.cfg",
       "actionclasses.cfg",
-      "cursors.cfg",
       "backup-cursors.cfg",
       "buttons.cfg",
       "slideouts.cfg",
@@ -660,15 +595,16 @@
       "tooltips.cfg",
       "backup-tooltips.cfg",
       "menustyles.cfg",
+#if 1                          /* FIXME - Remove */
       "keybindings.cfg",
-      "...e_autosave.cfg",
-      "menus.cfg"
+      "...e_autosave.cfg",     /* FIXME - Don't preparse */
+#endif
    };
    char                s[FILEPATH_LEN_MAX];
    Progressbar        *p = NULL;
    int                 i;
 
-   EDBUG(5, "LoadEConfig");
+   EDBUG(5, "ThemeConfigLoad");
 
    Esnprintf(s, sizeof(s), "%s/", Mode.theme.path);
 
@@ -690,19 +626,9 @@
          }
 
        if (!strcmp(config_files[i], "...e_autosave.cfg"))
-         {
-            is_autosave = 1;
-            /* This file is always preprocessed at a known location: */
-            /*          
-             * if (exists(GetSMFile()))
-             * LoadOpenConfigFile(OpenConfigFileForReading(GetSMFile(), 0));
-             * else */
-            EDBUG(5, "Dummy-LoadOpenConfigFile");
-            LoadOpenConfigFile(OpenConfigFileForReading(EGetSavePrefix(), 0));
-            is_autosave = 0;
-         }
+          ThemeConfigFileLoad(EGetSavePrefix());
        else
-          LoadConfigFile(config_files[i]);
+          ThemeConfigFileLoad(config_files[i]);
 
        if (p)
           ProgressbarSet(p, (i * 100) /
@@ -829,23 +755,20 @@
 {
    int                 save;
 
-   if (is_autosave)
-     {
-       /* Don't save settings if we restart or quit */
-       save = Conf.autosave;
-       Conf.autosave = 0;
-
-       AlertX(_("Recover system config?"), _("Yes, Attempt recovery"),
-              _("Restart and try again"), _("Quit and give up"),
-              _
-              ("Enlightenment has encountered parsing errors in your autosaved\n"
-               "configuration.\n" "\n"
-               "This may be due to filing system errors, Minor bugs or "
-               "unforeseen\n" "system shutdowns.\n" "\n"
-               "Do you wish Enlightenment to recover its original system\n"
-               "configuration and try again?\n"));
+   /* Don't save settings if we restart or quit */
+   save = Conf.autosave;
+   Conf.autosave = 0;
+
+   AlertX(_("Recover system config?"), _("Yes, Attempt recovery"),
+         _("Restart and try again"), _("Quit and give up"),
+         _
+         ("Enlightenment has encountered parsing errors in your autosaved\n"
+          "configuration.\n" "\n"
+          "This may be due to filing system errors, Minor bugs or "
+          "unforeseen\n" "system shutdowns.\n" "\n"
+          "Do you wish Enlightenment to recover its original system\n"
+          "configuration and try again?\n"));
 
-       /* Allow settings to be saved if we continue */
-       Conf.autosave = save;
-     }
+   /* Allow settings to be saved if we continue */
+   Conf.autosave = save;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/cursors.c,v
retrieving revision 1.20.2.3
retrieving revision 1.20.2.4
diff -u -3 -r1.20.2.3 -r1.20.2.4
--- cursors.c   25 Aug 2004 21:56:57 -0000      1.20.2.3
+++ cursors.c   18 Sep 2004 13:32:26 -0000      1.20.2.4
@@ -38,7 +38,7 @@
 #endif
 };
 
-ECursor            *
+static ECursor     *
 ECursorCreate(const char *name, const char *image, int native_id, XColor * fg,
              XColor * bg)
 {
@@ -54,7 +54,7 @@
 
    if (image)
      {
-       img = FindFile(image);
+       img = FindFile(image, Mode.theme.path);
        if (!img)
           return NULL;
 
@@ -106,7 +106,7 @@
    return ec;
 }
 
-void
+static void
 ECursorDestroy(ECursor * ec)
 {
    if (!ec)
@@ -128,53 +128,64 @@
    Efree(ec);
 }
 
-int
+static int
 ECursorConfigLoad(FILE * fs)
 {
    int                 err = 0;
    XColor              xclr, xclr2;
    char                s[FILEPATH_LEN_MAX];
    char                s2[FILEPATH_LEN_MAX];
-   int                 ii1, r, g, b;
+   int                 i1, i2, r, g, b;
    char               *file = NULL, *name = NULL;
    int                 native_id = -1;
-   ECursor            *ec = NULL;
    int                 fields;
 
-   ESetColor(&xclr, 0, 0, 0);
-   ESetColor(&xclr2, 255, 255, 255);
-
    while (GetLine(s, sizeof(s), fs))
      {
        s2[0] = 0;
-       ii1 = CONFIG_INVALID;
-       fields = sscanf(s, "%i %4000s", &ii1, s2);
+       i1 = CONFIG_INVALID;
+       fields = sscanf(s, "%i %4000s", &i1, s2);
 
        if (fields < 1)
-          ii1 = CONFIG_INVALID;
-       else if (ii1 == CONFIG_CLOSE)
+         {
+            i1 = CONFIG_INVALID;
+         }
+       else if (i1 == CONFIG_CLOSE)
          {
             if (fields != 1)
                Alert(_("CONFIG: ignoring extra data in \"%s\"\n"), s);
          }
-       else if (ii1 != CONFIG_INVALID)
+       else if (i1 != CONFIG_INVALID)
          {
             if (fields != 2)
               {
                  Alert(_("CONFIG: missing required data in \"%s\"\n"), s);
+                 continue;
               }
          }
-       switch (ii1)
+
+       switch (i1)
          {
+         case CONFIG_CURSOR:
+            err = -1;
+            i2 = atoi(s2);
+            if (i2 != CONFIG_OPEN)
+               goto done;
+            ESetColor(&xclr, 0, 0, 0);
+            ESetColor(&xclr2, 255, 255, 255);
+            _EFREE(file);
+            _EFREE(name);
+            native_id = -1;
+            break;
          case CONFIG_CLOSE:
-            ec = ECursorCreate(name, file, native_id, &xclr, &xclr2);
-            goto done;
+            ECursorCreate(name, file, native_id, &xclr, &xclr2);
+            err = 0;
+            break;
+
          case CONFIG_CLASSNAME:
             if (ConfigSkipIfExists(fs, s2, LIST_TYPE_ECURSOR))
                goto done;
-            if (name)
-               Efree(name);
-            name = Estrdup(s2);
+            _EFDUP(name, s2);
             break;
          case CURS_BG_RGB:
             EGetColor(&xclr, &r, &g, &b);
@@ -187,7 +198,7 @@
             ESetColor(&xclr2, r, g, b);
             break;
          case XBM_FILE:
-            file = Estrdup(s2);
+            _EFDUP(file, s2);
             break;
          case NATIVE_ID:
             sscanf(s, "%4000s %d", s2, &native_id);
@@ -196,13 +207,13 @@
             break;
          }
      }
-   err = -1;
 
  done:
-   if (name)
-      Efree(name);
-   if (file)
-      Efree(file);
+   if (err)
+      ConfigAlertLoad(_("Cursor"));
+
+   _EFREE(name);
+   _EFREE(file);
 
    return err;
 }
@@ -247,17 +258,19 @@
       ec->ref_count--;
 }
 
-const char         *
+static const char  *
 ECursorGetName(ECursor * ec)
 {
    return (ec) ? ec->name : 0;
 }
 
-int
+#if 0                          /* Not used */
+static int
 ECursorGetRefcount(ECursor * ec)
 {
    return (ec) ? ec->ref_count : 0;
 }
+#endif
 
 static Cursor       ECsrs[ECSR_COUNT];
 
@@ -276,8 +289,8 @@
 /*
  * Set up some basic cursors
  */
-void
-ECursorsInit(void)
+static void
+CursorsInit(void)
 {
    ECsrs[ECSR_NONE] = None;
    ECsrs[ECSR_ROOT] = ECursorGetByName("DEFAULT", XC_left_ptr);
@@ -286,3 +299,85 @@
    ECsrs[ECSR_ACT_MOVE] = ECursorGetByName("GRAB_MOVE", XC_fleur);
    ECsrs[ECSR_ACT_RESIZE] = ECursorGetByName("GRAB_RESIZE", XC_sizing);
 }
+
+/*
+ * Cursor module
+ */
+
+static void
+CursorSighan(int sig, void *prm __UNUSED__)
+{
+   switch (sig)
+     {
+     case ESIGNAL_INIT:
+       ConfigFileLoad("cursors.cfg", Mode.theme.path, ECursorConfigLoad);
+       CursorsInit();
+       break;
+     }
+}
+
+static void
+CursorsIpc(const char *params, Client * c __UNUSED__)
+{
+   const char         *p;
+   char                cmd[128], prm[4096];
+   int                 i, len, num;
+   ECursor            *ec;
+
+   p = NULL;
+   if (params)
+     {
+       p = params;
+       len = 0;
+       cmd[0] = prm[0] = '\0';
+       sscanf(p, "%100s %4000s %n", cmd, prm, &len);
+       p += len;
+     }
+
+   if (!strncmp(cmd, "add", 3))
+     {
+       /* TBD */
+       IpcPrintf("Not implemented\n");
+     }
+   else if (!strncmp(cmd, "del", 3))
+     {
+       ec = FindItem(prm, 0, LIST_FINDBY_NAME, LIST_TYPE_ECURSOR);
+       if (ec)
+          ECursorDestroy(ec);
+     }
+   else if (!strncmp(cmd, "list", 2))
+     {
+       ECursor           **lst;
+
+       lst = (ECursor **) ListItemType(&num, LIST_TYPE_ECURSOR);
+       for (i = 0; i < num; i++)
+         {
+            IpcPrintf("%s\n", ECursorGetName(lst[i]));
+         }
+       if (lst)
+          Efree(lst);
+     }
+}
+
+IpcItem             CursorIpcArray[] = {
+   {
+    CursorsIpc,
+    "cursor", "csr",
+    "Cursor functions",
+    "  cursor add <classname> ...        Create cursor\n"
+    "  cursor del <classname>            Delete cursor\n"
+    "  cursor list                       Show all cursors\n"}
+};
+#define N_IPC_FUNCS (sizeof(CursorIpcArray)/sizeof(IpcItem))
+
+/*
+ * Module descriptor
+ */
+EModule             ModCursors = {
+   "cursor", "csr",
+   CursorSighan,
+   NULL, NULL,
+   {N_IPC_FUNCS, CursorIpcArray}
+   ,
+   {0, NULL}
+};
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/draw.c,v
retrieving revision 1.51.2.6
retrieving revision 1.51.2.7
diff -u -3 -r1.51.2.6 -r1.51.2.7
--- draw.c      7 Sep 2004 20:06:54 -0000       1.51.2.6
+++ draw.c      18 Sep 2004 13:32:26 -0000      1.51.2.7
@@ -1768,7 +1768,7 @@
        EDBUG_RETURN(im);
      }
 
-   f = FindFile(file);
+   f = ThemeFileFind(file);
    if (f)
      {
        im = imlib_load_image(f);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewins.c,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -3 -r1.1.2.13 -r1.1.2.14
--- ewins.c     17 Sep 2004 14:28:34 -0000      1.1.2.13
+++ ewins.c     18 Sep 2004 13:32:26 -0000      1.1.2.14
@@ -1845,5 +1845,9 @@
 void
 EwinsInit(void)
 {
+   ecore_x_grab();
+   MapUnmap(0);
+   ecore_x_ungrab();
+
    EventCallbackRegister(VRoot.win, 0, EwinHandleEventsRoot, NULL);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/extinitwin.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -3 -r1.1.2.2 -r1.1.2.3
--- extinitwin.c        5 Sep 2004 22:24:35 -0000       1.1.2.2
+++ extinitwin.c        18 Sep 2004 13:32:27 -0000      1.1.2.3
@@ -121,7 +121,7 @@
           if (EventDebug(EDBUG_TYPE_SESSION))
              Eprintf("ExtInitWinCreate - child %s\n", s);
 
-          f = FindFile(s);
+          f = ThemeFileFind(s);
           im = NULL;
           if (f)
             {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/fx.c,v
retrieving revision 1.41.2.9
retrieving revision 1.41.2.10
diff -u -3 -r1.41.2.9 -r1.41.2.10
--- fx.c        7 Sep 2004 20:06:55 -0000       1.41.2.9
+++ fx.c        18 Sep 2004 13:32:27 -0000      1.41.2.10
@@ -1027,7 +1027,6 @@
    di = DialogAddItem(table, DITEM_TEXT);
    DialogItemSetPadding(di, 2, 2, 2, 2);
    DialogItemSetFill(di, 1, 0);
-// DialogItemSetAlign(di, 0, 512);
    DialogItemTextSetText(di, _("Effects"));
 #if 0                          /* Disabled */
    di = DialogAddItem(table, DITEM_CHECKBUTTON);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iclass.c,v
retrieving revision 1.46.2.6
retrieving revision 1.46.2.7
diff -u -3 -r1.46.2.6 -r1.46.2.7
--- iclass.c    7 Sep 2004 20:06:55 -0000       1.46.2.6
+++ iclass.c    18 Sep 2004 13:32:27 -0000      1.46.2.7
@@ -187,7 +187,7 @@
 
    /* not loaded, load and setup */
    if (!is->real_file)
-      is->real_file = FindFile(is->im_file);
+      is->real_file = ThemeFileFind(is->im_file);
 
    is->im = ELoadImage(is->real_file);
    imlib_context_set_image(is->im);
@@ -1358,7 +1358,7 @@
                         {
                            if (!ic->norm.normal->real_file)
                               ic->norm.normal->real_file =
-                                 FindFile(ic->norm.normal->im_file);
+                                 ThemeFileFind(ic->norm.normal->im_file);
                            if (ic->norm.normal->real_file)
                               im =
                                  imlib_load_image(ic->norm.normal->real_file);
@@ -1451,6 +1451,8 @@
                            ImageclassApplyCopy(ic, win, w, h, 0, 0, st,
                                                &pmm, 1, ST_UNKNWN);
                            Mode.queue_up = pq;
+                           Eprintf("-pmm: %#lx - %#lx %#lx\n", win, pmm.pmap,
+                                   pmm.mask);
                            Esnprintf(buf, sizeof(buf), "0x%08x 0x%08x",
                                      (unsigned)pmm.pmap, (unsigned)pmm.mask);
 /*                         FreePmapMask(&pmm);         ??? */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.116.2.18
retrieving revision 1.116.2.19
diff -u -3 -r1.116.2.18 -r1.116.2.19
--- iconify.c   7 Sep 2004 20:06:55 -0000       1.116.2.18
+++ iconify.c   18 Sep 2004 13:32:27 -0000      1.116.2.19
@@ -949,7 +949,7 @@
    char               *ff = NULL, s[1024], *s1, *s2, *s3, *s4;
    FILE               *f;
 
-   ff = FindFile("icondefs.cfg");
+   ff = ThemeFileFind("icondefs.cfg");
    if (!ff)
       return;
    f = fopen(ff, "r");
@@ -991,7 +991,7 @@
    Icondef           **idef;
    int                 i, num;
 
-   ff = FindFile("icondefs.cfg");
+   ff = ThemeFileFind("icondefs.cfg");
    if (!ff)
      {
        idef = IB_ListIcondef(&num);
@@ -2912,6 +2912,7 @@
             if (fields != 1)
                Alert(_("CONFIG: ignoring extra data in \"%s\"\n"), s);
          }
+
        switch (i1)
          {
          case CONFIG_CLASSNAME:        /* __NAME %s */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.174.2.22
retrieving revision 1.174.2.23
diff -u -3 -r1.174.2.22 -r1.174.2.23
--- ipc.c       5 Sep 2004 11:46:44 -0000       1.174.2.22
+++ ipc.c       18 Sep 2004 13:32:27 -0000      1.174.2.23
@@ -390,71 +390,6 @@
 }
 
 static void
-IPC_Cursor(const char *params, Client * c)
-{
-   char                buf[FILEPATH_LEN_MAX];
-
-   buf[0] = 0;
-
-   if (params)
-     {
-       char                param1[FILEPATH_LEN_MAX];
-       char                param2[FILEPATH_LEN_MAX];
-       char                param3[FILEPATH_LEN_MAX];
-
-       param1[0] = 0;
-       param2[0] = 0;
-       param3[0] = 0;
-
-       word(params, 1, param1);
-       word(params, 2, param2);
-       if (param2[0])
-         {
-            if (!strcmp(param2, "create"))
-              {
-              }
-            else if (!strcmp(param2, "delete"))
-              {
-                 ECursor            *ec;
-
-                 ec = (ECursor *) FindItem(param1, 0, LIST_FINDBY_NAME,
-                                           LIST_TYPE_ECURSOR);
-                 if (ec)
-                    ECursorDestroy(ec);
-              }
-            else if (!strcmp(param2, "modify"))
-              {
-              }
-            else if (!strcmp(param2, "ref_count"))
-              {
-                 ECursor            *ec;
-
-                 ec = (ECursor *) FindItem(param1, 0, LIST_FINDBY_NAME,
-                                           LIST_TYPE_ECURSOR);
-                 if (ec)
-                    Esnprintf(buf, sizeof(buf), "%u references remain",
-                              ECursorGetRefcount(ec));
-              }
-            else
-              {
-                 Esnprintf(buf, sizeof(buf), "Error: no cursor specified");
-              }
-         }
-       else
-         {
-            Esnprintf(buf, sizeof(buf), "Error: unknown operation specified");
-         }
-     }
-   else
-     {
-       Esnprintf(buf, sizeof(buf), "Error: no operation specified");
-     }
-
-   if (buf[0])
-      CommsSend(c, buf);
-}
-
-static void
 IPC_ColorModifierClass(const char *params, Client * c)
 {
    char                buf[FILEPATH_LEN_MAX];
@@ -643,27 +578,6 @@
             if (lst)
                Efree(lst);
          }
-       else if (!strcmp(params, "cursors"))
-         {
-            ECursor           **lst;
-
-            lst = (ECursor **) ListItemType(&num, LIST_TYPE_ECURSOR);
-            for (i = 0; i < num; i++)
-              {
-                 buf2[0] = 0;
-                 Esnprintf(buf2, sizeof(buf2), "%s\n", ECursorGetName(lst[i]));
-                 if (buf)
-                    buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
-                 else
-                   {
-                      buf = malloc(strlen(buf2) + 1);
-                      buf[0] = 0;
-                   }
-                 strcat(buf, buf2);
-              }
-            if (lst)
-               Efree(lst);
-         }
        else if (!strcmp(params, "borders"))
          {
             Border            **lst;
@@ -1785,32 +1699,6 @@
       CommsSend(c, buf);
 }
 
-/*
- * Reloads the menus.cfg file from cache, 
- *
- */
-
-static void
-IPC_ReloadMenus(const char *params, Client * c)
-{
-   /*
-    * Do nothing here but call doExit, following the pattern
-    * that raster/mandrake have setup 08/16/99
-    *
-    * Ok that wasn't nice, I forgot to deallocate menus
-    * Now the way I'm doing this if any menu req's come in
-    * while this is happening we're probably in la-la land
-    * but i'll try this 08/17/99
-    */
-
-   MenusDestroyLoaded();
-
-   LoadConfigFile("menus.cfg");
-   return;
-   params = NULL;
-   c = NULL;
-}
-
 static void
 IPC_GroupInfo(const char *params, Client * c __UNUSED__)
 {
@@ -3201,11 +3089,6 @@
     "Create/Delete/Modify a Border",
     "This doesn't do anything yet."},
    {
-    IPC_Cursor,
-    "cursor", NULL,
-    "Create/Delete/Modify a Cursor",
-    "This doesn't do anything yet."},
-   {
     IPC_Button,
     "button", NULL,
     "Create/Delete/Modify a Button",
@@ -3217,11 +3100,6 @@
     "use \"general_info <info>\" to retrieve information\n"
     "available info is: screen_size"},
    {
-    IPC_ReloadMenus,
-    "reload_menus", NULL,
-    "Reload menus.cfg without restarting (Asmodean_)",
-    NULL},
-   {
     IPC_GroupInfo,
     "group_info", "gl",
     "Retrieve some info on groups",
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.99.2.22
retrieving revision 1.99.2.23
diff -u -3 -r1.99.2.22 -r1.99.2.23
--- main.c      9 Sep 2004 19:16:18 -0000       1.99.2.22
+++ main.c      18 Sep 2004 13:32:27 -0000      1.99.2.23
@@ -201,34 +201,19 @@
    SignalsSetup();
    SetupX(dstr);               /* This is where the we fork per screen */
    /* X is now running, and we have forked per screen */
+
    ECheckEprog("epp");
    ECheckEprog("eesh");
-   ZoomInit();
    EDirsSetup();
-   CommsInit();
 
    /* Set default save file prefix if not already set */
    ESetSavePrefix(NULL);
 
-   LoadSnapInfo();
-
-   ecore_x_grab();
-   MapUnmap(0);
-   ecore_x_ungrab();
-
-   EwinsInit();
-
-   /* make all of our fallback classes */
-   SetupFallbackClasses();
-
    /* So far nothing should rely on a selected settings or theme. */
    ConfigurationLoad();                /* Load settings */
 
-   ModulesSignal(ESIGNAL_INIT, NULL);
-   LoadEConfig();
-
-   /* Do initial configuration */
-   ModulesSignal(ESIGNAL_CONFIGURE, NULL);
+   /* The theme path must now be available for config file loading. */
+   ThemePathFind();
 
    /* Set the Environment variables */
    Esetenv("EVERSION", ENLIGHTENMENT_VERSION, 1);
@@ -238,6 +223,22 @@
    Esetenv("ECONFDIR", EDirUser(), 1);
    Esetenv("ECACHEDIR", EDirUserCache(), 1);
 
+   /* Move elsewhere... */
+   LoadSnapInfo();
+   CommsInit();
+   EwinsInit();
+
+   ModulesSignal(ESIGNAL_INIT, NULL);
+
+   /* Load the theme */
+   ThemeConfigLoad();
+
+   /* Make all of our fallback classes */
+   SetupFallbackClasses();
+
+   /* Do initial configuration */
+   ModulesSignal(ESIGNAL_CONFIGURE, NULL);
+
    HintsInit();
    SessionInit();
    CheckEvent();
@@ -262,8 +263,7 @@
    ecore_x_sync();
    Mode.queue_up = DRAW_QUEUE_ENABLE;
 
-   /* of course, we have to set the cursors */
-   ECursorsInit();
+   /* Set root window cursor */
    ECsrApply(ECSR_ROOT, VRoot.win);
 
 #if 0
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/menus-misc.c,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -3 -r1.1.2.9 -r1.1.2.10
--- menus-misc.c        5 Sep 2004 11:46:45 -0000       1.1.2.9
+++ menus-misc.c        18 Sep 2004 13:32:27 -0000      1.1.2.10
@@ -378,7 +378,7 @@
    if (calls > 255)
       EDBUG_RETURN(NULL);
 
-   ff = FindFile(file);
+   ff = FindFile(file, NULL);
    if (!ff)
       EDBUG_RETURN(NULL);
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.147.2.14
retrieving revision 1.147.2.15
diff -u -3 -r1.147.2.14 -r1.147.2.15
--- menus.c     7 Sep 2004 20:06:56 -0000       1.147.2.14
+++ menus.c     18 Sep 2004 13:32:27 -0000      1.147.2.15
@@ -2093,9 +2093,10 @@
    char                s5[FILEPATH_LEN_MAX];
    char               *txt = NULL;
    const char         *params = NULL;
-   int                 i1;
-   Menu               *m = NULL, *mm = NULL;
-   MenuItem           *mi = NULL;
+   int                 i1, i2;
+   Menu               *m = NULL, *mm;
+   MenuItem           *mi;
+   MenuStyle          *ms;
    ImageClass         *ic = NULL;
    int                 fields;
    int                 act = 0;
@@ -2120,27 +2121,36 @@
             if (fields != 2)
               {
                  Alert(_("CONFIG: missing required data in \"%s\"\n"), s);
-                 i1 = CONFIG_INVALID;
+                 continue;
               }
          }
+
        switch (i1)
          {
+         case CONFIG_MENU:
+            err = -1;
+            i2 = atoi(s2);
+            if (i2 != CONFIG_OPEN)
+               goto done;
+            m = NULL;
+            ic = NULL;
+            _EFREE(txt);
+            act = 0;
+            break;
          case CONFIG_CLOSE:
             if (m)
                MenuRealize(m);
-            goto done;
+            err = 0;
+            break;
+
          case MENU_PREBUILT:
             sscanf(s, "%i %4000s %4000s %4000s %4000s", &i1, s2, s3, s4, s5);
             if (!strcmp(s4, "dirscan"))
               {
-                 MenuStyle          *ms;
-
                  ms = FindItem(s3, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                  if (!ms)
-                   {
-                      ms = FindItem("DEFAULT", 0, LIST_FINDBY_NAME,
-                                    LIST_TYPE_MENU_STYLE);
-                   }
+                    ms = FindItem("DEFAULT", 0, LIST_FINDBY_NAME,
+                                  LIST_TYPE_MENU_STYLE);
 
                  if (ms)
                    {
@@ -2150,63 +2160,39 @@
               }
             else if (!strcmp(s4, "gnome"))
               {
-                 MenuStyle          *ms;
-
                  ms = FindItem(s3, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                  if (ms)
-                   {
-                      m = MenuCreateFromGnome(s2, NULL, ms, s5);
-                   }
+                    m = MenuCreateFromGnome(s2, NULL, ms, s5);
               }
             else if (!strcmp(s4, "borders"))
               {
-                 MenuStyle          *ms;
-
                  ms = FindItem(s3, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                  if (ms)
-                   {
-                      m = MenuCreateFromBorders(s2, ms);
-                   }
+                    m = MenuCreateFromBorders(s2, ms);
               }
             else if (!strcmp(s4, "themes"))
               {
-                 MenuStyle          *ms;
-
                  ms = FindItem(s3, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                  if (ms)
-                   {
-                      m = MenuCreateFromThemes(s2, ms);
-                   }
+                    m = MenuCreateFromThemes(s2, ms);
               }
             else if (!strcmp(s4, "file"))
               {
-                 MenuStyle          *ms;
-
                  ms = FindItem(s3, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                  if (ms)
-                   {
-                      m = MenuCreateFromFlatFile(s2, NULL, ms, s5);
-                   }
+                    m = MenuCreateFromFlatFile(s2, NULL, ms, s5);
               }
             else if (!strcmp(s4, "windowlist"))
               {
-                 MenuStyle          *ms;
-
                  ms = FindItem(s3, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                  if (ms)
-                   {
-                      m = MenuCreateFromAllEWins(s2, ms);
-                   }
+                    m = MenuCreateFromAllEWins(s2, ms);
               }
             else if (!strcmp(s4, "desktopwindowlist"))
               {
-                 MenuStyle          *ms;
-
                  ms = FindItem(s3, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                  if (ms)
-                   {
-                      m = MenuCreateFromDesktops(s2, ms);
-                   }
+                    m = MenuCreateFromDesktops(s2, ms);
               }
             break;
          case CONFIG_CLASSNAME:
@@ -2217,8 +2203,6 @@
             break;
          case MENU_USE_STYLE:
             {
-               MenuStyle          *ms;
-
                ms = FindItem(s2, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
                if (ms)
                   MenuSetStyle(m, ms);
@@ -2229,19 +2213,17 @@
                MenuSetTitle(m, atword(s, 2));
             break;
          case MENU_ITEM:
+#if 0                          /* FIXME - Why ? */
             if ((txt) || (ic))
               {
-                 mi = MenuItemCreate(txt, ic, act, params, NULL);
+                 mi = MenuItemCreate(txt, ic, act, NULL, NULL);
                  MenuAddItem(m, mi);
               }
+#endif
             ic = NULL;
-            if (txt)
-               Efree(txt);
-            txt = NULL;
             if (strcmp("NULL", s2))
                ic = ImageclassFind(s2, 0);
-            mi = NULL;
-            txt = Estrdup(atword(s, 3));
+            _EFDUP(txt, atword(s, 3));
             break;
          case MENU_ACTION:
             if ((txt) || (ic))
@@ -2275,9 +2257,7 @@
                       MenuAddItem(m, mi);
                    }
                  ic = NULL;
-                 if (txt)
-                    Efree(txt);
-                 txt = NULL;
+                 _EFREE(txt);
               }
             break;
          case MENU_SUBMENU:
@@ -2297,8 +2277,11 @@
             break;
          }
      }
-   err = -1;
 
  done:
+   if (err)
+      ConfigAlertLoad(_("Menu"));
+   _EFREE(txt);
+
    return err;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/mod-menus.c,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -3 -r1.1.2.7 -r1.1.2.8
--- mod-menus.c 1 Sep 2004 23:37:20 -0000       1.1.2.7
+++ mod-menus.c 18 Sep 2004 13:32:28 -0000      1.1.2.8
@@ -33,6 +33,9 @@
 {
    switch (sig)
      {
+     case ESIGNAL_CONFIGURE:
+       ConfigFileLoad("menus.cfg", NULL, MenuConfigLoad);
+       break;
      case ESIGNAL_AREA_SWITCH_START:
      case ESIGNAL_DESK_SWITCH_START:
        MenusHide();
@@ -40,6 +43,34 @@
      }
 }
 
+/*
+ * Reloads the menus.cfg file from cache, 
+ *
+ */
+
+static void
+MenusIpc(const char *params, Client * c __UNUSED__)
+{
+   if (!params)
+      return;
+
+   if (!strcmp(params, "reload"))
+     {
+       MenusDestroyLoaded();
+       ConfigFileLoad("menus.cfg", NULL, MenuConfigLoad);
+     }
+}
+
+IpcItem             MenusIpcArray[] = {
+   {
+    MenusIpc,
+    "menus", "mnu",
+    "  menus reload      Reload menus.cfg without restarting",
+    NULL}
+   ,
+};
+#define N_IPC_FUNCS (sizeof(MenusIpcArray)/sizeof(IpcItem))
+
 static const CfgItem MenusCfgItems[] = {
    CFG_ITEM_BOOL(Conf.menus, slide, 0),
    CFG_ITEM_BOOL(Conf.menus, onscreen, 1),
@@ -60,6 +91,6 @@
    "menus", "menu",
    MenusSighan,
    NULL, NULL,
-   {0, NULL},
+   {N_IPC_FUNCS, MenusIpcArray},
    {N_CFG_ITEMS, MenusCfgItems}
 };
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/mod-misc.c,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -u -3 -r1.1.2.14 -r1.1.2.15
--- mod-misc.c  5 Sep 2004 22:24:35 -0000       1.1.2.14
+++ mod-misc.c  18 Sep 2004 13:32:28 -0000      1.1.2.15
@@ -29,6 +29,7 @@
 /* Use static module list for now */
 extern EModule      ModBackgrounds;
 extern EModule      ModButtons;
+extern EModule      ModCursors;
 extern EModule      ModDesktops;
 extern EModule      ModEffects;
 extern EModule      ModGroups;
@@ -48,6 +49,7 @@
 const EModule      *p_modules[] = {
    &ModBackgrounds,
    &ModButtons,
+   &ModCursors,
    &ModDesktops,
    &ModEffects,
    &ModGroups,
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.103.2.14
retrieving revision 1.103.2.15
diff -u -3 -r1.103.2.14 -r1.103.2.15
--- pager.c     5 Sep 2004 11:46:46 -0000       1.103.2.14
+++ pager.c     18 Sep 2004 13:32:28 -0000      1.103.2.15
@@ -1578,7 +1578,7 @@
             EMoveResizeWindow(disp, p->hi_win, px + wx, py + wy, ww, wh);
             ESetWindowBackgroundPixmap(disp, p->hi_win, ewin->mini_pmm.pmap);
             EMapRaised(disp, p->hi_win);
-            GrabPointerSet(p->hi_win, None, 0);
+            GrabPointerSet(p->hi_win, ECSR_ACT_MOVE, 1);
             p->hi_visible = 1;
             p->hi_ewin = ewin;
             p->hi_win_w = ww;
@@ -2191,8 +2191,6 @@
    int                 desk;
    Background         *bg;
 
-// EWin               *ewin;
-
    switch (sig)
      {
      case ESIGNAL_INIT:
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.139.2.15
retrieving revision 1.139.2.16
diff -u -3 -r1.139.2.15 -r1.139.2.16
--- setup.c     17 Sep 2004 16:13:43 -0000      1.139.2.15
+++ setup.c     18 Sep 2004 13:32:28 -0000      1.139.2.16
@@ -358,6 +358,7 @@
    }
 
    ScreenInit();
+   ZoomInit();
 
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/sound.c,v
retrieving revision 1.25.2.4
retrieving revision 1.25.2.5
diff -u -3 -r1.25.2.4 -r1.25.2.5
--- sound.c     1 Sep 2004 23:37:20 -0000       1.25.2.4
+++ sound.c     18 Sep 2004 13:32:29 -0000      1.25.2.5
@@ -65,7 +65,7 @@
 static int          sound_fd = -1;
 
 static Sample      *
-LoadWav(char *file)
+LoadWav(const char *file)
 {
 #ifdef HAVE_LIBESD
    AFfilehandle        in_file;
@@ -79,7 +79,7 @@
 
    EDBUG(5, "LoadWav");
 #ifdef HAVE_LIBESD
-   find = FindFile(file);
+   find = FindFile(file, Mode.theme.path);
    if (!find)
      {
        DialogOK(_("Error finding sound file"),
@@ -89,12 +89,14 @@
                   "may wish to check your configuration settings.\n"), file);
        EDBUG_RETURN(NULL);
      }
+
    in_file = afOpenFile(find, "r", NULL);
    if (!in_file)
      {
        Efree(find);
        EDBUG_RETURN(NULL);
      }
+
    s = Emalloc(sizeof(Sample));
    if (!s)
      {
@@ -153,28 +155,22 @@
 #ifdef HAVE_LIBESD
    if ((sound_fd < 0) || (!Conf_sound.enable) || (!s))
       EDBUG_RETURN_;
-   if (!s->id)
+
+   if (!s->id && s->data)
      {
-       if (sound_fd >= 0)
+       size = s->samples;
+       s->id = esd_sample_getid(sound_fd, s->file);
+       if (s->id < 0)
          {
-            if (s->data)
-              {
-                 size = s->samples;
-                 s->id = esd_sample_getid(sound_fd, s->file);
-                 if (s->id < 0)
-                   {
-                      s->id =
-                         esd_sample_cache(sound_fd, s->format, s->rate, size,
-                                          s->file);
-                      write(sound_fd, s->data, size);
-                      confirm = esd_confirm_sample_cache(sound_fd);
-                      if (confirm != s->id)
-                         s->id = 0;
-                   }
-                 Efree(s->data);
-                 s->data = NULL;
-              }
+            s->id =
+               esd_sample_cache(sound_fd, s->format, s->rate, size, s->file);
+            write(sound_fd, s->data, size);
+            confirm = esd_confirm_sample_cache(sound_fd);
+            if (confirm != s->id)
+               s->id = 0;
          }
+       Efree(s->data);
+       s->data = NULL;
      }
    if (s->id > 0)
       esd_sample_play(sound_fd, s->id);
@@ -224,32 +220,6 @@
 }
 
 static void
-SclassApply(SoundClass * sclass)
-{
-#ifdef HAVE_LIBESD
-   char               *f;
-#endif
-
-   EDBUG(4, "SclassApply");
-   if (!sclass)
-      EDBUG_RETURN_;
-#ifdef HAVE_LIBESD
-   if ((!sclass->sample) && (Conf_sound.enable))
-     {
-       f = FindFile(sclass->file);
-       if (f)
-         {
-            sclass->sample = LoadWav(f);
-            Efree(f);
-         }
-     }
-   if ((Conf_sound.enable) && (sclass->sample))
-      SamplePlay(sclass->sample);
-#endif
-   EDBUG_RETURN_;
-}
-
-static void
 SclassDestroy(SoundClass * sclass)
 {
    EDBUG(5, "SclassDestroy");
@@ -266,6 +236,23 @@
    EDBUG_RETURN_;
 }
 
+static void
+SclassApply(SoundClass * sclass)
+{
+   EDBUG(4, "SclassApply");
+   if (!sclass || !Conf_sound.enable)
+      EDBUG_RETURN_;
+#ifdef HAVE_LIBESD
+   if (!sclass->sample)
+      sclass->sample = LoadWav(sclass->file);
+   if (sclass->sample)
+      SamplePlay(sclass->sample);
+   else
+      SclassDestroy(sclass);
+#endif
+   EDBUG_RETURN_;
+}
+
 static const char  *
 SclassGetName(SoundClass * sclass)
 {
@@ -303,8 +290,10 @@
 #ifdef HAVE_LIBESD
    if (!Conf_sound.enable)
       EDBUG_RETURN_;
+
    if (sound_fd != -1)
       EDBUG_RETURN_;
+
    fd = esd_open_sound(NULL);
    if (fd >= 0)
       sound_fd = fd;
@@ -355,7 +344,7 @@
 #include "conf.h"
 
 static int
-SoundConfigLoad(FILE * ConfigFile)
+SoundConfigLoad(FILE * fs)
 {
    int                 err = 0;
    SoundClass         *sc;
@@ -363,23 +352,44 @@
    char                s1[FILEPATH_LEN_MAX];
    char                s2[FILEPATH_LEN_MAX];
    int                 i1, ret;
+   char               *file;
+
+   file = ConfigFileFind("sound.cfg", Mode.theme.path);
+   if (!file)
+      goto done;
+   fs = fopen(file, "r");
+   Efree(file);
+   if (!fs)
+      goto done;
 
-   while (GetLine(s, sizeof(s), ConfigFile))
+   while (GetLine(s, sizeof(s), fs))
      {
-       s2[0] = 0;
-       ret = sscanf(s, "%4000s %4000s", s1, s2);
+       i1 = -1;
+       ret = sscanf(s, "%d", &i1);
        if (ret == 1)
          {
-            i1 = atoi(s1);
-            if (i1 == CONFIG_CLOSE)
-               goto done;
+            switch (i1)
+              {
+              case CONFIG_VERSION:
+              case CONFIG_OPEN:
+                 break;
+              case CONFIG_CLOSE:
+                 goto done;
+              }
          }
-       else if (ret == 2)
+       else
          {
-            sscanf(s, "%4000s %4000s", s1, s2);
+            s1[0] = s2[0] = '\0';
+            ret = sscanf(s, "%4000s %4000s", s1, s2);
+            if (ret != 2)
+              {
+                 Eprintf("Ignoring line: %s\n", s);
+                 break;
+              }
             sc = SclassCreate(s1, s2);
          }
      }
+   ConfigAlertLoad(_("Sound"));
    err = -1;
 
  done:
@@ -398,6 +408,9 @@
      case ESIGNAL_INIT:
        SoundInit();
        break;
+     case ESIGNAL_CONFIGURE:
+       ConfigFileLoad("sound.cfg", Mode.theme.path, SoundConfigLoad);
+       break;
      case ESIGNAL_START:
        if (!Conf_sound.enable)
           break;
@@ -529,7 +542,7 @@
      {
        SettingsAudio();
      }
-   if (!strncmp(cmd, "del", 3))
+   else if (!strncmp(cmd, "del", 3))
      {
        SoundFree(prm);
      }
@@ -591,7 +604,7 @@
 EModule             ModSound = {
    "sound", "audio",
    SoundSighan,
-   SoundConfigLoad, NULL,
+   NULL, NULL,
    {N_IPC_FUNCS, SoundIpcArray},
    {N_CFG_ITEMS, SoundCfgItems}
 };
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/text.c,v
retrieving revision 1.43.2.3
retrieving revision 1.43.2.4
diff -u -3 -r1.43.2.3 -r1.43.2.4
--- text.c      7 Sep 2004 20:06:57 -0000       1.43.2.3
+++ text.c      18 Sep 2004 13:32:29 -0000      1.43.2.4
@@ -165,7 +165,7 @@
           word(s2, 1, w);
           Esnprintf(s, sizeof(s), "ttfonts/%s.ttf", w);
           word(s2, 2, w);
-          ss = FindFile(s);
+          ss = ThemeFileFind(s);
           if (ss)
             {
                ts->efont = Efont_load(ss, atoi(w));
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/theme.c,v
retrieving revision 1.37.2.5
retrieving revision 1.37.2.6
diff -u -3 -r1.37.2.5 -r1.37.2.6
--- theme.c     5 Sep 2004 11:46:47 -0000       1.37.2.5
+++ theme.c     18 Sep 2004 13:32:29 -0000      1.37.2.6
@@ -393,8 +393,8 @@
  * Theme module
  */
 
-static void
-ThemeInit(void)
+void
+ThemePathFind(void)
 {
    char               *theme;
 
@@ -427,8 +427,8 @@
 {
    switch (sig)
      {
-     case ESIGNAL_INIT:
-       ThemeInit();
+     case ESIGNAL_CONFIGURE:
+       ThemeCleanup();
        break;
      case ESIGNAL_EXIT:
        ThemeCleanup();




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to