Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        entice.c entice.h image.h main.c prefs.c prefs.h 


Log Message:
this fixes the weirdness on ppc with hanging process

fork and create a pipe BEFORE we get into ecore, if we do in fact need the
pipe, send "ok" to the waiting child telling it that it's ok to generate and
submit filenames for appending.


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- entice.c    9 Jan 2004 05:42:45 -0000       1.31
+++ entice.c    22 Jan 2004 19:39:13 -0000      1.32
@@ -39,7 +39,8 @@
    {
       void (*func) (void *data, Evas_Object * o, const char *emission,
                     const char *source);
-   } edje_callbacks;
+   }
+   edje_callbacks;
 
    char *signals[] = { "EnticeImageDelete", "EnticeImageRemove",
       "EnticeImageNext", "EnticeImagePrev",
@@ -120,6 +121,8 @@
       e_container_padding_set(e->container, 4, 4, 4, 4);
       e_container_spacing_set(e->container, 4);
       e_container_move_button_set(e->container, 2);
+      e_container_layout_plugin_set(e->container, "entice");
+
       if (edje_object_part_exists(e->edje, "EnticeThumbnailArea"))
       {
          double w, h;
@@ -261,7 +264,10 @@
          if ((thumb_edje =
               evas_hash_find(entice->thumb.hash,
                              entice_image_file_get(entice->current))))
+         {
             edje_object_signal_emit(thumb_edje, "EnticeThumbLoaded", "");
+            e_container_scroll_to(entice->container, thumb_edje);
+         }
 
          if (entice->scroller)
             evas_object_del(entice->scroller);
@@ -513,8 +519,8 @@
       if ((o = evas_hash_find(entice->thumb.hash, buf)))
       {
          entice->thumb.hash = evas_hash_del(entice->thumb.hash, buf, o);
-        
-        /* scroll backwards in the list, if we're at the tail */
+
+         /* scroll backwards in the list, if we're at the tail */
          if (evas_list_count(entice->thumb.list) > 2)
          {
             if (entice->thumb.current == evas_list_last(entice->thumb.list))
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- entice.h    8 Jan 2004 05:03:54 -0000       1.13
+++ entice.h    22 Jan 2004 19:39:13 -0000      1.14
@@ -21,7 +21,8 @@
       Evas_Hash *hash;          /* filename -> EnticeThumb(edje) Mapping */
       Evas_List *list;          /* List of E_Thumb */
       Evas_List *current;       /* Current Image's list item */
-   } thumb;
+   }
+   thumb;
 
    Ecore_Evas *ee;              /* the evas window */
    Evas_Object *edje;           /* Main Edje_Object(theme) */
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- image.h     13 Dec 2003 06:36:47 -0000      1.19
+++ image.h     22 Jan 2004 19:39:13 -0000      1.20
@@ -41,7 +41,8 @@
       Ecore_Timer *timer;
       double velocity, start_time, x, y, dx, dy;
       Entice_Scroll_Direction direction;
-   } scroll;
+   }
+   scroll;
    char *filename;              /* we need to keep track of this */
    char *format;                /* we need to keep track of this too */
    Entice_Image_Moving_State state;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/main.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- main.c      8 Jan 2004 05:03:54 -0000       1.18
+++ main.c      22 Jan 2004 19:39:13 -0000      1.19
@@ -123,6 +123,48 @@
    event = NULL;
 }
 
+static int
+entice_pipe_foo(int argc, const char **argv)
+{
+   int n, i;
+   pid_t pid;
+   int fd[2];
+   char line[PATH_MAX];
+
+   if (pipe(fd) < 0)
+      exit(1);
+
+   if ((pid = fork()) < 0)
+   {
+      fprintf(stderr, "Forking error\n");
+      exit(1);
+   }
+   else if (pid > 0)            /* parent */
+   {
+      close(fd[0]);
+      return (fd[1]);
+   }
+   else                         /* child */
+   {
+      close(fd[1]);
+      while ((n = read(fd[0], line, PATH_MAX)) > 0)
+      {
+         if (!strncmp(line, "ok", n))
+         {
+            for (i = 1; i < argc; i++)
+            {
+               snprintf(line, PATH_MAX, "%s", argv[i]);
+               entice_file_add_job_cb(line, IPC_FILE_APPEND);
+            }
+            break;
+         }
+      }
+      close(fd[0]);
+      exit(0);
+   }
+   return (0);
+}
+
 /**
  * main - does a few things
  * 1. startup ecore, ecore_evas, ecore_ipc, and edje
@@ -136,9 +178,12 @@
 int
 main(int argc, char *argv[])
 {
-   int i = 0;
+   int pnum = -1;
    int x, y, w, h;
 
+   if (argc > 1)
+      pnum = entice_pipe_foo(argc, (const char **) argv);
+
    ecore_init();
    ecore_app_args_set(argc, (const char **) argv);
    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_cb, NULL);
@@ -191,18 +236,14 @@
             evas_object_show(o);
 
             entice_init(ee);
-            switch (fork())
-            {
-              case 0:
-                 for (i = 1; i < argc; i++)
-                    entice_file_add_job_cb((void *) argv[i], IPC_FILE_APPEND);
-                 exit(0);
-                 break;
-              default:
-                 break;
-            }
             ecore_evas_move_resize(ee, x, y, w, h);
             ecore_evas_show(ee);
+            if (pnum >= 0)
+            {
+               write(pnum, "ok", 2);
+               close(pnum);
+               pnum = -1;
+            }
             ecore_main_loop_begin();
 
             entice_free();
@@ -210,6 +251,8 @@
       }
       ecore_evas_shutdown();
    }
+   if (pnum >= 0)
+      close(pnum);
    ecore_shutdown();
    return (0);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/prefs.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- prefs.c     11 Jan 2004 02:51:07 -0000      1.14
+++ prefs.c     22 Jan 2004 19:39:13 -0000      1.15
@@ -225,7 +225,7 @@
                      {
                         key = entice_key_new(symbol, signal);
                         entice_keys_up_add(key);
-                        free (signal);
+                        free(signal);
                      }
 
                      free(symbol);
@@ -248,7 +248,7 @@
                         free(signal);
                      }
 
-                     free (symbol);
+                     free(symbol);
                   }
                }
             }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/prefs.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- prefs.h     13 Dec 2003 06:36:47 -0000      1.5
+++ prefs.h     22 Jan 2004 19:39:13 -0000      1.6
@@ -21,13 +21,15 @@
    struct
    {
       int image, font;
-   } cache;
+   }
+   cache;
    int x, y, w, h;
    struct
    {
       Evas_List *list;
       Evas_Hash *hash;
-   } themes;
+   }
+   themes;
 };
 typedef struct _Entice_Config Entice_Config;
 




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to