Oops, off by one bug parsince ELM_ENGINE arguments due last minute
change. new version attached.

BTW, talking at #edevelop I believe this could be done:

ecore_evas_eland_new(...), ecore_evas_new("eland", ...): creates
windows using eland

ecore_evas_eland_setup(parent_engine, x, y, w, h, options): creates
eland internal window
ecore_evas_eland_ecore_evas_get(): return eland's internal ecore_evas/canvas
ecore_evas_eland_children_get(): return list of windows created with
ecore_evas_eland_new()

with events:
ECORE_EVAS_ELAND_ADD: Ecore_Evas *new_win
ECORE_EVAS_ELAND_DEL: Ecore_Evas *old_win
ECORE_EVAS_ELAND_RESIZED: Ecore_Evas *win
ECORE_EVAS_ELAND_MOVED: Ecore_Evas *win
ECORE_EVAS_ELAND_SHOW: Ecore_Evas *win
ECORE_EVAS_ELAND_HIDE: Ecore_Evas *win
ECORE_EVAS_ELAND_FOCUSED: Ecore_Evas *win
ECORE_EVAS_ELAND_UNFOCUSED: Ecore_Evas *win
ECORE_EVAS_ELAND_ICONIFIED_CHANGED: Ecore_Evas *win
ECORE_EVAS_ELAND_MAXIMIZED_CHANGED: Ecore_Evas *win
ECORE_EVAS_ELAND_LAYER_CHANGED: Ecore_Evas *win
ECORE_EVAS_ELAND_CONFIG_CHANGED: Ecore_Evas *win /* catch all, title,
alpha, shaped, transparency, sticky...*/

with that we can write a "window manager" for it, a simple one can go
in Elementary as it knows edje and provides theme, it will decorate
windows and provide simple management.

Regards,
-- Gustavo

On Tue, Oct 4, 2011 at 12:44 PM, Gustavo Sverzut Barbieri
<barbi...@profusion.mobi> wrote:
> To prove my point, find attached the quick patch implementing "eland".
> It's inside elementary, but better to split it to ecore_evas or
> another project, expose some signals so windows can be decorated,
> moved, etc. Anyway, doing in Elementary was super-easy as inlined
> windows were supported, I just had to sync move/resize of them.
>
> Kakaroto, could you check this on PS3?
>
> What do you people think of it?
>
> Regards,
> -- Gustavo
>
>
> On Tue, Oct 4, 2011 at 10:52 AM, Gustavo Sverzut Barbieri
> <barbi...@profusion.mobi> wrote:
>> On Mon, Oct 3, 2011 at 11:06 PM, Youness Alaoui
>> <kakar...@kakaroto.homelinux.net> wrote:
>>>  Hey Gustavo!
>>> Thanks for answering my email! It's appreciated.
>>> However it didn't answer my questions, because basically, no, I'm not going
>>> to implement a window manager for the PS3 :) Don't forget that all
>>> applications/games will be full screen windows, and that 0.1% of people (a
>>> lot less I'm sure) actually have a mouse/keyboard hooked to their ps3, so
>>> having multiple windows is not a solution. I'm ok with single window apps,
>>> and while I do want to have interoperability with existing EFL apps without
>>> (or few) modifications, I mostly want something for new app development and
>>> a clear API on how to change resolution and how to handle the situation I
>>> explained.. most importantly, I'm not going to implement a WM, compositor,
>>> wayland or anything fancy like that :)
>>> I am not focusing on multi window apps, in my previous email, when I said I
>>> used elementary_test, I failed to mention I only ran it with --test-win-only
>>> to make sure only one window is created, so this is not the issue here.
>>
>> You're overlooking the problem. :-)
>>
>> 1 - The game content itself will run on the main Ecore_Evas that uses
>> PS3 directly, not the inner windows. Less overhead... And likely it
>> will use the GL bindings, as most games will use GL directly and not
>> Evas. Then, to configure the screen they would use this API to set
>> their best resolution.
>>
>> 2 - Most apps will need to have some kind of multiple windows, like
>> popups and so to extend/configure the game. These will likely bring
>> the need for this "manager".
>>
>> 3 - The manager should be simple. It's already possible right now,
>> there is no hard code to do. You just manage windows as Evas_Object
>> (Image) at the parent canvas,  so window move =
>> evas_object_move(window_backing_store, x, y). Resize, hide... are
>> similar. Ecore provides such integration with
>> ecore_evas_object_image_new(). What we need is to provide such engine
>> for Elementary, instead of using your PS3 engine.
>>
>>
>>> I like the screen_geometry_set and screen_modes_list, but I think they
>>> should go into evas or ecore-evas rather than elm, because they might be
>>> useful to people not using elm.
>>
>> Sure, likely the elm one is a wrapper over ecore_evas functions. When
>> using my proposed engine, it would apply it to the underlying
>> Ecore_Evas, for instance.
>>
>>
>>> E17 has a resolution config dialog, how does it get/set the screen's
>>> resolution? I suppose by using xrandr or something like that? maybe we can
>>> abstract that into evas directly, this way it would work on non-X backends
>>> like framebuffer/ps3.
>>
>> it's Xrandr. But it's complex and every system is different. Unless we
>> make a complex system that covers them all, they would still be
>> per-engine. X11 would need modelines, etc.
>>
>>
>>> What I have done for now is use the fullscreen flag to decide whether or not
>>> to call the resized callback with the full screen size (scale or resize
>>> window). If we add the modes_list and screen_geometry_set functions then it
>>> would fix a few of the issues I had.
>>
>> it may work, but it's just going around the problem :-)
>>
>>
>> --
>> Gustavo Sverzut Barbieri
>> http://profusion.mobi embedded systems
>> --------------------------------------
>> MSN: barbi...@gmail.com
>> Skype: gsbarbieri
>> Mobile: +55 (19) 9225-2202
>>
>
>
>
> --
> Gustavo Sverzut Barbieri
> http://profusion.mobi embedded systems
> --------------------------------------
> MSN: barbi...@gmail.com
> Skype: gsbarbieri
> Mobile: +55 (19) 9225-2202
>



