hermet pushed a commit to branch elementary-1.13. http://git.enlightenment.org/core/elementary.git/commit/?id=ee2c2def5dcb370a993d3d79c84feda0dc468a20
commit ee2c2def5dcb370a993d3d79c84feda0dc468a20 Author: Jee-Yong Um <con...@gmail.com> Date: Tue Mar 10 16:21:16 2015 +0900 elc_popup: Adjust popup size when its parent is resized Summary: When parent is resized, popup keeps its original size. This patch makes popup have proper size in proportion to parent's size. T2082 Test Plan: You can check the effect of this patch in "elementary_test popup". Reviewers: seoz, Hermet Subscribers: stefan_schmidt, J5lx, seoz Differential Revision: https://phab.enlightenment.org/D2121 --- src/lib/elc_popup.c | 17 ++++++++++++++++- src/lib/elm_widget_popup.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c index 9c54473..0fccc60 100644 --- a/src/lib/elc_popup.c +++ b/src/lib/elc_popup.c @@ -43,6 +43,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { }; static Eina_Bool _key_action_move(Evas_Object *obj, const char *params); +static void _parent_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED); static const Elm_Action key_actions[] = { {"move", _key_action_move}, @@ -194,6 +195,7 @@ _elm_popup_evas_object_smart_del(Eo *obj, Elm_Popup_Data *sd) { unsigned int i; + evas_object_event_callback_del_full(sd->parent, EVAS_CALLBACK_RESIZE, _parent_resize_cb, obj); evas_object_smart_callback_del (sd->notify, "block,clicked", _block_clicked_cb); @@ -1441,8 +1443,18 @@ _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv) edje_object_message_signal_process(elm_layout_edje_get(priv->main_layout)); } +static void +_parent_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Evas_Coord w, h; + Evas_Object *popup = data; + + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + evas_object_resize(popup, w, h); +} + EOLIAN static void -_elm_popup_elm_widget_parent_set(Eo *obj, Elm_Popup_Data *sd EINA_UNUSED, Evas_Object *parent) +_elm_popup_elm_widget_parent_set(Eo *obj, Elm_Popup_Data *sd, Evas_Object *parent) { Evas_Coord x, y, w, h; evas_object_geometry_get(parent, &x, &y, &w, &h); @@ -1454,6 +1466,9 @@ _elm_popup_elm_widget_parent_set(Eo *obj, Elm_Popup_Data *sd EINA_UNUSED, Evas_O } evas_object_move(obj, x, y); evas_object_resize(obj, w, h); + + sd->parent = parent; + evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, _parent_resize_cb, obj); } EOLIAN static void diff --git a/src/lib/elm_widget_popup.h b/src/lib/elm_widget_popup.h index 04c044d..6ffee43 100644 --- a/src/lib/elm_widget_popup.h +++ b/src/lib/elm_widget_popup.h @@ -42,6 +42,7 @@ struct _Elm_Popup_Data Evas_Object *spacer; Evas_Object *scr; Evas_Object *content; + Evas_Object *parent; /**< Pointer to remove _parent_resize_cb when popup is deleted. */ Eina_List *items; const char *title_text; Action_Area_Data *buttons[ELM_POPUP_ACTION_BUTTON_MAX]; --