summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2019-04-24 20:33:20 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2019-04-24 20:33:21 +0900
commit8c0ab0db425588d6e42a21ee28d8e9d96c32a272 (patch)
treea62f4c34ebe43f9eaa617d191390583dc3f9046a /src/lib
parent9b87eaee0884f55899a05d271b098b8b3e11c221 (diff)
ui.relative_layout: enhance relation_xxx_set,get apis
Summary: I forgot `efl_pack_layout_request` after relation_xxx is changed. Unnecessary register function in `relation_xxx_get` will return unexpected result. if a object is not child of relative_layout, `relation_xxx_get` should return `target = NULL` and `relative = 0.0` with error message. Test Plan: make check Reviewers: Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8627
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_relative_layout_private.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/elementary/efl_ui_relative_layout_private.h b/src/lib/elementary/efl_ui_relative_layout_private.h
index c58f7b0ecc..e0f2abfee0 100644
--- a/src/lib/elementary/efl_ui_relative_layout_private.h
+++ b/src/lib/elementary/efl_ui_relative_layout_private.h
@@ -70,23 +70,35 @@ struct _Efl_Ui_Relative_Layout_Child
70 70
71#define EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(direction, DIRECTION) \ 71#define EFL_UI_RELATIVE_LAYOUT_RELATION_SET_GET(direction, DIRECTION) \
72 EOLIAN static void \ 72 EOLIAN static void \
73 _efl_ui_relative_layout_relation_ ## direction ## _set(Eo *obj EINA_UNUSED, Efl_Ui_Relative_Layout_Data *pd, Eo *child, Eo *target, double relative) \ 73 _efl_ui_relative_layout_relation_ ## direction ## _set(Eo *obj, Efl_Ui_Relative_Layout_Data *pd, Eo *child, Eo *target, double relative) \
74 { \ 74 { \
75 Efl_Ui_Relative_Layout_Child *rc; \ 75 Efl_Ui_Relative_Layout_Child *rc; \
76 if (!child) return; \
76 rc = _relative_child_get(pd, child); \ 77 rc = _relative_child_get(pd, child); \
78 if (!rc) return; \
77 if (target) rc->rel[DIRECTION].to = target; \ 79 if (target) rc->rel[DIRECTION].to = target; \
78 if (relative < 0) relative = 0; \ 80 if (relative < 0) relative = 0; \
79 else if (relative > 1) relative = 1; \ 81 else if (relative > 1) relative = 1; \
80 rc->rel[DIRECTION].relative = relative; \ 82 rc->rel[DIRECTION].relative = relative; \
83 efl_pack_layout_request(obj); \
81 } \ 84 } \
82 \ 85 \
83 EOLIAN static void \ 86 EOLIAN static void \
84 _efl_ui_relative_layout_relation_ ## direction ## _get(const Eo *obj EINA_UNUSED, Efl_Ui_Relative_Layout_Data *pd, Eo *child, Eo **target, double *relative) \ 87 _efl_ui_relative_layout_relation_ ## direction ## _get(const Eo *obj EINA_UNUSED, Efl_Ui_Relative_Layout_Data *pd, Eo *child, Eo **target, double *relative) \
85 { \ 88 { \
86 Efl_Ui_Relative_Layout_Child *rc; \ 89 Efl_Ui_Relative_Layout_Child *rc; \
87 rc = _relative_child_get(pd, child); \ 90 Eo *rel_to = NULL; \
88 if (target) *target = rc->rel[DIRECTION].to; \ 91 double rel_relative = 0.0; \
89 if (relative) *relative = rc->rel[DIRECTION].relative; \ 92 rc = eina_hash_find(pd->children, &child); \
93 if (rc) \
94 { \
95 rel_to = rc->rel[DIRECTION].to; \
96 rel_relative = rc->rel[DIRECTION].relative; \
97 } \
98 else \
99 ERR("child(%p(%s)) is not registered", child, efl_class_name_get(child)); \
100 if (target) *target = rel_to; \
101 if (relative) *relative = rel_relative; \
90 } 102 }
91 103
92#endif 104#endif