summaryrefslogtreecommitdiff
path: root/src/lib/evas/include/evas_private.h
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/lib/evas/include/evas_private.h
parentc52a53c3dcecdefc1ea8c01688b032554fcc3a80 (diff)
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 '')
-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)
569#define MERR_FATAL() _evas_alloc_error = EVAS_ALLOC_ERROR_FATAL 569#define MERR_FATAL() _evas_alloc_error = EVAS_ALLOC_ERROR_FATAL
570#define MERR_BAD() _evas_alloc_error = EVAS_ALLOC_ERROR_RECOVERED 570#define MERR_BAD() _evas_alloc_error = EVAS_ALLOC_ERROR_RECOVERED
571 571
572/* DEBUG mode: fail, but normally just ERR(). This also returns if NULL. */
573#ifdef DEBUG
574#define EVAS_OBJECT_LEGACY_API(_eo, ...) \
575 do { Evas_Object_Protected_Data *_o = eo_data_scope_get(_eo, EVAS_OBJECT_CLASS); \
576 if (EINA_UNLIKELY(!_o)) return __VA_ARGS__; \
577 if (EINA_UNLIKELY(!_o->legacy)) { \
578 ERR("Calling legacy function '%s' on EO object '%s' is not permitted!", __FUNCTION__, eo_class_name_get(_o->object)); \
579 return __VA_ARGS__; \
580 } } while (0)
581#else
582#define EVAS_OBJECT_LEGACY_API(_eo, ...) \
583 do { Evas_Object_Protected_Data *_o = eo_data_scope_get(_eo, EVAS_OBJECT_CLASS); \
584 if (EINA_UNLIKELY(!_o)) return __VA_ARGS__; \
585 if (EINA_UNLIKELY(!_o->legacy)) { \
586 ERR("Calling legacy function '%s' on EO object '%s' is not permitted!", __FUNCTION__, eo_class_name_get(_o->object)); \
587 } } while (0)
588#endif
589
572#define EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur, prev) \ 590#define EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur, prev) \
573 if (cur->u.file && !cur->mmaped_source) \ 591 if (cur->u.file && !cur->mmaped_source) \
574 { \ 592 { \
@@ -1115,6 +1133,7 @@ struct _Evas_Object_Protected_Data
1115 Eina_Bool eo_del_called : 1; 1133 Eina_Bool eo_del_called : 1;
1116 Eina_Bool is_smart : 1; 1134 Eina_Bool is_smart : 1;
1117 Eina_Bool no_render : 1; // since 1.15 1135 Eina_Bool no_render : 1; // since 1.15
1136 Eina_Bool legacy : 1; // used legacy constructor
1118}; 1137};
1119 1138
1120struct _Evas_Data_Node 1139struct _Evas_Data_Node