add api and lets test it - i'll document it later, but need to test
authorCarsten Haitzler <raster@rasterman.com>
Wed, 13 Feb 2013 11:35:46 +0000 (11:35 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Wed, 13 Feb 2013 11:35:46 +0000 (11:35 +0000)
first.

SVN revision: 83867

src/lib/evas/Evas.h
src/lib/evas/cserve2/evas_cs2_client.c
src/lib/evas/file/evas_module.c

index c1f418b1e941c5284c08aa6e3cb10cf91dbd386b..c7ccfb4225f2219b2d6767b619e3ca9b0a3c701c 100644 (file)
@@ -1244,6 +1244,20 @@ typedef void      (*Evas_Async_Events_Put_Cb)(void *target, Evas_Callback_Type t
  * Functions that affect Evas as a whole.
  */
 
+/**
+ * Get the path for the cserve binary to execute
+ * 
+ * There is little need for anyone except a desktop nevironment to call this.
+ * This can be called before evas_init() has been called. It will try and find
+ * the full path to the to the cserve binary to run to provide cserve image
+ * and font caching services for evas.
+ * 
+ * @return NULL if error, or a string with the full path to the cserve binary.
+ * 
+ * @since 1.8
+ */
+EAPI const char *evas_cserve_path_get(void);
+   
 /**
  * Initialize Evas
  *
index 73bbcf1de747789feb2fe95b46cc5ee6011a9695..3cb12d4f89e2d3cf8dcad44c8c48adc954f8b12f 100644 (file)
@@ -106,11 +106,11 @@ _server_connect(void)
    remote.sun_family = AF_UNIX;
    _socket_path_set(remote.sun_path);
    len = strlen(remote.sun_path) + sizeof(remote.sun_family);
-   if (connect(s, (struct sockaddr *)&remote, len) == -1)
+   for (;;)
      {
-        ERR("connect");
-       close(s);
-        return EINA_FALSE;
+        if (connect(s, (struct sockaddr *)&remote, len) != -1) break;
+        ERR("cserve connect failed. retrying.");
+        usleep(1000);
      }
 
    fcntl(s, F_SETFL, O_NONBLOCK);
index 0378423a6a7e592b7aa5971fd35d0394b2df193e..0a5e302a2211aa99d7fead0ae38c9e8311918522 100644 (file)
@@ -615,3 +615,46 @@ _evas_module_libdir_get(void)
    if (!pfx) return NULL;
    return eina_prefix_lib_get(pfx);
 }
+
+EAPI const char *
+evas_cserve_path_get(void)
+{
+   static char buf[PATH_MAX];
+   const char *lib;
+   Eina_Bool shutdown = EINA_FALSE;
+
+   if (!pfx)
+     {
+        shutdown = EINA_TRUE;
+        eina_init();
+        pfx = eina_prefix_new
+          (NULL, _evas_module_libdir_get, "EVAS", "evas", "checkme",
+              PACKAGE_BIN_DIR, PACKAGE_LIB_DIR,
+              PACKAGE_DATA_DIR, PACKAGE_DATA_DIR);
+        if (!pfx)
+          {
+             eina_shutdown();
+             return NULL;
+          }
+     }
+   lib = eina_prefix_lib_get(pfx);
+   if (!lib)
+     {
+        if (shutdown)
+          {
+             eina_prefix_free(pfx);
+             pfx = NULL;
+             eina_shutdown();
+          }
+        return NULL;
+     }
+   snprintf(buf, sizeof(buf), "%s/evas/cserve2/bin/%s/evas_cserve2",
+            lib, MODULE_ARCH);
+   if (shutdown)
+     {
+        eina_prefix_free(pfx);
+        pfx = NULL;
+        eina_shutdown();
+     }
+   return buf;
+}