From: seoz Date: Wed, 19 Oct 2011 17:07:15 +0000 (+0000) Subject: elm widget.c: Code refactorying. Check sobj first. We do not need to check sobj twice. X-Git-Tag: REL_F_I9500_20120323_1~17^2~1585 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=903af0e08d39d223dcda7e61f5191bbaa5505a0f;p=framework%2Fuifw%2Felementary.git elm widget.c: Code refactorying. Check sobj first. We do not need to check sobj twice. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64182 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index f6e0cd2..d63a717 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -1010,55 +1010,53 @@ elm_widget_resize_object_set(Evas_Object *obj, if (elm_widget_focus_get(sd->resize_obj)) _unfocus_parents(obj); } } + + if (!sobj) return; + // orphan new resize obj - if (sobj) + evas_object_data_del(sobj, "elm-parent"); + if (_elm_widget_is(sobj)) { - evas_object_data_del(sobj, "elm-parent"); - if (_elm_widget_is(sobj)) - { - Smart_Data *sd2 = evas_object_smart_data_get(sobj); - if (sd2) sd2->parent_obj = NULL; - evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE, - _sub_obj_hide, sd); - } - evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, - _sub_obj_del, sd); - evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP, - _sub_obj_mouse_up, sd); - evas_object_smart_member_del(sobj); - if (_elm_widget_is(sobj)) - { - if (elm_widget_focus_get(sobj)) _unfocus_parents(obj); - } + Smart_Data *sd2 = evas_object_smart_data_get(sobj); + if (sd2) sd2->parent_obj = NULL; + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE, + _sub_obj_hide, sd); + } + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP, + _sub_obj_mouse_up, sd); + evas_object_smart_member_del(sobj); + if (_elm_widget_is(sobj)) + { + if (elm_widget_focus_get(sobj)) _unfocus_parents(obj); } + // set the resize obj up sd->resize_obj = sobj; - if (sd->resize_obj) + if (_elm_widget_is(sd->resize_obj)) { - if (_elm_widget_is(sd->resize_obj)) - { - Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj); - if (sd2) - { - sd2->parent_obj = obj; - sd2->top_win_focused = sd->top_win_focused; - } - evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE, - _sub_obj_hide, sd); - } - evas_object_clip_set(sobj, evas_object_clip_get(obj)); - evas_object_smart_member_add(sobj, obj); - evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, - _sub_obj_del, sd); - evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP, - _sub_obj_mouse_up, sd); - _smart_reconfigure(sd); - evas_object_data_set(sobj, "elm-parent", obj); - evas_object_smart_callback_call(obj, "sub-object-add", sobj); - if (_elm_widget_is(sobj)) + Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj); + if (sd2) { - if (elm_widget_focus_get(sobj)) _focus_parents(obj); + sd2->parent_obj = obj; + sd2->top_win_focused = sd->top_win_focused; } + evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE, + _sub_obj_hide, sd); + } + evas_object_clip_set(sobj, evas_object_clip_get(obj)); + evas_object_smart_member_add(sobj, obj); + evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, + _sub_obj_del, sd); + evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP, + _sub_obj_mouse_up, sd); + _smart_reconfigure(sd); + evas_object_data_set(sobj, "elm-parent", obj); + evas_object_smart_callback_call(obj, "sub-object-add", sobj); + if (_elm_widget_is(sobj)) + { + if (elm_widget_focus_get(sobj)) _focus_parents(obj); } }