jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=8002cabf359d1a7537e04b0bf4c333fd0e574419

commit 8002cabf359d1a7537e04b0bf4c333fd0e574419
Author: Daniel Zaoui <[email protected]>
Date:   Thu Jan 8 11:47:31 2015 +0200

    Ecore: add EAPI to retrieve Ecore_Evas parent of a buffer.
---
 src/lib/ecore_evas/Ecore_Evas.h        | 14 ++++++++++++++
 src/lib/ecore_evas/ecore_evas_buffer.c | 11 +++++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index f2f5dc4..118bce1 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -1272,6 +1272,20 @@ EAPI Ecore_Evas     *ecore_evas_buffer_allocfunc_new(int 
w, int h, void *(*alloc
 EAPI const void     *ecore_evas_buffer_pixels_get(Ecore_Evas *ee);
 
 /**
+ * @brief Return a pointer to the Ecore_Evas parent of the given Ecore_Evas.
+ *
+ * @param ee An @c Ecore_Evas handle
+ * @return A pointer to the Ecore_Evas parent.
+ *
+ * A use case for the function is to determine if the buffer is used inside
+ * X11 or Wayland. Since the buffer engine doesn't give any indication on
+ * it, we need to retrieve information from the Ecore_Evas parents.
+ *
+ * @since 1.13
+ */
+EAPI Ecore_Evas *ecore_evas_buffer_ecore_evas_parent_get(Ecore_Evas *ee);
+
+/**
  * @brief Create a new @c Ecore_Evas canvas bound to the Evas
  * @b ews (Ecore + Evas Single Process Windowing System) engine
  *
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c 
b/src/lib/ecore_evas/ecore_evas_buffer.c
index 01b33a0..fa7bab2 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -741,6 +741,17 @@ ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
    return bdata->pixels;
 }
 
+EAPI Ecore_Evas *
+ecore_evas_buffer_ecore_evas_parent_get(Ecore_Evas *ee)
+{
+   Ecore_Evas_Engine_Buffer_Data *bdata;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ee, NULL);
+
+   bdata = ee->engine.data;
+   return evas_object_data_get(bdata->image, "Ecore_Evas_Parent");
+}
+
 EAPI Evas_Object *
 ecore_evas_object_image_new(Ecore_Evas *ee_target)
 {

-- 


Reply via email to