summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-03-14 19:36:45 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-03-15 11:11:59 +0900
commit0fc0db0020fd9dc8bc155f8e46ad79cecb84cc2f (patch)
tree9070c1885b9f129e70b1654a729c79a4995a4ddc /src
parentc52a53c3dcecdefc1ea8c01688b032554fcc3a80 (diff)
downloadefl-0fc0db0020fd9dc8bc155f8e46ad79cecb84cc2f.tar.gz
Evas: Add internal macro EVAS_OBJECT_LEGACY_API
This checks whether the object was created with a legacy API, ie without not using eo_add directly. This will be used to help with the transition from EAPI to EO APIs, as some EAPIs should not be used with the new EO types (eg. file_set on a Proxy object). By default it doesn't do anything besides ERR(). In DEBUG mode, it will return immediately. The macro will return if eo_obj is NULL.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/include/evas_private.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 4e60fa4800..759327f5d6 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -569,6 +569,24 @@ MAGIC_CHECK_FAILED(o, t, m)
#define MERR_FATAL() _evas_alloc_error = EVAS_ALLOC_ERROR_FATAL
#define MERR_BAD() _evas_alloc_error = EVAS_ALLOC_ERROR_RECOVERED
+/* DEBUG mode: fail, but normally just ERR(). This also returns if NULL. */
+#ifdef DEBUG
+#define EVAS_OBJECT_LEGACY_API(_eo, ...) \
+ do { Evas_Object_Protected_Data *_o = eo_data_scope_get(_eo, EVAS_OBJECT_CLASS); \
+ if (EINA_UNLIKELY(!_o)) return __VA_ARGS__; \
+ if (EINA_UNLIKELY(!_o->legacy)) { \
+ ERR("Calling legacy function '%s' on EO object '%s' is not permitted!", __FUNCTION__, eo_class_name_get(_o->object)); \
+ return __VA_ARGS__; \
+ } } while (0)
+#else
+#define EVAS_OBJECT_LEGACY_API(_eo, ...) \
+ do { Evas_Object_Protected_Data *_o = eo_data_scope_get(_eo, EVAS_OBJECT_CLASS); \
+ if (EINA_UNLIKELY(!_o)) return __VA_ARGS__; \
+ if (EINA_UNLIKELY(!_o->legacy)) { \
+ ERR("Calling legacy function '%s' on EO object '%s' is not permitted!", __FUNCTION__, eo_class_name_get(_o->object)); \
+ } } while (0)
+#endif
+
#define EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur, prev) \
if (cur->u.file && !cur->mmaped_source) \
{ \
@@ -1115,6 +1133,7 @@ struct _Evas_Object_Protected_Data
Eina_Bool eo_del_called : 1;
Eina_Bool is_smart : 1;
Eina_Bool no_render : 1; // since 1.15
+ Eina_Bool legacy : 1; // used legacy constructor
};
struct _Evas_Data_Node