ecore_evas: Make the engines loadable modules

Implementing support for loadables modules. It makes the engines been
loaded when they are needed. It not breakes the api, so each engine
still has its own api.

The implementation basically is:

* Functions that creates Ecore_Evas, for example
  ecore_evas_software_x11_new, request to load its module and then get
  the module's function to create the Ecore_Evas.
* The other functions such as \(.*\)_window_get from the Ecore_Evas
  its interface and then call the appropriate method.
* As there is no unified interface to communicate with the engines
  (not break api problem), all interfaces were declared in
  ecore_evas_private.h
* Now the data necessary for each module is not declared in the
  Ecore_Evas_Engine structure, instead of this, the struct has a void
  pointer that is used by the modules.
* In this first moment engines as software_x11 and gl_x11 were put
  together in the same module, but obviously exporting all the things
  necessary.


SVN revision: 80280
This commit is contained in:
Flavio Vinicius Alvares Ceolin 2012-12-05 21:15:42 +00:00
parent 8783eb70bb
commit ad7579c129
19 changed files with 2633 additions and 1704 deletions

View File

@ -5,30 +5,17 @@ lib_LTLIBRARIES += lib/ecore_evas/libecore_evas.la
installed_ecoreevasmainheadersdir = $(includedir)/ecore-@VMAJ@
dist_installed_ecoreevasmainheaders_DATA = \
lib/ecore_evas/Ecore_Evas_Types.h \
lib/ecore_evas/Ecore_Evas.h
lib_ecore_evas_libecore_evas_la_SOURCES = \
lib/ecore_evas/ecore_evas.c \
lib/ecore_evas/ecore_evas_util.c \
lib/ecore_evas/ecore_evas_x.c \
lib/ecore_evas/ecore_evas_fb.c \
lib/ecore_evas/ecore_evas_buffer.c \
lib/ecore_evas/ecore_evas_deprecated.c \
lib/ecore_evas/ecore_evas_win32.c \
lib/ecore_evas/ecore_evas_sdl.c \
lib/ecore_evas/ecore_evas_cocoa.c \
lib/ecore_evas/ecore_evas_ews.c \
lib/ecore_evas/ecore_evas_psl1ght.c \
lib/ecore_evas/ecore_evas_wayland_shm.c \
lib/ecore_evas/ecore_evas_wayland_egl.c \
lib/ecore_evas/ecore_evas_extn.c \
lib/ecore_evas/ecore_evas_util.c \
lib/ecore_evas/ecore_evas_module.c \
lib/ecore_evas/ecore_evas_private.h
if HAVE_ECORE_WAYLAND
lib_ecore_evas_libecore_evas_la_SOURCES += \
lib/ecore_evas/ecore_evas_wayland_common.c
endif
lib_ecore_evas_libecore_evas_la_CPPFLAGS = \
-I$(top_srcdir)/src/lib/eina \
-I$(top_srcdir)/src/lib/eo \
@ -48,76 +35,15 @@ lib_ecore_evas_libecore_evas_la_CPPFLAGS = \
-I$(top_builddir)/src/lib/ecore_input_evas \
-I$(top_builddir)/src/lib/ecore_evas \
-I$(top_builddir)/src/modules/evas/engines/buffer \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DEFL_ECORE_EVAS_BUILD \
@EFL_CFLAGS@ \
@EFL_COV_CFLAGS@
if HAVE_ECORE_COCOA
if HAVE_WINDOWS
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_cocoa \
-I$(top_srcdir)/src/modules/evas/engines/gl_cocoa \
-I$(top_builddir)/src/lib/ecore_cocoa \
-I$(top_builddir)/src/modules/evas/engines/gl_cocoa
endif
if HAVE_ECORE_FB
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_fb \
-I$(top_srcdir)/src/modules/evas/engines/fb \
-I$(top_builddir)/src/lib/ecore_fb \
-I$(top_builddir)/src/modules/evas/engines/fb
endif
if HAVE_PS3
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_psl1ght \
-I$(top_srcdir)/src/modules/evas/engines/psl1ght \
-I$(top_builddir)/src/lib/ecore_psl1ght \
-I$(top_builddir)/src/modules/evas/engines/psl1ght
endif
if HAVE_ECORE_SDL
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_sdl \
-I$(top_srcdir)/src/modules/evas/engines/gl_sdl \
-I$(top_builddir)/src/lib/ecore_sdl \
-I$(top_builddir)/src/modules/evas/engines/gl_sdl
endif
if HAVE_ECORE_WAYLAND
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_wayland \
-I$(top_srcdir)/src/modules/evas/engines/wayland_shm \
-I$(top_srcdir)/src/modules/evas/engines/wayland_egl \
-I$(top_builddir)/src/lib/ecore_wayland \
-I$(top_builddir)/src/modules/evas/engines/wayland_shm \
-I$(top_builddir)/src/modules/evas/engines/wayland_egl
endif
if HAVE_WIN32
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_win32 \
-I$(top_srcdir)/src/modules/evas/engines/software_ddraw \
-I$(top_srcdir)/src/modules/evas/engines/software_gdi \
-I$(top_builddir)/src/lib/ecore_win32 \
-I$(top_builddir)/src/modules/evas/engines/software_ddraw \
-I$(top_builddir)/src/modules/evas/engines/software_gdi
endif
if HAVE_WINCE
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_wince \
-I$(top_builddir)/src/lib/ecore_wince
endif
if HAVE_ECORE_X
lib_ecore_evas_libecore_evas_la_CPPFLAGS += \
-I$(top_srcdir)/src/lib/ecore_x \
-I$(top_srcdir)/src/modules/evas/engines/software_x11 \
-I$(top_srcdir)/src/modules/evas/engines/gl_x11 \
-I$(top_builddir)/src/lib/ecore_x \
-I$(top_builddir)/src/modules/evas/engines/software_x11 \
-I$(top_builddir)/src/modules/evas/engines/gl_x11
-I$(top_srcdir)/src/lib/evil \
-I$(top_builddir)/src/lib/evil
endif
lib_ecore_evas_libecore_evas_la_LIBADD = \
@ -130,44 +56,159 @@ lib/eo/libeo.la \
lib/eina/libeina.la \
@ECORE_EVAS_LIBS@
if HAVE_ECORE_COCOA
lib_ecore_evas_libecore_evas_la_LIBADD += \
lib/ecore_cocoa/libecore_cocoa.la
endif
lib_ecore_evas_libecore_evas_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
if HAVE_ECORE_FB
lib_ecore_evas_libecore_evas_la_LIBADD += \
lib/ecore_fb/libecore_fb.la
endif
# Engines
if HAVE_PS3
lib_ecore_evas_libecore_evas_la_LIBADD += \
lib/ecore_psl1ght/libecore_psl1ght.la
endif
if HAVE_ECORE_SDL
lib_ecore_evas_libecore_evas_la_LIBADD += \
lib/ecore_sdl/libecore_sdl.la
endif
if HAVE_ECORE_WAYLAND
lib_ecore_evas_libecore_evas_la_LIBADD += \
lib/ecore_wayland/libecore_wayland.la
endif
if HAVE_WIN32
lib_ecore_evas_libecore_evas_la_LIBADD += \
lib/ecore_win32/libecore_win32.la
endif
if HAVE_WINCE
lib_ecore_evas_libecore_evas_la_LIBADD += \
lib/ecore_wince/libecore_wince.la
if BUILD_ENGINE_BUFFER
BUFFERSOURCES = \
modules/ecore_evas/engines/buffer/ecore_evas_buffer.c \
modules/ecore_evas/engines/buffer/ecore_evas_extn.c \
modules/ecore_evas/engines/buffer/ecore_evas_buffer_private.h
ecoreevasenginebufferpkgdir = $(libdir)/ecore_evas/engines/buffer/$(MODULE_ARCH)
ecoreevasenginebufferpkg_LTLIBRARIES = modules/ecore_evas/engines/buffer/module.la
modules_ecore_evas_engines_buffer_module_la_SOURCES = $(BUFFERSOURCES)
modules_ecore_evas_engines_buffer_module_la_CPPFLAGS = $(lib_ecore_evas_libecore_evas_la_CPPFLAGS)
modules_ecore_evas_engines_buffer_module_la_LIBADD = lib/ecore_evas/libecore_evas.la @EFL_LIBS@
modules_ecore_evas_engines_buffer_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_buffer_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if HAVE_ECORE_X
lib_ecore_evas_libecore_evas_la_LIBADD += \
XSOURCES = modules/ecore_evas/engines/x/ecore_evas_x.c
ecoreevasenginexpkgdir = $(libdir)/ecore_evas/engines/x/$(MODULE_ARCH)
ecoreevasenginexpkg_LTLIBRARIES = modules/ecore_evas/engines/x/module.la
modules_ecore_evas_engines_x_module_la_SOURCES = $(XSOURCES)
modules_ecore_evas_engines_x_module_la_CPPFLAGS = \
$(lib_ecore_evas_libecore_evas_la_CPPFLAGS) \
-I$(top_srcdir)/src/lib/ecore_x \
-I$(top_srcdir)/src/modules/evas/engines/software_x11 \
-I$(top_srcdir)/src/modules/evas/engines/gl_x11 \
-I$(top_builddir)/src/lib/ecore_x \
-I$(top_builddir)/src/modules/evas/engines/software_x11 \
-I$(top_builddir)/src/modules/evas/engines/gl_x11
modules_ecore_evas_engines_x_module_la_LIBADD = \
lib/ecore_evas/libecore_evas.la @EFL_LIBS@ \
lib/ecore_x/libecore_x.la
modules_ecore_evas_engines_x_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_x_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
lib_ecore_evas_libecore_evas_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
if HAVE_ECORE_COCOA
COCOASOURCES = modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
ecoreevasenginecocoapkgdir = $(libdir)/ecore_evas/engines/cocoa/$(MODULE_ARCH)
ecoreevasenginecocoapkg_LTLIBRARIES = modules/ecore_evas/engines/cocoa/module.la
modules_ecore_evas_engines_cocoa_module_la_SOURCES = $(COCOASOURCES)
modules_ecore_evas_engines_cocoa_module_la_CPPFLAGS = \
$(lib_ecore_evas_libecore_evas_la_CPPFLAGS) \
-I$(top_srcdir)/src/lib/ecore_cocoa \
-I$(top_srcdir)/src/modules/evas/engines/gl_cocoa \
-I$(top_builddir)/src/lib/ecore_cocoa \
-I$(top_builddir)/src/modules/evas/engines/gl_cocoa
modules_ecore_evas_engines_cocoa_module_la_LIBADD = \
lib/ecore_evas/libecore_evas.la @EFL_LIBS@ \
lib/ecore_cocoa/libecore_cocoa.la
modules_ecore_evas_engines_cocoa_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_cocoa_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if HAVE_ECORE_FB
FBSOURCES = modules/ecore_evas/engines/fb/ecore_evas_fb.c
ecoreevasenginefbpkgdir = $(libdir)/ecore_evas/engines/fb/$(MODULE_ARCH)
ecoreevasenginefbpkg_LTLIBRARIES = modules/ecore_evas/engines/fb/module.la
modules_ecore_evas_engines_fb_module_la_SOURCES = $(FBSOURCES)
modules_ecore_evas_engines_fb_module_la_CPPFLAGS = \
$(lib_ecore_evas_libecore_evas_la_CPPFLAGS) \
-I$(top_srcdir)/src/lib/ecore_fb \
-I$(top_srcdir)/src/modules/evas/engines/fb \
-I$(top_builddir)/src/lib/ecore_fb \
-I$(top_builddir)/src/modules/evas/engines/fb
modules_ecore_evas_engines_fb_module_la_LIBADD = \
lib/ecore_evas/libecore_evas.la @EFL_LIBS@ \
lib/ecore_fb/libecore_fb.la
modules_ecore_evas_engines_fb_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_fb_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if HAVE_PS3
PSL1GHTSOURCES = modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
ecoreevasenginepsl1ghtpkgdir = $(libdir)/ecore_evas/engines/psl1ght/$(MODULE_ARCH)
ecoreevasenginepsl1ghtpkg_LTLIBRARIES = modules/ecore_evas/engines/psl1ght/module.la
modules_ecore_evas_engines_psl1ght_module_la_SOURCES = $(PSL1GHTSOURCES)
modules_ecore_evas_engines_psl1ght_module_la_CPPFLAGS = \
$(lib_ecore_evas_libecore_evas_la_CPPFLAGS) \
-I$(top_srcdir)/src/lib/ecore_psl1ght \
-I$(top_srcdir)/src/modules/evas/engines/psl1ght \
-I$(top_builddir)/src/lib/ecore_psl1ght \
-I$(top_builddir)/src/modules/evas/engines/psl1ght
modules_ecore_evas_engines_psl1ght_module_la_LIBADD = \
lib/ecore_evas/libecore_evas.la @EFL_LIBS@ \
lib/ecore_psl1ght/libecore_psl1ght.la
modules_ecore_evas_engines_psl1ght_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_psl1ght_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if HAVE_ECORE_WAYLAND
WAYLANDSOURCES = \
modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c \
modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c \
modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c \
modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
ecoreevasenginewaylandpkgdir = $(libdir)/ecore_evas/engines/wayland/$(MODULE_ARCH)
ecoreevasenginewaylandpkg_LTLIBRARIES = modules/ecore_evas/engines/wayland/module.la
modules_ecore_evas_engines_wayland_module_la_SOURCES = $(WAYLANDSOURCES)
modules_ecore_evas_engines_wayland_module_la_CPPFLAGS = \
$(lib_ecore_evas_libecore_evas_la_CPPFLAGS) \
-I$(top_srcdir)/src/lib/ecore_wayland \
-I$(top_srcdir)/src/modules/evas/engines/wayland_shm \
-I$(top_srcdir)/src/modules/evas/engines/wayland_egl \
-I$(top_builddir)/src/lib/ecore_wayland \
-I$(top_builddir)/src/modules/evas/engines/wayland_shm \
-I$(top_builddir)/src/modules/evas/engines/wayland_egl \
@ECORE_WAYLAND_CFLAGS@
modules_ecore_evas_engines_wayland_module_la_LIBADD = \
lib/ecore_evas/libecore_evas.la @EFL_LIBS@ \
lib/ecore_wayland/libecore_wayland.la
modules_ecore_evas_engines_wayland_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_wayland_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if HAVE_ECORE_SDL
SDLSOURCES = \
modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
ecoreevasenginesdlpkgdir = $(libdir)/ecore_evas/engines/sdl/$(MODULE_ARCH)
ecoreevasenginesdlpkg_LTLIBRARIES = modules/ecore_evas/engines/sdl/module.la
modules_ecore_evas_engines_sdl_module_la_SOURCES = $(SDLSOURCES)
modules_ecore_evas_engines_sdl_module_la_CPPFLAGS = \
$(lib_ecore_evas_libecore_evas_la_CPPFLAGS) \
-I$(top_srcdir)/src/lib/ecore_sdl \
-I$(top_srcdir)/src/modules/evas/engines/gl_sdl \
-I$(top_builddir)/src/lib/ecore_sdl \
-I$(top_builddir)/src/modules/evas/engines/gl_sdl
modules_ecore_evas_engines_sdl_module_la_LIBADD = \
lib/ecore_evas/libecore_evas.la @EFL_LIBS@ \
lib/ecore_sdl/libecore_sdl.la
modules_ecore_evas_engines_sdl_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_sdl_module_la_LIBTOOLFLAGS = --tag=disable-static
endif
if HAVE_WIN32
WIN32SOURCES = \
modules/ecore_evas/engines/win32/ecore_evas_win32.c
ecoreevasengineswin32pkgdir = $(libdir)/ecore_evas/engines/win32/$(MODULE_ARCH)
ecoreevasengineswin32pkg_LTLIBRARIES = modules/ecore_evas/engines/win32/module.la
modules_ecore_evas_engines_win32_module_la_SOURCES = $(WIN32SOURCES)
modules_ecore_evas_engines_win32_module_la_CPPFLAGS = \
$(lib_ecore_evas_libecore_evas_la_CPPFLAGS) \
-I$(top_srcdir)/src/lib/ecore_win32 \
-I$(top_srcdir)/src/modules/evas/engines/software_ddraw \
-I$(top_srcdir)/src/modules/evas/engines/software_gdi \
-I$(top_builddir)/src/lib/ecore_win32 \
-I$(top_builddir)/src/modules/evas/engines/software_ddraw \
-I$(top_builddir)/src/modules/evas/engines/software_gdi
modules_ecore_evas_engines_win32_module_la_LIBADD = \
lib/ecore/libeecore_evas.la @EFL_LIBS@ \
lib/ecore_win32/libecore_win32.la
modules_ecore_evas_engines_win32_module_la_LDFLAGS = -no-undefined -module -avoid-version
modules_ecore_evas_engines_win32_module_la_LIBTOOLFLAGS = --tag=disable-static
endif

