etrunko pushed a commit to branch master.

commit 19561c611250352df5bc571e0ec2fa88972e4bdd
Author: Eduardo Lima (Etrunko) <[email protected]>
Date:   Tue Mar 26 15:48:41 2013 -0300

    Ecore_Wayland: Add ecore_wl_window_surface_create() API
    
    On some use cases, it is necessary to create a new wl_surface without
    associating it to a wl_shell_surface. This new API makes it possible.
    
    Signed-off-by: Eduardo Lima (Etrunko) <[email protected]>
---
 src/lib/ecore_wayland/Ecore_Wayland.h   | 10 ++++++++++
 src/lib/ecore_wayland/ecore_wl_window.c | 15 ++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h 
b/src/lib/ecore_wayland/Ecore_Wayland.h
index a610c14..250429e 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -635,6 +635,16 @@ EAPI Ecore_Wl_Dnd *ecore_wl_dnd_get();
 EAPI Eina_Bool ecore_wl_dnd_start_drag();
 EAPI Eina_Bool ecore_wl_dnd_selection_has_owner(Ecore_Wl_Dnd *dnd);
 
+/**
+ * Returns a wl_surface with no association to any wl_shell_surface.
+ *
+ * @param win The window which will use this newly created surface.
+ *
+ * @ingroup Ecore_Wl_Window_Group
+ * @since 1.8
+ */
+EAPI struct wl_surface *ecore_wl_window_surface_create(Ecore_Wl_Window *win);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c 
b/src/lib/ecore_wayland/ecore_wl_window.c
index 19bf9c5..b9474b3 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -265,6 +265,17 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct 
wl_buffer *buffer, in
      }
 }
 
+EAPI struct wl_surface*
+ecore_wl_window_surface_create(Ecore_Wl_Window *win)
+{
+   if (!win) return NULL;
+   if (win->surface) return NULL;
+
+   win->surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
+   wl_surface_set_user_data(win->surface, win);
+   return win->surface;
+}
+
 EAPI void 
 ecore_wl_window_show(Ecore_Wl_Window *win)
 {
@@ -273,9 +284,7 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
    if (!win) return;
    if (win->surface) return;
 
-   win->surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
-   wl_surface_set_user_data(win->surface, win);
-   /* wl_surface_add_listener(win->surface, &_ecore_wl_surface_listener, win); 
*/
+   ecore_wl_window_surface_create(win);
 
    win->shell_surface = 
      wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, win->surface);

-- 

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d

Reply via email to