diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 619d944397..b12a678ef8 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -407,7 +407,6 @@ _ecore_evas_parse_extra_options_x(const char *extra_options, char **disp_name, u return extra_options; } -#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 static Ecore_Evas * _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options) { @@ -421,9 +420,7 @@ _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *ext return ee; } -#endif -#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA static Ecore_Evas * _ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options) { @@ -437,9 +434,7 @@ _ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_opti if (ee) ecore_evas_move(ee, x, y); return ee; } -#endif -#ifdef BUILD_ECORE_EVAS_OPENGL_X11 static Ecore_Evas * _ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options) { @@ -453,9 +448,7 @@ _ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra return ee; } -#endif -#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL static Ecore_Evas * _ecore_evas_constructor_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) { @@ -474,9 +467,6 @@ _ecore_evas_constructor_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, return ee; } -#endif - -#ifdef BUILD_ECORE_EVAS_OPENGL_SDL static Ecore_Evas * _ecore_evas_constructor_opengl_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) { @@ -493,7 +483,6 @@ _ecore_evas_constructor_opengl_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w, return ee; } -#endif static Ecore_Evas * _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) @@ -511,7 +500,6 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c return ee; } - static Ecore_Evas * _ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) { @@ -603,63 +591,20 @@ _ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_option /* note: keep sorted by priority, highest first */ static const struct ecore_evas_engine _engines[] = { /* unix */ -#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 {"software_x11", _ecore_evas_constructor_software_x11}, -#endif -#ifdef BUILD_ECORE_EVAS_OPENGL_X11 {"opengl_x11", _ecore_evas_constructor_opengl_x11}, -#endif -#ifdef BUILD_ECORE_EVAS_FB {"fb", _ecore_evas_constructor_fb}, -#endif - - /* windows */ -#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI {"software_gdi", _ecore_evas_constructor_software_gdi}, -#endif -#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW {"software_ddraw", _ecore_evas_constructor_software_ddraw}, -#endif -#ifdef BUILD_ECORE_EVAS_DIRECT3D {"direct3d", _ecore_evas_constructor_direct3d}, -#endif -#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW {"opengl_glew", _ecore_evas_constructor_opengl_glew}, -#endif - - /* Apple */ -#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA {"opengl_cocoa", _ecore_evas_constructor_cocoa}, -#endif - - /* PS3 support */ -#ifdef BUILD_ECORE_EVAS_PSL1GHT {"psl1ght", _ecore_evas_constructor_psl1ght}, -#endif - - /* Wayland */ -#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM {"wayland_shm", _ecore_evas_constructor_wayland_shm}, -#endif - -#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL {"wayland_egl", _ecore_evas_constructor_wayland_egl}, -#endif - - /* Last chance to have a window */ -#ifdef BUILD_ECORE_EVAS_OPENGL_SDL {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, -#endif - -#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL {"sdl", _ecore_evas_constructor_sdl}, -#endif - - /* independent */ -#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER {"buffer", _ecore_evas_constructor_buffer}, -#endif - #ifdef BUILD_ECORE_EVAS_EWS {"ews", _ecore_evas_constructor_ews}, #endif @@ -669,13 +614,7 @@ static const struct ecore_evas_engine _engines[] = { EAPI Eina_List * ecore_evas_engines_get(void) { - const struct ecore_evas_engine *itr; - Eina_List *lst = NULL; - - for (itr = _engines; itr->name; itr++) - lst = eina_list_append(lst, itr->name); - - return lst; + return eina_list_clone(_ecore_evas_available_engines_get()); } EAPI void diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c index 1e399b07d6..c4e960910c 100644 --- a/src/lib/ecore_evas/ecore_evas_module.c +++ b/src/lib/ecore_evas/ecore_evas_module.c @@ -5,8 +5,9 @@ #include "Ecore_Evas.h" #include "ecore_evas_private.h" -Eina_Hash *_registered_engines = NULL; -Eina_List *_engines_paths = NULL; +static Eina_Hash *_registered_engines = NULL; +static Eina_List *_engines_paths = NULL; +static Eina_List *_engines_available = NULL; #if defined(__CEGCC__) || defined(__MINGW32CE__) || defined(_WIN32) # define ECORE_EVAS_ENGINE_NAME "module.dll" @@ -93,4 +94,51 @@ _ecore_evas_engine_shutdown(void) EINA_LIST_FREE(_engines_paths, path) free(path); + + EINA_LIST_FREE(_engines_available, path) + eina_stringshare_del(path); +} + +static Eina_Bool +_file_exists(const char *file) +{ + struct stat st; + if (!file) return EINA_FALSE; + + if (stat(file, &st) < 0) return EINA_FALSE; + return EINA_TRUE; +} + +const Eina_List * +_ecore_evas_available_engines_get(void) +{ + Eina_File_Direct_Info *info; + Eina_Iterator *it; + Eina_List *l = NULL, *result = NULL; + const char *path; + + if (_engines_available) return _engines_available; + + EINA_LIST_FOREACH(_engines_paths, l, path) + { + it = eina_file_direct_ls(path); + + if (it) + { + EINA_ITERATOR_FOREACH(it, info) + { + char tmp[PATH_MAX]; + snprintf(tmp, sizeof (tmp), "%s/%s/" ECORE_EVAS_ENGINE_NAME, + info->path, MODULE_ARCH); + + if (_file_exists(tmp)) + result = eina_list_append(result, + eina_stringshare_add(info->path + info->name_start)); + } + eina_iterator_free(it); + } + } + + _engines_available = result; + return result; } diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index ab1dde3bde..8753a207ea 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -387,8 +387,9 @@ int _ecore_evas_ews_shutdown(void); #endif Eina_Module *_ecore_evas_engine_load(const char *engine); -void _ecore_evas_engine_init(); -void _ecore_evas_engine_shutdown(); +const Eina_List *_ecore_evas_available_engines_get(void); +void _ecore_evas_engine_init(void); +void _ecore_evas_engine_shutdown(void); #endif