View File

@ -1,6 +1,8 @@
#ifndef _ECORE_EVAS_H
#define _ECORE_EVAS_H
#include "Ecore_Evas_Types.h"
#include <Evas.h>
#include <Ecore_Getopt.h>
#include <Ecore_Input.h>
@ -145,39 +147,6 @@ typedef enum _Ecore_Evas_Object_Associate_Flags
ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2
} Ecore_Evas_Object_Associate_Flags;
#ifndef _ECORE_X_H
#define _ECORE_X_WINDOW_PREDEF
typedef unsigned int Ecore_X_Window;
#endif
#ifndef _ECORE_DIRECTFB_H
#define _ECORE_DIRECTFB_WINDOW_PREDEF
typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
#endif
#ifndef __ECORE_WIN32_H__
typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
#endif
#ifndef __ECORE_WINCE_H__
typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
#endif
#ifndef __ECORE_COCOA_H__
typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
#endif
#ifndef _ECORE_EVAS_PRIVATE_H
/* basic data types */
typedef struct _Ecore_Evas Ecore_Evas;
typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */
#endif
#ifndef _ECORE_WAYLAND_H_
#define _ECORE_WAYLAND_WINDOW_PREDEF
typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
#endif
/* module setup/shutdown calls */
EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine);

