captainigloo pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a254725d6dedbcfec638f8151bd89e9db068df8f

commit a254725d6dedbcfec638f8151bd89e9db068df8f
Author: Florent Revest <revest...@gmail.com>
Date:   Wed Jul 22 18:48:41 2015 +0200

    ecore_evas: Adds an eglfs module
---
 src/lib/ecore_evas/Ecore_Evas.h                   |   3 +
 src/lib/ecore_evas/ecore_evas.c                   |  36 ++++++++
 src/lib/ecore_evas/ecore_evas_module.c            |   3 +
 src/modules/ecore_evas/engines/fb/ecore_evas_fb.c | 106 ++++++++++++++++++++++
 4 files changed, 148 insertions(+)

diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 1a035ab..9e94ebd 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -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;
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index f7fa61f..ad15b1f 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -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;
@@ -641,6 +647,22 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y 
EINA_UNUSED, int w, int h, c
 }
 
 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)
 {
    Ecore_Evas *ee;
@@ -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},
@@ -3481,6 +3504,19 @@ 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)
+{
+   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)
 {
    Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int);
diff --git a/src/lib/ecore_evas/ecore_evas_module.c 
b/src/lib/ecore_evas/ecore_evas_module.c
index 59fb601..239829d 100644
--- a/src/lib/ecore_evas/ecore_evas_module.c
+++ b/src/lib/ecore_evas/ecore_evas_module.c
@@ -189,6 +189,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"))
                          {
diff --git a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c 
b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
index 8042d0c..34e410d 100644
--- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
+++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
@@ -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

-- 


Reply via email to