-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
Index: src/lib/elm_config.c
===================================================================
--- src/lib/elm_config.c	(revision 63807)
+++ src/lib/elm_config.c	(working copy)
@@ -31,6 +31,7 @@
    "software_16_sdl",
    "opengl_sdl",
    "buffer",
+   "eland",
    NULL
 };
 
@@ -1469,6 +1470,8 @@
           eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER);
         else if ((!strncmp(s, "shot:", 5)))
           eina_stringshare_replace(&_elm_config->engine, s);
+        else if ((!strncmp(s, "eland", 5)))
+          eina_stringshare_replace(&_elm_config->engine, s);
      }
 
    s = getenv("ELM_VSYNC");
Index: src/lib/elm_win.c
===================================================================
--- src/lib/elm_win.c	(revision 63807)
+++ src/lib/elm_win.c	(working copy)
@@ -25,6 +25,7 @@
       int shot_counter;
    } shot;
    Eina_Bool autodel : 1;
+   Eina_Bool eland_win : 1;
    int *autodel_clear, rot;
    int show_count;
    struct {
@@ -88,11 +89,153 @@
    {NULL, NULL}
 };
 
+/* TODO: api to get eland's ee? */
+static Ecore_Evas *_eland_ee = NULL;
+/* TODO: api to select defaults */
+static const char *_eland_default_engine = "software_x11";
+static const char *_eland_default_options = NULL;
+static int _eland_default_x = 0;
+static int _eland_default_y = 0;
+static int _eland_default_w = 1024;
+static int _eland_default_h = 768;
 
 
 Eina_List *_elm_win_list = NULL;
 int _elm_win_deferred_free = 0;
 
