From aabe29abc13e84e5cb449a2ddce79a2c880c90e8 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 11 Mar 2019 21:57:45 +0100 Subject: [PATCH] Revert "ui.widget: fix theme_apply working in sub_object_add" This only works with a new libcheck, but not with a old one, revisiting it. This reverts commit da0ff534716774b35a98c359e8c7fd7bdde7a3d2. --- src/lib/elementary/efl_ui_widget.c | 30 ++++++++++----------- src/tests/elementary/efl_ui_test_widget.c | 32 ----------------------- 2 files changed, 15 insertions(+), 47 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index ca2b975954..acab4f32f5 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -1377,6 +1377,7 @@ elm_widget_sub_object_parent_add(Evas_Object *sobj) EOLIAN static void _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widget *parent) { + Eina_Bool mirrored, pmirrored = efl_ui_mirrored_get(obj); Efl_Ui_Widget *old_parent; //check if we are in the subobject list of parents if (parent) @@ -1385,33 +1386,32 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg EINA_SAFETY_ON_FALSE_RETURN(eina_list_data_find(ppd->subobjs, obj)); } - /* NOTE: In the following two lines, 'obj' is correct. Do not change it. - * Due to elementary's scale policy, scale and prev_scale can be different in - * some cases. This happens when obj's previous parent and new parent have - * different scale value. - * For example, if obj's previous parent's scale is 5 and new parent's scale - * is 2 while obj's scale is 0. Then 'prev_pscale' is 5 and 'scale' is 2. So - * we need to reset obj's scale to 5. - * Note that each widget's scale is 1.0 by default. - */ - double scale, prev_scale = efl_gfx_entity_scale_get(obj); - Elm_Theme *th, *prev_th = elm_widget_theme_get(obj); - Eina_Bool mirrored, pmirrored = efl_ui_mirrored_get(parent); - old_parent = pd->parent_obj; pd->parent_obj = parent; // now lets sync up all states + if (pd->parent_obj) { + /* NOTE: In the following two lines, 'sobj' is correct. Do not change it. + * Due to elementary's scale policy, scale and pscale can be different in + * some cases. This happens when sobj's previous parent and new parent have + * different scale value. + * For example, if sobj's previous parent's scale is 5 and new parent's scale + * is 2 while sobj's scale is 0. Then 'pscale' is 5 and 'scale' is 2. So we + * need to reset sobj's scale to 5. + * Note that each widget's scale is 0 by default. + */ + double scale, pscale = efl_gfx_entity_scale_get(obj); + Elm_Theme *th, *pth = elm_widget_theme_get(obj); + scale = efl_gfx_entity_scale_get(obj); th = elm_widget_theme_get(obj); mirrored = efl_ui_mirrored_get(obj); if (!pd->on_create) { - if ((scale != prev_scale) || (th != prev_th) || - (pmirrored != mirrored)) + if ((scale != pscale) || (th != pth) || (pmirrored != mirrored)) elm_widget_theme(obj); } if (_is_focused(obj)) _parents_focus(parent); diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c index 221978bade..d5f9c4d525 100644 --- a/src/tests/elementary/efl_ui_test_widget.c +++ b/src/tests/elementary/efl_ui_test_widget.c @@ -188,37 +188,6 @@ EFL_START_TEST(efl_ui_test_widget_sub_object_add_del) } EFL_END_TEST -EFL_START_TEST(efl_ui_test_widget_sub_object_theme_sync) -{ - State s; - Efl_Canvas_Layout *edje; - - _small_ui(&s); - edje = elm_widget_resize_object_get(s.btn1); - - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn1), 1.0); - ck_assert_double_eq(efl_gfx_entity_scale_get(edje), 1.0); - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn2), 1.0); - - efl_gfx_entity_scale_set(s.win, 0.123); - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn1), 0.123); - ck_assert_double_eq(efl_gfx_entity_scale_get(edje), 0.123); - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn2), 0.123); - - efl_ui_widget_sub_object_del(s.box, s.btn1); - efl_gfx_entity_scale_set(s.win, 0.456); - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn1), 1.0); - ck_assert_double_eq(efl_gfx_entity_scale_get(edje), 0.123); - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn2), 0.456); - - efl_gfx_entity_scale_set(s.win, 0.789); - efl_ui_widget_sub_object_add(s.box, s.btn1); - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn1), 0.789); - ck_assert_double_eq(efl_gfx_entity_scale_get(edje), 0.789); - ck_assert_double_eq(efl_gfx_entity_scale_get(s.btn2), 0.789); -} -EFL_END_TEST - void efl_ui_test_widget(TCase *tc) { tcase_add_test(tc, efl_ui_test_widget_parent_iterator); @@ -227,5 +196,4 @@ void efl_ui_test_widget(TCase *tc) tcase_add_test(tc, efl_ui_test_widget_iterator); tcase_add_test(tc, efl_ui_test_widget_sub_iterator); tcase_add_test(tc, efl_ui_test_widget_sub_object_add_del); - tcase_add_test(tc, efl_ui_test_widget_sub_object_theme_sync); }