Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        etk_engine.c etk_engine.h etk_utils.h 


Log Message:
* Move ETK_INSIDE() macro to etk_utils
* Add a shutdown() method to the engine API


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_engine.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- etk_engine.c        27 Jul 2006 17:22:03 -0000      1.3
+++ etk_engine.c        27 Jul 2006 18:19:29 -0000      1.4
@@ -79,17 +79,19 @@
    while (_loaded_engines)
    {
       Etk_Engine *engine;
-      void *(*engine_shutdown)();   
+      void *(*engine_close)();   
       engine = _loaded_engines->data;
       _loaded_engines = evas_list_remove(_loaded_engines, engine);
       
-      if (!engine->handle)
-         continue;
+      if (engine->engine_shutdown)
+         engine->engine_shutdown();
 
-      if ((engine_shutdown = dlsym(engine->handle, "engine_shutdown")))
-         engine_shutdown();
-      
-      dlclose(engine->handle);
+      if (engine->handle)
+      {
+         if ((engine_close = dlsym(engine->handle, "engine_close")))
+            engine_close();
+         dlclose(engine->handle);
+      }
    }
    
    while (_etk_engines)
@@ -148,7 +150,7 @@
 Etk_Engine *etk_engine_load(const char *engine_name)
 {
    Etk_Engine *engine;
-   Etk_Engine *(*engine_init)();   
+   Etk_Engine *(*engine_open)();   
    char filename[PATH_MAX];
    void *handle;
    
@@ -166,26 +168,33 @@
    handle = dlopen(filename, RTLD_LAZY | RTLD_GLOBAL);
    if (!handle)
    {
-      ETK_WARNING("Etk can not dlopen requested engine!");
+      ETK_WARNING("Etk can not dlopen the requested engine!");
       return NULL;
    }
 
-   engine_init = dlsym(handle, "engine_init");
-   if (!engine_init)
+   engine_open = dlsym(handle, "engine_open");
+   if (!engine_open)
    {
-      ETK_WARNING("Etk can not find an initializer for this engine!");
+      ETK_WARNING("Etk can not find an open method for this engine!");
       dlclose(handle);
       return NULL;
    }
    
-   if (!(engine = engine_init()))
+   if (!(engine = engine_open()))
    {
-      ETK_WARNING("Etk can not initialize requested engine!");
+      ETK_WARNING("Etk can not open the requested engine!");
       dlclose(handle);
       return NULL;
    }
    
-   _loaded_engines = evas_list_append(_loaded_engines, engine);
+   if (engine->engine_init && !engine->engine_init())
+   {
+      ETK_WARNING("Etk can not initialize the requested engine!");
+      dlclose(handle);
+      return NULL;
+   }
+   
+   _loaded_engines = evas_list_prepend(_loaded_engines, engine);
    engine->handle = handle;
    _engine = engine;
    
@@ -679,3 +688,5 @@
    INHERIT(selection_text_set);
    INHERIT(selection_clear);
 }
+
+/** @} */
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_engine.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- etk_engine.h        27 Jul 2006 17:22:03 -0000      1.3
+++ etk_engine.h        27 Jul 2006 18:19:29 -0000      1.4
@@ -16,6 +16,9 @@
    Etk_Engine *super;
    void *handle;
    
+   Etk_Bool (*engine_init)();
+   void (*engine_shutdown)();
+   
    void (*window_constructor)(Etk_Window *window);
    void (*window_destructor)(Etk_Window *window);   
    void (*window_show)(Etk_Window *window);
@@ -149,6 +152,7 @@
 void etk_engine_selection_text_request(Etk_Widget *widget);
 void etk_engine_selection_text_set(Etk_Widget *widget, const char *text, int 
length);
 void etk_engine_selection_clear();
+
 /** @} */
 
 #endif
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_utils.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- etk_utils.h 28 Oct 2005 14:06:25 -0000      1.7
+++ etk_utils.h 27 Jul 2006 18:19:29 -0000      1.8
@@ -8,18 +8,22 @@
 /* Gettext */
 #define _(string) gettext(string)
 
-/** @brief Gets the max of the two values */
+/** Gets the max of the two values */
 #define ETK_MAX(v1, v2)    (((v1) > (v2)) ? (v1) : (v2)) 
-/** @brief Gets the min of the two values */
+/** Gets the min of the two values */
 #define ETK_MIN(v1, v2)    (((v1) < (v2)) ? (v1) : (v2)) 
-/** @brief Clamps the value against the boudaries */
+/** Clamps the value against the boudaries */
 #define ETK_CLAMP(value, left, right)     ((value) < (left) ? (left) : 
((value) > (right) ? (right) : (value)))
-/** @brief Rounds the float value to the nearest integer */
+/** Rounds the float value to the nearest integer */
 #define ETK_ROUND(a)       ((a < 0.0) ? (int)(floor(a - 0.5)) : (int)(floor(a 
+ 0.5)))
+/** Tests if the position (x, y) is inside the rectangle starting at (xx, yy) 
and of size (ww, hh) */ 
+#define ETK_INSIDE(x, y, xx, yy, ww, hh) \
+   (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= 
(yy)))
 
 /* TODO: make it portable ?? */
-/** @brief Displays a warning in the output console */
-#define ETK_WARNING(format, ...)    fprintf(stderr, "Etk Warning: %s, %d: %s: 
" format "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__)
+/** Displays a warning in the output console */
+#define ETK_WARNING(format, ...) \
+   fprintf(stderr, "Etk Warning: %s, %d: %s: " format "\n", __FILE__, 
__LINE__, __FUNCTION__, ##__VA_ARGS__)
 
 void etk_accumulator_bool_or(void *return_value, const void *value_to_accum, 
void *data);
 void etk_accumulator_bool_and(void *return_value, const void *value_to_accum, 
void *data);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to