Ecore_Wayland: Add ecore_wl_window_surface_create() API 43/8243/1
authorEduardo Lima (Etrunko) <eduardo.lima@intel.com>
Tue, 26 Mar 2013 18:48:41 +0000 (15:48 -0300)
committerEduardo Lima (Etrunko) <eduardo.lima@intel.com>
Tue, 13 Aug 2013 20:56:43 +0000 (17:56 -0300)
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) <eduardo.lima@intel.com>
src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl_window.c

index a62d55f..d14869b 100644 (file)
@@ -431,6 +431,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
index 4187f0f..9bc29a6 100644 (file)
@@ -289,6 +289,17 @@ ecore_wl_window_commit(Ecore_Wl_Window *win)
      wl_surface_commit(win->surface);
 }
 
+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_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y)
 {
@@ -363,9 +374,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);
 
    if (win->type != ECORE_WL_WINDOW_TYPE_NONE)
      {