derekf pushed a commit to branch master.

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

commit 51768ff62bad8ff6de6f941943d953a516e86f8e
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Thu Aug 17 15:10:59 2017 -0500

    ecore_wl2: Add ecore_wl2_window_buffer_attach API
    
    Let ecore_wl2 track some buffer related state so we can more easily sync
    things between ecore_evas and the evas_engines.
---
 src/lib/ecore_wl2/Ecore_Wl2.h         | 18 ++++++++++++++++++
 src/lib/ecore_wl2/ecore_wl2_private.h |  2 ++
 src/lib/ecore_wl2/ecore_wl2_window.c  | 12 ++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 21b623e24a..e09c42e9ce 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -1925,6 +1925,24 @@ EAPI Ecore_Wl2_Frame_Cb_Handle 
*ecore_wl2_window_frame_callback_add(Ecore_Wl2_Wi
  */
 EAPI void ecore_wl2_window_frame_callback_del(Ecore_Wl2_Frame_Cb_Handle 
*handle);
 
+/**
+ * Attach a buffer to a window
+ *
+ * Note that the GL stack my attach buffers to a surface - we should call this
+ * function at that time (with a NULL buffer) to track whether a surface
+ * has a valid buffer.  That is, call with implicit true and buffer NULL at
+ * the time of glSwapBuffers.
+ *
+ * @window the target window
+ * @buffer the buffer to attach
+ * @x x offset from corner
+ * @y y offset from corner
+ * @implicit true if an external library is doing the actual attaching
+ *
+ * @since 1.20
+ */
+EAPI void ecore_wl2_window_buffer_attach(Ecore_Wl2_Window *win, struct 
wl_buffer *buffer, int x, int y, Eina_Bool implicit);
+
 # endif
 
 # undef EAPI
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index 240e9062ad..85661ecba3 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -162,6 +162,7 @@ struct _Ecore_Wl2_Window
    const char *role;
 
    struct wl_surface *surface;
+   struct wl_buffer *buffer;
    struct wl_callback *callback;
    struct www_surface *www_surface;
    struct zxdg_surface_v6 *zxdg_surface;
@@ -225,6 +226,7 @@ struct _Ecore_Wl2_Window
         int *available_rots;
         unsigned int count;
      } wm_rot;
+   Eina_Bool has_buffer : 1;
 };
 
 struct _Ecore_Wl2_Output
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c 
b/src/lib/ecore_wl2/ecore_wl2_window.c
index c6d0ed4709..b0be628334 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -1417,3 +1417,15 @@ EAPI void 
ecore_wl2_window_frame_callback_del(Ecore_Wl2_Frame_Cb_Handle *handle)
    handle->win->frame_callbacks = 
eina_list_remove(handle->win->frame_callbacks, handle);
    free(handle);
 }
+
+EAPI void ecore_wl2_window_buffer_attach(Ecore_Wl2_Window *win, struct 
wl_buffer *buffer, int x, int y, Eina_Bool implicit)
+{
+   EINA_SAFETY_ON_NULL_RETURN(win);
+   EINA_SAFETY_ON_NULL_RETURN(win->surface);
+
+   /* FIXME: Haven't given any thought to x and y since we always use 0... */
+   if (!implicit) wl_surface_attach(win->surface, buffer, x, y);
+   win->buffer = buffer;
+   if (!implicit && !buffer) win->has_buffer = EINA_FALSE;
+   else win->has_buffer = EINA_TRUE;
+}

-- 


Reply via email to