summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-08-17 15:10:59 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-08-18 14:27:32 -0500
commit51768ff62bad8ff6de6f941943d953a516e86f8e (patch)
tree0b269563fa1937ee518567b988375e71052f8359
parent90a032587a73545265a5790e3e72f0712e741978 (diff)
downloadefl-51768ff62bad8ff6de6f941943d953a516e86f8e.tar.gz
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.
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h18
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h2
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c12
3 files changed, 32 insertions, 0 deletions
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;
+}