+// example eland spec: parameters to ecore_evas_new()
+// ELM_ENGINE="eland[:<ecore-evas-engine>:<x>:<y>:<w>:<h>[:<options>]]"
+// ELM_ENGINE="eland[:software_x11:0:0:1024:768:alpha=1]
+static Ecore_Evas *
+_eland_ecore_evas_new(void)
+{
+   Ecore_Evas *ee;
+   int x, y, w, h;
+   const char *engine = NULL;
+   const char *options = NULL;
+   char *buf = NULL, *p, *n;
+
+   if (strncmp(_elm_config->engine, "eland", 5))
+     {
+        ERR("engine is not 'eland' but '%s'", _elm_config->engine);
+        return NULL;
+     }
+
+   if (_elm_config->engine[5] != ':')
+     {
+        engine = _eland_default_engine;
+        options = _eland_default_options;
+        x = _eland_default_x;
+        y = _eland_default_y;
+        w = _eland_default_w;
+        h = _eland_default_h;
+     }
+   else
+     {
+        buf = strdup(_elm_config->engine + 6);
+        if (!buf)
+          {
+             ERR("could not allocate memory");
+             return NULL;
+          }
+        p = buf;
+        n = strchr(p, ':');
+        if (!n) goto inval_spec;
+        if (n == p) engine = _eland_default_engine;
+        else
+          {
+             *n = '\0';
+             engine = p;
+          }
+
+        p = n + 1;
+        n = strchr(p, ':');
+        if (!n) goto inval_spec;
+        if (n == p) x = _eland_default_x;
+        else
+          {
+             *n = '\0';
+             x = atoi(p);
+          }
+
+        p = n + 1;
+        n = strchr(p, ':');
+        if (!n) goto inval_spec;
+        if (n == p) y = _eland_default_y;
+        else
+          {
+             *n = '\0';
+             y = atoi(p);
+          }
+
+        p = n + 1;
+        n = strchr(p, ':');
+        if (!n) goto inval_spec;
+        if (n == p) w = _eland_default_w;
+        else
+          {
+             *n = '\0';
+             w = atoi(p);
+          }
+
+        p = n + 1;
+        n = strchr(p, ':');
+        if (n)
+          {
+             if (n == p) h = _eland_default_h;
+             else
+               {
+                  *n = '\0';
+                  h = atoi(p);
+               }
+          }
+        else if (*p == '\0')
+          h = _eland_default_h;
+        else
+          h = atoi(p);
+
+        if (n) options = n + 1;
+     }
+
+   ee = ecore_evas_new(engine, x, y, w, h, options);
+   if (!ee)
+     {
+        ERR("failed ecore_evas_new(\"%s\", %d, %d, %d, %d, %s%s%s)",
+            engine, x, y, w, h,
+            options ? "\"" : "",
+            options ? options : "NULL",
+            options ? "\"" : "");
+     }
+   else
+     {
+        INF("eland created at %d,%d with %dx%d, engine=%s: %p",
+            x, y, w, h, engine, ee);
+
+        if (!ecore_evas_alpha_get(ee))
+          {
+             /* TODO: configure color or image */
+             Evas *e = ecore_evas_get(ee);
+             Evas_Object *bg = evas_object_rectangle_add(e);
+             evas_object_color_set(bg, 0, 0, 0, 255);
+             evas_object_resize(bg, w, h);
+             evas_object_layer_set(bg, EVAS_LAYER_MIN);
+             evas_object_show(bg);
+          }
+
+        ecore_evas_show(ee);
+     }
+
+   free(buf);
+
+   return ee;
+
+ inval_spec:
+   ERR("invalid eland spec '%s'. Expected 'engine:x:y:w:h:options'",
+       _elm_config->engine + 6);
+   free(buf);
+   return NULL;
+}
+
 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
 
@@ -563,7 +706,7 @@
 {
    Elm_Win *win = data;
 
-   if (win->img_obj)
+   if ((win->img_obj) && (!win->eland_win))
      {
         if ((x != win->screen.x) || (y != win->screen.y))
           {
@@ -620,7 +763,7 @@
         evas_object_geometry_get(obj, &x, &y, NULL, NULL);
         win->screen.x = x;
         win->screen.y = y;
-//        evas_object_move(win->img_obj, x, y);
+        if (win->eland_win) evas_object_move(win->img_obj, x, y);
      }
 }
 
@@ -640,6 +783,7 @@
         if (w < 1) w = 1;
         if (h < 1) h = 1;
         evas_object_image_size_set(win->img_obj, w, h);
+        if (win->eland_win) evas_object_resize(win->img_obj, w, h);
      }
 }
 
@@ -866,8 +1010,24 @@
 {
    while (_elm_win_list)
      evas_object_del(_elm_win_list->data);
+   if (_eland_ee)
+     {
+        ecore_evas_free(_eland_ee);
+        _eland_ee = NULL;
+     }
 }
 
+Eina_Bool
+_elm_win_init(void)
+{
+   if (!strncmp(_elm_config->engine, "eland", 5))
+     {
+        _eland_ee = _eland_ecore_evas_new();
+        if (!_eland_ee) return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
 void
 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
 {
@@ -1486,6 +1646,22 @@
              win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
              _shot_init(win);
           }
+        else if (!strncmp(_elm_config->engine, "eland", 5))
+          {
+             win->img_obj = ecore_evas_object_image_new(_eland_ee);
+             if (!win->img_obj) break;
+             win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
+             if (win->ee)
+               {
+                  win->eland_win = EINA_TRUE;
+                  _win_inlined_image_set(win);
+               }
+             else
+               {
+                  evas_object_del(win->img_obj);
+                  win->img_obj = NULL;
+               }
+          }
 #undef FALLBACK_TRY
         break;
      }
Index: src/lib/elm_main.c
===================================================================
--- src/lib/elm_main.c	(revision 63807)
+++ src/lib/elm_main.c	(working copy)
@@ -425,6 +425,7 @@
         ecore_imf_init();
         ecore_con_init();
         ecore_con_url_init();
+        _elm_win_init(); // FIXME: check errors
      }
    return _elm_sub_init_count;
 }
Index: src/lib/elm_priv.h
===================================================================
--- src/lib/elm_priv.h	(revision 63807)
+++ src/lib/elm_priv.h	(working copy)
@@ -167,6 +167,7 @@
    int          references;
 };
 
+Eina_Bool           _elm_win_init(void);
 void                _elm_win_shutdown(void);
 void                _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme);
 
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to