cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1ca196fbcd5aea30cf1d97190c7525262e9e4664

commit 1ca196fbcd5aea30cf1d97190c7525262e9e4664
Author: Cedric Bail <[email protected]>
Date:   Mon Apr 2 15:11:44 2018 -0700

    ecore_evas: add a hook interceptor for evas_new, will be useful for a 
portable Exactness.
---
 src/lib/ecore_evas/Ecore_Evas.h | 16 +++++++++++++++-
 src/lib/ecore_evas/ecore_evas.c | 11 ++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 1039007b71..e6cc85f5a6 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -2093,7 +2093,7 @@ EAPI void       *ecore_evas_data_get(const Ecore_Evas 
*ee, const char *key);
  */
 EAPI void        ecore_evas_data_set(Ecore_Evas *ee, const char *key, const 
void *data);
 
-/**
+  /**
  * @brief Sets a callback for Ecore_Evas resize events.
  *
  * @param ee The Ecore_Evas to set callbacks on
@@ -3185,6 +3185,20 @@ EAPI Evas_Object *ecore_evas_vnc_start(Ecore_Evas *ee, 
const char *addr, int por
 #endif
 
 /**
+ * @brief Sets a callback for building new Evas.
+ *
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+ *
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever a new Ecore_Evas is created.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
+EAPI void        ecore_evas_callback_new_set(Evas *(*func)(int w, int h));
+
+/**
  * @defgroup Ecore_Evas_Ews Ecore_Evas Single Process Windowing System.
  * @ingroup Ecore_Evas_Group
  *
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 9a9fbac69c..50eb36dfb9 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -5085,6 +5085,14 @@ ecore_evas_callback_device_mouse_in_set(Ecore_Evas *ee,
    ee->func.fn_device_mouse_in = func;
 }
 
+static Evas *(*replacement_new)(int w, int h) = NULL;
+
+EAPI void
+ecore_evas_callback_new_set(Evas *(*func)(int w, int h))
+{
+   replacement_new = func;
+}
+
 EAPI Evas *
 ecore_evas_evas_new(Ecore_Evas *ee, int w, int h)
 {
@@ -5092,7 +5100,8 @@ ecore_evas_evas_new(Ecore_Evas *ee, int w, int h)
 
    if (ee->evas) return ee->evas;
 
-   e = evas_new();
+   if (replacement_new) e = replacement_new(w, h);
+   else e = evas_new();
    if (!e) return NULL;
 
    ee->evas = e;

-- 


Reply via email to