ecore_evas: add a hook interceptor for evas_new, will be useful for a portable Exactness.

This commit is contained in:
Cedric Bail 2018-04-02 15:11:44 -07:00
parent a44697c37a
commit 1ca196fbcd
2 changed files with 25 additions and 2 deletions

View File

@ -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
@ -3184,6 +3184,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

View File

@ -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;