View File

@ -0,0 +1,38 @@
#ifndef _ECORE_EVAS_TYPES_H_
#define _ECORE_EVAS_TYPES_H_
#ifndef _ECORE_X_H
#define _ECORE_X_WINDOW_PREDEF
typedef unsigned int Ecore_X_Window;
#endif
#ifndef _ECORE_DIRECTFB_H
#define _ECORE_DIRECTFB_WINDOW_PREDEF
typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
#endif
#ifndef __ECORE_WIN32_H__
typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
#endif
#ifndef __ECORE_WINCE_H__
typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
#endif
#ifndef __ECORE_COCOA_H__
typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
#endif
#ifndef _ECORE_EVAS_PRIVATE_H
/* basic data types */
typedef struct _Ecore_Evas Ecore_Evas;
typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */
#endif
#ifndef _ECORE_WAYLAND_H_
#define _ECORE_WAYLAND_WINDOW_PREDEF
typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
#endif
#endif /* _ECORE_EVAS_TYPES_H_ */

View File

@ -68,6 +68,23 @@ _ecore_evas_idle_enter(void *data EINA_UNUSED)
return ECORE_CALLBACK_RENEW;
}
Ecore_Evas_Interface *
_ecore_evas_interface_get(const Ecore_Evas *ee, const char *iname)
{
Eina_List *l;
Ecore_Evas_Interface *i;
if (!ee || !iname) return NULL;
EINA_LIST_FOREACH(ee->engine.ifaces, l, i)
{
if (!strcmp(i->name, iname))
return i;
}
return NULL;
}
/**
* Query if a particular rendering engine target has support
* @param engine The engine to check support for
@ -79,6 +96,8 @@ _ecore_evas_idle_enter(void *data EINA_UNUSED)
EAPI int
ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
{
/* It should be done reading the availables engines */
switch (engine)
{
case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER:
@ -252,7 +271,7 @@ ecore_evas_init(void)
_ecore_evas_ews_events_init();
#endif
_ecore_evas_extn_init();
_ecore_evas_engine_init();
if (getenv("ECORE_EVAS_COMP_NOSYNC"))
_ecore_evas_app_comp_sync = 0;
@ -274,28 +293,14 @@ ecore_evas_shutdown(void)
while (ecore_evases) _ecore_evas_free(ecore_evases);
_ecore_evas_extn_shutdown();
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
ecore_idle_enterer_del(ecore_evas_idle_enterer);
ecore_evas_idle_enterer = NULL;
#ifdef BUILD_ECORE_EVAS_X11
while (_ecore_evas_x_shutdown());
#endif
#ifdef BUILD_ECORE_EVAS_WIN32
while (_ecore_evas_win32_shutdown());
#endif
#ifdef BUILD_ECORE_EVAS_FB
while (_ecore_evas_fb_shutdown());
#endif
#ifdef BUILD_ECORE_EVAS_EWS
while (_ecore_evas_ews_shutdown());
#endif
#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
while (_ecore_evas_buffer_shutdown());
#endif
_ecore_evas_engine_shutdown();
if (_ecore_evas_async_events_fd)
ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
@ -490,7 +495,6 @@ _ecore_evas_constructor_opengl_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w,
}
#endif
#ifdef BUILD_ECORE_EVAS_FB
static Ecore_Evas *
_ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
{
@ -506,10 +510,8 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c
return ee;
}
#endif
#ifdef BUILD_ECORE_EVAS_PSL1GHT
static Ecore_Evas *
_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
{
@ -523,9 +525,7 @@ _ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int
if (ee) ecore_evas_move(ee, x, y);
return ee;
}
#endif
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
static Ecore_Evas *
_ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options)
{
@ -541,9 +541,7 @@ _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extr
return ee;
}
#endif
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
static Ecore_Evas *
_ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options)
{
@ -559,47 +557,40 @@ _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extr
return ee;
}
#endif
#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
static Ecore_Evas *
_ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options)
_ecore_evas_constructor_software_gdi(int x, int y, int w, int h,
const char *extra_options EINA_UNUSED)
{
return ecore_evas_software_gdi_new(NULL, x, y, w, h);
}
#endif
#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
static Ecore_Evas *
_ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options)
_ecore_evas_constructor_software_ddraw(int x, int y, int w, int h,
const char *extra_options EINA_UNUSED)
{
return ecore_evas_software_ddraw_new(NULL, x, y, w, h);
}
#endif
#ifdef BUILD_ECORE_EVAS_DIRECT3D
static Ecore_Evas *
_ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options)
_ecore_evas_constructor_direct3d(int x, int y, int w, int h,
const char *extra_options EINA_UNUSED)
{
return ecore_evas_direct3d_new(NULL, x, y, w, h);
}
#endif
#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
static Ecore_Evas *
_ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options)
_ecore_evas_constructor_opengl_glew(int x, int y, int w, int h,
const char *extra_options EINA_UNUSED)
{
return ecore_evas_gl_glew_new(NULL, x, y, w, h);
}
#endif
#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
static Ecore_Evas *
_ecore_evas_constructor_buffer(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options EINA_UNUSED)
{
return ecore_evas_buffer_new(w, h);
}
#endif
#ifdef BUILD_ECORE_EVAS_EWS
static Ecore_Evas *
@ -813,6 +804,23 @@ ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
}
}
EAPI Evas *
ecore_evas_object_evas_get(Evas_Object *obj)
{
Ecore_Evas *ee;
ee = evas_object_data_get(obj, "Ecore_Evas");
if (!ee) return NULL;
return ecore_evas_get(ee);
}
EAPI Ecore_Evas *
ecore_evas_object_ecore_evas_get(Evas_Object *obj)
{
return evas_object_data_get(obj, "Ecore_Evas");
}
#define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn
#define IFE return;}
@ -2434,6 +2442,8 @@ _ecore_evas_unref(Ecore_Evas *ee)
void
_ecore_evas_free(Ecore_Evas *ee)
{
Ecore_Evas_Interface *iface;
ee->deleted = EINA_TRUE;
if (ee->refcount > 0) return;
@ -2470,6 +2480,11 @@ _ecore_evas_free(Ecore_Evas *ee)
ecore_evases = (Ecore_Evas *)eina_inlist_remove
(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
}
EINA_LIST_FREE(ee->engine.ifaces, iface)
free(iface);
ee->engine.ifaces = NULL;
free(ee);
}
@ -2752,90 +2767,684 @@ ecore_evas_input_event_unregister(Ecore_Evas *ee)
ecore_event_window_unregister((Ecore_Window)ee);
}
#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL)
/**
* @brief Create Ecore_Evas using fb backend.
* @param disp_name The name of the display to be used.
* @param rotation The rotation to be used.
* @param w The width of the Ecore_Evas to be created.
* @param h The height of the Ecore_Evas to be created.
* @return The new Ecore_Evas.
*/
EAPI Ecore_Evas *
ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
{
Ecore_Evas *(*new)(const char *, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("fb");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_fb_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(disp_name, rotation, w, h);
}
/**
* @brief Create Ecore_Evas using software x11.
* @note If ecore is not compiled with support to x11 then nothing is done and NULL is returned.
* @param disp_name The name of the Ecore_Evas to be created.
* @param parent The parent of the Ecore_Evas to be created.
* @param x The X coordinate to be used.
* @param y The Y coordinate to be used.
* @param w The width of the Ecore_Evas to be created.
* @param h The height of the Ecore_Evas to be created.
* @return A handle to the created Ecore_Evas.
*/
EAPI Ecore_Evas *
ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h)
{
Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("x");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_software_x11_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(disp_name, parent, x, y, w, h);
}
/**
* @brief Get the window from Ecore_Evas using software x11.
* @note If ecore is not compiled with support for x11 or if @p ee was not
* created with ecore_evas_software_x11_new() then nothing is done and
* 0 is returned.
* @param ee The Ecore_Evas from which to get the window.
* @return The window of type Ecore_X_Window.
*/
EAPI Ecore_X_Window
ecore_evas_software_x11_window_get(const Ecore_Evas *ee)
{
Ecore_Evas_Interface_Software_X11 *iface;
iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
return iface->window_get(ee);
}
/**
* @brief Set the direct_resize of Ecore_Evas using software x11.
* @note If ecore is not compiled with support to x11 then nothing is done.
* @param ee The Ecore_Evas in which to set direct resize.
* @param on Enables the resize of Ecore_Evas if equals EINA_TRUE, disables if equals EINA_FALSE.
*/
EAPI void
ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
{
Ecore_Evas_Interface_Software_X11 *iface;
iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->resize_set(ee, on);
}
/**
* @brief Gets if the Ecore_Evas is being directly resized using software x11.
* @note If ecore is not compiled with support to x11 then nothing is done and EINA_FALSE is returned.
* @param ee The Ecore_Evas from which to get direct resize.
* @return EINA_TRUE if the resize was managed directly, otherwise return EINA_FALSE.
*/
EAPI Eina_Bool
ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee)
{
Ecore_Evas_Interface_Software_X11 *iface;
iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
return iface->resize_get(ee);
}
/**
* @brief Add extra window on Ecore_Evas using software x11.
* @note If ecore is not compiled with support to x11 then nothing is done.
* @param ee The Ecore_Evas on which to add the window.
* @param win The window to be added at the Ecore_Evas.
*/
EAPI void
ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
{
Ecore_Evas_Interface_Software_X11 *iface;
iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->extra_event_window_add(ee, win);
}
/**
* @brief Create Ecore_Evas using opengl x11.
* @note If ecore is not compiled with support to x11 then nothing is done and NULL is returned.
* @param disp_name The name of the display of the Ecore_Evas to be created.
* @param parent The parent of the Ecore_Evas to be created.
* @param x The X coordinate to be used.
* @param y The Y coordinate to be used.
* @param w The width of the Ecore_Evas to be created.
* @param h The height of the Ecore_Evas to be created.
* @return The new Ecore_Evas.
*/
EAPI Ecore_Evas *
ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h)
{
Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("x");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_gl_x11_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(disp_name, parent, x, y, w, h);
}
EAPI Ecore_Evas *
ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, const int *opt)
{
Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int, const int*);
Eina_Module *m = _ecore_evas_engine_load("x");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_gl_x11_options_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(disp_name, parent, x, y, w, h, opt);
}
/**
* @brief Get the window from Ecore_Evas using opengl x11.
* @note If ecore is not compiled with support for x11 or if @p ee was not
* created with ecore_evas_gl_x11_new() then nothing is done and
* 0 is returned.
* @param ee The Ecore_Evas from which to get the window.
* @return The window of type Ecore_X_Window of Ecore_Evas.
*/
EAPI Ecore_X_Window
ecore_evas_gl_x11_window_get(const Ecore_Evas *ee)
{
Ecore_Evas_Interface_Gl_X11 *iface;
iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
return iface->window_get(ee);
}
/**
* @brief Set direct_resize for Ecore_Evas using opengl x11.
* @note If ecore is not compiled with support to x11 then nothing is done.
* @param ee The Ecore_Evas in which to set direct resize.
* @param on Enables the resize of Ecore_Evas if equals EINA_TRUE, disables if equals EINA_FALSE.
*/
EAPI void
ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
{
Ecore_Evas_Interface_Gl_X11 *iface;
iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->resize_set(ee, on);
}
/**
* @brief Gets if the Ecore_Evas is being directly resized using opengl x11.
* @note If ecore is not compiled with support to x11 then nothing is done and EINA_FALSE is returned.
* @param ee The Ecore_Evas from which to get direct resize.
* @return EINA_TRUE if the resize was managed directly, otherwise return EINA_FALSE.
*/
EAPI Eina_Bool
ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee)
{
Ecore_Evas_Interface_Gl_X11 *iface;
iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
return iface->resize_get(ee);
}
/**
* @brief Add extra window on Ecore_Evas using opengl x11.
* @note If ecore is not compiled with support to x11 then nothing is done.
* @param ee The Ecore_Evas for which to add the window.
* @param win The window to be added at the Ecore_Evas.
*/
EAPI void
ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
{
Ecore_Evas_Interface_Gl_X11 *iface;
iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->extra_event_window_add(ee, win);
}
/**
* @brief Set the functions to be used before and after the swap callback.
* @note If ecore is not compiled with support to x11 then nothing is done and the function is returned.
* @param ee The Ecore_Evas for which to set the swap callback.
* @param data The data for which to set the swap callback.
* @param pre_cb The function to be called before the callback.
* @param post_cb The function to be called after the callback.
*/
EAPI void
ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e))
{
Ecore_Evas_Interface_Gl_X11 *iface;
iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->pre_post_swap_callback_set(ee, data, pre_cb, post_cb);
}
EAPI void
ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->leader_set(ee, win);
}
EAPI Ecore_X_Window
ecore_evas_x11_leader_get(Ecore_Evas *ee)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
return iface->leader_get(ee);
}
EAPI void
ecore_evas_x11_leader_default_set(Ecore_Evas *ee)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->leader_default_set(ee);
}
EAPI void
ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->shape_input_rectangle_set(ee, x, y, w, h);
}
EAPI void
ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->shape_input_rectangle_add(ee, x, y, w, h);
}
EAPI void
ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->shape_input_rectangle_subtract(ee, x, y, w, h);
}
EAPI void
ecore_evas_x11_shape_input_empty(Ecore_Evas *ee)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->shape_input_empty(ee);
}
EAPI void
ecore_evas_x11_shape_input_reset(Ecore_Evas *ee)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->shape_input_reset(ee);
}
EAPI void
ecore_evas_x11_shape_input_apply(Ecore_Evas *ee)
{
Ecore_Evas_Interface_X11 *iface;
iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->shape_input_apply(ee);
}
EAPI Ecore_Evas *
ecore_evas_buffer_new(int w, int h)
{
Ecore_Evas *(*new)(int, int);
Eina_Module *m = _ecore_evas_engine_load("buffer");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_buffer_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(w, h);
}
EAPI const void *
ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
{
Ecore_Evas_Interface_Buffer *iface;
iface = (Ecore_Evas_Interface_Buffer *)_ecore_evas_interface_get(ee, "buffer");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
return iface->pixels_get(ee);
}
EAPI Ecore_Evas *
ecore_evas_buffer_allocfunc_new(int w, int h,
void *(*alloc_func) (void *data, int size),
void (*free_func) (void *data, void *pix),
const void *data)
{
Ecore_Evas *(*new)(int, int, void*(*)(void *, int), void(*)(void *, void *), const void *);
Eina_Module *m = _ecore_evas_engine_load("buffer");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_buffer_allocfunc_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(w, h, alloc_func, free_func, data);
}
int
ecore_evas_buffer_render(Ecore_Evas *ee)
{
Ecore_Evas_Interface_Buffer *iface;
iface = (Ecore_Evas_Interface_Buffer *)_ecore_evas_interface_get(ee, "buffer");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
return iface->render(ee);
}
EAPI Ecore_Evas *
ecore_evas_extn_socket_new(int w, int h)
{
Ecore_Evas *(*new)(int, int);
Eina_Module *m = _ecore_evas_engine_load("buffer");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_extn_socket_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(w, h);
}
EAPI Eina_Bool
ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys)
{
Ecore_Evas_Interface_Extn *iface;
iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
return iface->listen(ee, svcname, svcnum, svcsys);
}
EAPI void
ecore_evas_extn_plug_object_data_lock(Evas_Object *obj)
{
Ecore_Evas_Interface_Extn *iface;
Ecore_Evas *ee;
ee = ecore_evas_object_ecore_evas_get(obj);
iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->data_lock(ee);
}
EAPI void
ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj)
{
Ecore_Evas_Interface_Extn *iface;
Ecore_Evas *ee;
ee = ecore_evas_object_ecore_evas_get(obj);
iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->data_unlock(ee);
}
EAPI Evas_Object *
ecore_evas_extn_plug_new(Ecore_Evas *ee_target)
{
Evas_Object *(*new)(Ecore_Evas *);
Eina_Module *m = _ecore_evas_engine_load("buffer");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_extn_plug_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(ee_target);
}
EAPI Eina_Bool
ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
{
Ecore_Evas_Interface_Extn *iface;
Ecore_Evas *ee;
ee = ecore_evas_object_ecore_evas_get(obj);
iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
if (!iface) return EINA_FALSE;
return iface->connect(ee, svcname, svcnum, svcsys);
}
EAPI Evas_Object *
ecore_evas_object_image_new(Ecore_Evas *ee_target)
{
Evas_Object *(*new)(Ecore_Evas *ee_target);
Eina_Module *m = _ecore_evas_engine_load("buffer");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_object_image_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(ee_target);
}
EAPI Ecore_Evas *
ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen,
int hwsurface, int noframe, int alpha)
{
Ecore_Evas *(*new)(const char *, int, int, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("sdl");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_sdl_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(name, w, h, fullscreen, hwsurface, noframe, alpha);
}
EAPI Ecore_Evas *
ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen,
int hwsurface, int noframe, int alpha)
{
Ecore_Evas *(*new)(const char *, int, int, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("sdl");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_sdl16_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(name, w, h, fullscreen, hwsurface, noframe, alpha);
}
EAPI Ecore_Evas *
ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe)
{
Ecore_Evas *(*new)(const char *, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("sdl");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_gl_sdl_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(name, w, h, fullscreen, noframe);
}
EAPI Ecore_Evas *
ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent,
int x, int y, int w, int h, Eina_Bool frame)
{
Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int, Eina_Bool);
Eina_Module *m = _ecore_evas_engine_load("wayland");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_wayland_shm_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(disp_name, parent, x, y, w, h, frame);
}
EAPI Ecore_Evas *
ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent,
int x, int y, int w, int h, Eina_Bool frame)
{
Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int, Eina_Bool);
Eina_Module *m = _ecore_evas_engine_load("wayland");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_wayland_egl_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(disp_name, parent, x, y, w, h, frame);
}
EAPI void
ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
{
if (!ee) return;
if (!strcmp(ee->driver, "wayland_shm"))
{
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
_ecore_evas_wayland_shm_resize(ee, location);
#endif
}
else if (!strcmp(ee->driver, "wayland_egl"))
{
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
_ecore_evas_wayland_egl_resize(ee, location);
#endif
}
Ecore_Evas_Interface_Wayland *iface;
iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->resize(ee, location);
}
EAPI void
EAPI void
ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y)
{
if (!ee) return;
if (!strncmp(ee->driver, "wayland", 7))
{
if (ee->engine.wl.win)
{
ee->engine.wl.win->moving = EINA_TRUE;
ecore_wl_window_move(ee->engine.wl.win, x, y);
}
}
Ecore_Evas_Interface_Wayland *iface;
iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->move(ee, x, y);
}
EAPI void
ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y)
{
Ecore_Evas_Interface_Wayland *iface;
iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->pointer_set(ee, hot_x, hot_y);
}
EAPI void
ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
{
if (!ee) return;
ecore_wl_window_type_set(ee->engine.wl.win, type);
Ecore_Evas_Interface_Wayland *iface;
iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN(iface);
iface->type_set(ee, type);
}
EAPI Ecore_Wl_Window *
ecore_evas_wayland_window_get(const Ecore_Evas *ee)
{
if (!(!strncmp(ee->driver, "wayland", 7)))
return NULL;
Ecore_Evas_Interface_Wayland *iface;
iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
return ee->engine.wl.win;
return iface->window_get(ee);
}
EAPI void
ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED)
EAPI Ecore_Evas *
ecore_evas_software_gdi_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height)
{
Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("win32");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_software_gdi_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(parent, x, y, width, height);
}
#else
EAPI void
ecore_evas_wayland_resize(Ecore_Evas *ee EINA_UNUSED, int location EINA_UNUSED)
EAPI Ecore_Evas *
ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height)
{
Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("win32");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_software_ddraw_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(parent, x, y, width, height);
}
EAPI void
ecore_evas_wayland_move(Ecore_Evas *ee EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
EAPI Ecore_Evas *
ecore_evas_direct3d_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height)
{
Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("win32");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_direct3d_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(parent, x, y, width, height);
}
EAPI void
ecore_evas_wayland_type_set(Ecore_Evas *ee EINA_UNUSED, int type EINA_UNUSED)
EAPI Ecore_Evas *
ecore_evas_gl_glew_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height)
{
Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("win32");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_gl_glew_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(parent, x, y, width, height);
}
EAPI Ecore_Wl_Window *
ecore_evas_wayland_window_get(const Ecore_Evas *ee EINA_UNUSED)
EAPI Ecore_Win32_Window *
ecore_evas_win32_window_get(const Ecore_Evas *ee)
{
return NULL;
Ecore_Evas_Interface_Win32 *iface;
iface = (Ecore_Evas_Interface_Win32 *)_ecore_evas_interface_get(ee, "win32");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
return iface->window_get(ee);
}
EAPI void
ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED)
EAPI Ecore_Evas *
ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h)
{
Ecore_Evas *(*new)(Ecore_Cocoa_Window *, int, int, int, int);
Eina_Module *m = _ecore_evas_engine_load("cocoa");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_cocoa_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(parent, x, y, w, h);
}
#endif
EAPI Ecore_Evas *
ecore_evas_psl1ght_new(const char* name, int w, int h)
{
Ecore_Evas *(*new)(const char*, int, int);
Eina_Module *m = _ecore_evas_engine_load("psl1ght");
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_psl1ght_new_internal");
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return new(name, w, h);
}

