forked from enlightenment/efl
ecore_evas: Adds an eglfs module
This commit is contained in:
parent
715e0a2508
commit
a254725d6d
|
@ -91,6 +91,7 @@ extern "C" {
|
|||
*/
|
||||
#define HAVE_ECORE_EVAS_X 1
|
||||
#define HAVE_ECORE_EVAS_FB 1
|
||||
#define HAVE_ECORE_EVAS_EGLFS 1
|
||||
#define HAVE_ECORE_EVAS_X11_GL 1
|
||||
//#define HAVE_ECORE_EVAS_X11_16 1
|
||||
//#define HAVE_ECORE_EVAS_DIRECTFB 1
|
||||
|
@ -121,6 +122,7 @@ typedef enum _Ecore_Evas_Engine_Type
|
|||
ECORE_EVAS_ENGINE_SOFTWARE_SDL,
|
||||
ECORE_EVAS_ENGINE_DIRECTFB,
|
||||
ECORE_EVAS_ENGINE_SOFTWARE_FB,
|
||||
ECORE_EVAS_ENGINE_EGLFS,
|
||||
ECORE_EVAS_ENGINE_SOFTWARE_8_X11,
|
||||
ECORE_EVAS_ENGINE_SOFTWARE_16_X11,
|
||||
ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
|
||||
|
@ -1303,6 +1305,7 @@ EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Eva
|
|||
* @return The new Ecore_Evas.
|
||||
*/
|
||||
EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h);
|
||||
EAPI Ecore_Evas *ecore_evas_eglfs_new(const char *disp_name, int rotation, int w, int h);
|
||||
|
||||
EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) EINA_DEPRECATED;
|
||||
EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee) EINA_DEPRECATED;
|
||||
|
|
|
@ -277,6 +277,12 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
|
|||
#else
|
||||
return EINA_FALSE;
|
||||
#endif
|
||||
case ECORE_EVAS_ENGINE_EGLFS:
|
||||
#ifdef BUILD_ECORE_EVAS_EGLFS
|
||||
return EINA_TRUE;
|
||||
#else
|
||||
return EINA_FALSE;
|
||||
#endif
|
||||
|
||||
case ECORE_EVAS_ENGINE_SOFTWARE_8_X11:
|
||||
return EINA_FALSE;
|
||||
|
@ -640,6 +646,22 @@ _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_eglfs(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
char *disp_name = NULL;
|
||||
unsigned int rotation = 0;
|
||||
|
||||
_ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
|
||||
_ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation);
|
||||
|
||||
ee = ecore_evas_eglfs_new(disp_name, rotation, w, h);
|
||||
free(disp_name);
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -764,6 +786,7 @@ static const struct ecore_evas_engine _engines[] = {
|
|||
{"software_x11", _ecore_evas_constructor_software_x11},
|
||||
{"opengl_x11", _ecore_evas_constructor_opengl_x11},
|
||||
{"fb", _ecore_evas_constructor_fb},
|
||||
{"eglfs", _ecore_evas_constructor_eglfs},
|
||||
{"software_gdi", _ecore_evas_constructor_software_gdi},
|
||||
{"software_ddraw", _ecore_evas_constructor_software_ddraw},
|
||||
{"direct3d", _ecore_evas_constructor_direct3d},
|
||||
|
@ -3480,6 +3503,19 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
|
|||
return new(disp_name, rotation, w, h);
|
||||
}
|
||||
|
||||
EAPI Ecore_Evas *
|
||||
ecore_evas_eglfs_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_eglfs_new_internal");
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
|
||||
|
||||
return new(disp_name, rotation, w, h);
|
||||
}
|
||||
|
||||
EAPI Ecore_Evas *
|
||||
ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h)
|
||||
{
|
||||
|
|
|
@ -188,6 +188,9 @@ _ecore_evas_available_engines_get(void)
|
|||
{
|
||||
#ifdef BUILD_ECORE_EVAS_FB
|
||||
ADDENG("fb");
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_EGLFS
|
||||
ADDENG("eglfs");
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(name, "x"))
|
||||
|
|
|
@ -744,3 +744,109 @@ ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h)
|
|||
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
|
||||
return ee;
|
||||
}
|
||||
|
||||
#ifdef BUILD_ECORE_EVAS_EGLFS
|
||||
EAPI Ecore_Evas *
|
||||
ecore_evas_eglfs_new_internal(const char *disp_name, int rotation, int w, int h)
|
||||
{
|
||||
Evas_Engine_Info_FB *einfo;
|
||||
Ecore_Evas_Engine_FB_Data *idata;
|
||||
Ecore_Evas *ee;
|
||||
|
||||
int rmethod;
|
||||
|
||||
if (!disp_name)
|
||||
disp_name = ecore_evas_default_display;
|
||||
|
||||
rmethod = evas_render_method_lookup("eglfs");
|
||||
if (!rmethod) return NULL;
|
||||
|
||||
if (!ecore_fb_init(disp_name)) return NULL;
|
||||
ee = calloc(1, sizeof(Ecore_Evas));
|
||||
if (!ee) return NULL;
|
||||
idata = calloc(1, sizeof(Ecore_Evas_Engine_FB_Data));
|
||||
|
||||
ee->engine.data = idata;
|
||||
|
||||
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
||||
|
||||
_ecore_evas_fb_init(ee, w, h);
|
||||
|
||||
ecore_fb_callback_gain_set(_ecore_evas_fb_gain, ee);
|
||||
ecore_fb_callback_lose_set(_ecore_evas_fb_lose, ee);
|
||||
|
||||
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func;
|
||||
|
||||
ee->driver = "eglfs";
|
||||
if (disp_name) ee->name = strdup(disp_name);
|
||||
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
ee->rotation = rotation;
|
||||
ee->visible = 1;
|
||||
ee->w = w;
|
||||
ee->h = h;
|
||||
ee->req.w = ee->w;
|
||||
ee->req.h = ee->h;
|
||||
|
||||
ee->prop.max.w = 0;
|
||||
ee->prop.max.h = 0;
|
||||
ee->prop.layer = 0;
|
||||
ee->prop.focused = EINA_FALSE;
|
||||
ee->prop.borderless = EINA_TRUE;
|
||||
ee->prop.override = EINA_TRUE;
|
||||
ee->prop.maximized = EINA_TRUE;
|
||||
ee->prop.fullscreen = EINA_FALSE;
|
||||
ee->prop.withdrawn = EINA_TRUE;
|
||||
ee->prop.sticky = EINA_FALSE;
|
||||
|
||||
/* init evas here */
|
||||
ee->evas = evas_new();
|
||||
evas_data_attach_set(ee->evas, ee);
|
||||
evas_output_method_set(ee->evas, rmethod);
|
||||
|
||||
if (ECORE_EVAS_PORTRAIT(ee))
|
||||
{
|
||||
evas_output_size_set(ee->evas, w, h);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_output_size_set(ee->evas, h, w);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, h, w);
|
||||
}
|
||||
|
||||
einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas);
|
||||
if (einfo && disp_name)
|
||||
{
|
||||
einfo->info.virtual_terminal = 0;
|
||||
einfo->info.device_number = strtol(disp_name, NULL, 10);
|
||||
einfo->info.refresh = 0;
|
||||
einfo->info.rotation = ee->rotation;
|
||||
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
||||
{
|
||||
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
|
||||
ecore_evas_free(ee);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
|
||||
ecore_evas_free(ee);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ecore_evas_input_event_register(ee);
|
||||
|
||||
ee->engine.func->fn_render = _ecore_evas_fb_render;
|
||||
_ecore_evas_register(ee);
|
||||
ecore_event_window_register(1, ee, ee->evas,
|
||||
(Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
|
||||
(Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
|
||||
(Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
|
||||
(Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
|
||||
evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
|
||||
return ee;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue