antognolli pushed a commit to branch master.

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

commit 1c33a1a57b964d9080909c3e9e93f109d11c674f
Author: Rafael Antognolli <rafael.antogno...@intel.com>
Date:   Fri Nov 1 11:38:05 2013 -0200

    ecore/wayland: Add title_set and class_name_set APIs.
    
    These two APIs will save the title and class_name inside
    Ecore_Wl_Window, so if they are called before the shell surface is
    created, the stored names will be used later when the window is finally
    shown (shell surface is created).
    
    This way we are also hiding the shell surface from ecore_evas modules.
---
 src/lib/ecore_wayland/Ecore_Wayland.h              |  6 ++++
 src/lib/ecore_wayland/ecore_wl_window.c            | 34 ++++++++++++++++++++++
 .../engines/wayland/ecore_evas_wayland_common.c    | 10 +++----
 .../engines/wayland/ecore_evas_wayland_egl.c       |  7 -----
 .../engines/wayland/ecore_evas_wayland_shm.c       |  7 -----
 5 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h 
b/src/lib/ecore_wayland/Ecore_Wayland.h
index 424e3db..387c9f2 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -127,6 +127,9 @@ struct _Ecore_Wl_Window
    int id, surface_id;
    int rotation;
 
+   const char *title;
+   const char *class_name;
+
    Eina_Rectangle allocation;
 
    struct 
@@ -627,7 +630,10 @@ EAPI void 
ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char
 EAPI void ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win);
 EAPI void ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window 
*parent);
 
+
 EAPI int ecore_wl_window_id_get(Ecore_Wl_Window *win);
+EAPI void ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title);
+EAPI void ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char 
*class_name);
 
 /**
  * Returns a wl_surface with no association to any wl_shell_surface.
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c 
b/src/lib/ecore_wayland/ecore_wl_window.c
index 4c40a62..8059f44 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -86,6 +86,9 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, 
int w, int h, int buf
    win->opaque.w = w;
    win->opaque.h = h;
 
+   win->title = NULL;
+   win->class_name = NULL;
+
    eina_hash_add(_windows, _ecore_wl_window_id_str_get(win->id), win);
    return win;
 }
@@ -121,6 +124,9 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
    if (win->surface) wl_surface_destroy(win->surface);
    win->surface = NULL;
 
+   if (win->title) eina_stringshare_del(win->title);
+   if (win->class_name) eina_stringshare_del(win->class_name);
+
    /* HMMM, why was this disabled ? */
    free(win);
 }
@@ -258,6 +264,8 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
              win->shell_surface = 
                wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, 
                                           win->surface);
+             wl_shell_surface_set_title(win->shell_surface, win->title);
+             wl_shell_surface_set_class(win->shell_surface, win->class_name);
           }
 
         if (win->shell_surface)
@@ -679,6 +687,32 @@ ecore_wl_window_id_get(Ecore_Wl_Window *win)
    return win->id;
 }
 
+/* @since 1.8 */
+EAPI void
+ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title)
+{
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!win) return;
+   eina_stringshare_replace(&win->title, title);
+
+   if (win->shell_surface)
+     wl_shell_surface_set_title(win->shell_surface, win->title);
+}
+
+/* @since 1.8 */
+EAPI void
+ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name)
+{
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!win) return;
+   eina_stringshare_replace(&win->class_name, class_name);
+
+   if (win->shell_surface)
+     wl_shell_surface_set_class(win->shell_surface, win->class_name);
+}
+
 
 /* local functions */
 static void 
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 4a1628e..705d588 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -920,9 +920,8 @@ _ecore_evas_wl_common_title_set(Ecore_Evas *ee, const char 
*title)
           evas_object_text_text_set(sd->text, ee->prop.title);
      }
 
-   if ((ee->prop.title) && (wdata->win->shell_surface))
-     wl_shell_surface_set_title(wdata->win->shell_surface,
-                                ee->prop.title);
+   if (ee->prop.title)
+     ecore_wl_window_title_set(wdata->win, ee->prop.title);
 }
 
 void
@@ -941,9 +940,8 @@ _ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const 
char *n, const char *
    if (n) ee->prop.name = strdup(n);
    if (c) ee->prop.clas = strdup(c);
 
-   if ((ee->prop.clas) && (wdata->win->shell_surface))
-     wl_shell_surface_set_class(wdata->win->shell_surface,
-                                ee->prop.clas);
+   if (ee->prop.clas)
+     ecore_wl_window_class_name_set(wdata->win, ee->prop.clas);
 }
 
 void
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index e0bb743..4e32009 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -389,13 +389,6 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
         /*      einfo->info.surface = ecore_wl_window_surface_get(wdata->win); 
*/
         /*      evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
         /*   } */
-
-        if ((ee->prop.clas) && (wdata->win->shell_surface))
-          wl_shell_surface_set_class(wdata->win->shell_surface, 
-                                     ee->prop.clas);
-        if ((ee->prop.title) && (wdata->win->shell_surface))
-          wl_shell_surface_set_title(wdata->win->shell_surface, 
-                                     ee->prop.title);
      }
 
    if (wdata->frame)
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index 5542173..2e3a352 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -388,13 +388,6 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
                   evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
                }
           }
-
-        if ((ee->prop.clas) && (wdata->win->shell_surface))
-          wl_shell_surface_set_class(wdata->win->shell_surface, 
-                                     ee->prop.clas);
-        if ((ee->prop.title) && (wdata->win->shell_surface))
-          wl_shell_surface_set_title(wdata->win->shell_surface, 
-                                     ee->prop.title);
      }
 
    if (wdata->frame)

-- 


Reply via email to