View File

@ -0,0 +1,96 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Ecore_Evas.h"
#include "ecore_evas_private.h"
Eina_Hash *_registered_engines = NULL;
Eina_List *_engines_paths = NULL;
#if defined(__CEGCC__) || defined(__MINGW32CE__) || defined(_WIN32)
# define ECORE_EVAS_ENGINE_NAME "module.dll"
#else
# define ECORE_EVAS_ENGINE_NAME "module.so"
#endif
Eina_Module *
_ecore_evas_engine_load(const char *engine)
{
const char *path;
Eina_List *l;
Eina_Module *em = NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(engine, NULL);
em = (Eina_Module *)eina_hash_find(_registered_engines, engine);
if (em) return em;
EINA_LIST_FOREACH(_engines_paths, l, path)
{
char tmp[PATH_MAX];
snprintf(tmp, sizeof (tmp), "%s/%s/%s/"ECORE_EVAS_ENGINE_NAME, path, engine, MODULE_ARCH);
em = eina_module_new(tmp);
if (!em) continue;
if (!eina_module_load(em))
{
eina_module_free(em);
continue;
}
if (eina_hash_add(_registered_engines, engine, em))
return em;
}
return NULL;
}
void
_ecore_evas_engine_init(void)
{
char *paths[4] = { NULL, NULL, NULL, NULL };
unsigned int i;
unsigned int j;
_registered_engines = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free));
/* 1. ~/.ecore_evas/modules/ */
paths[0] = eina_module_environment_path_get("HOME", "/.ecore_evas/engines");
/* 2. $(ECORE_ENGINE_DIR)/ecore_evas/modules/ */
paths[1] = eina_module_environment_path_get("ECORE_EVAS_ENGINES_DIR", "/ecore_evas/engines");
/* 3. libecore_evas.so/../ecore_evas/engines/ */
paths[2] = eina_module_symbol_path_get(_ecore_evas_engine_init, "/ecore_evas/engines");
/* 4. PREFIX/ecore_evas/engines/ */
#ifndef _MSC_VER
paths[3] = strdup(PACKAGE_LIB_DIR "/ecore_evas/engines");
#endif
for (j = 0; j < ((sizeof (paths) / sizeof (char*)) - 1); ++j)
for (i = j + 1; i < sizeof (paths) / sizeof (char*); ++i)
if (paths[i] && paths[j] && !strcmp(paths[i], paths[j]))
{
free(paths[i]);
paths[i] = NULL;
}
for (i = 0; i < sizeof (paths) / sizeof (char*); ++i)
if (paths[i])
_engines_paths = eina_list_append(_engines_paths, paths[i]);
}
void
_ecore_evas_engine_shutdown(void)
{
char *path;
if (_registered_engines)
{
eina_hash_free(_registered_engines);
_registered_engines = NULL;
}
EINA_LIST_FREE(_engines_paths, path)
free(path);
}

View File

@ -1,6 +1,8 @@
#ifndef _ECORE_EVAS_PRIVATE_H
#define _ECORE_EVAS_PRIVATE_H
#include "Ecore_Evas_Types.h"
#include <Evas.h>
#include <Ecore.h>
#include <ecore_private.h>
@ -9,67 +11,10 @@
#define ECORE_MAGIC_EVAS 0x76543211
#ifdef BUILD_ECORE_EVAS_X11
# include <Ecore_X.h>
# include <Ecore_X_Atoms.h>
# ifdef HAVE_ECORE_X_XCB
# include <xcb/xcb.h>
# endif
# ifdef HAVE_ECORE_X_XLIB
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
#endif
#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
# include <Evas_Engine_Software_X11.h>
#endif
#ifdef BUILD_ECORE_EVAS_OPENGL_X11
# include <Evas_Engine_GL_X11.h>
#endif
#ifdef BUILD_ECORE_EVAS_FB
# include <Evas_Engine_FB.h>
#endif
#if defined(BUILD_ECORE_EVAS_SOFTWARE_BUFFER) || defined(BUILD_ECORE_EVAS_EWS)
# include <Evas_Engine_Buffer.h>
#endif
#ifdef BUILD_ECORE_EVAS_WIN32
# include "Ecore_Win32.h"
# ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
# include <Evas_Engine_Software_Gdi.h>
# endif
# ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
# include <Evas_Engine_Software_DDraw.h>
# endif
# ifdef BUILD_ECORE_EVAS_DIRECT3D
# include <Evas_Engine_Direct3D.h>
# endif
# ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
# include <Evas_Engine_GL_Glew.h>
# endif
#endif
#ifdef BUILD_ECORE_EVAS_GL_COCOA
# include "Ecore_Cocoa.h"
# include <Evas_Engine_Gl_Cocoa.h>
#endif
#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL)
# include "Ecore_Wayland.h"
#endif
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
# include <Evas_Engine_Wayland_Shm.h>
#endif
#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
# include <Evas_Engine_Wayland_Egl.h>
#endif
/** Log domain macros and variables **/
extern int _ecore_evas_log_dom;