diff options
author | WooHyun Jung <wh0705.jung@samsung.com> | 2020-06-12 16:57:45 +0900 |
---|---|---|
committer | WooHyun Jung <wh0705.jung@samsung.com> | 2020-06-12 16:57:45 +0900 |
commit | f362e8a93e551033a4ef7bbdfb9cd56b63e6651e (patch) | |
tree | 2c6104e20dad6a4f859cc3ff758ad30596896cbc /src/lib | |
parent | 94ca2d40d08be58168bf05183ffbbe4dcd05bd5d (diff) |
efl_ui_win: reuse bg which was created for version check
Summary: This is just for not creating bg object twice.
Reviewers: bu5hm4n, zmike, YOhoho
Reviewed By: YOhoho
Subscribers: YOhoho, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11936
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/elementary/efl_ui_win.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index ab248dc772..ab84ac590e 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c | |||
@@ -7596,29 +7596,28 @@ _elm_win_bg_set(Efl_Ui_Win_Data *sd, Eo *bg) | |||
7596 | 7596 | ||
7597 | /* Legacy theme compatibility */ | 7597 | /* Legacy theme compatibility */ |
7598 | static Eina_Bool | 7598 | static Eina_Bool |
7599 | _elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd) | 7599 | _elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd, Eo **bg) |
7600 | { | 7600 | { |
7601 | if (EINA_UNLIKELY(!sd->legacy.bg_must_swallow_init)) | 7601 | if (EINA_UNLIKELY(!sd->legacy.bg_must_swallow_init)) |
7602 | { | 7602 | { |
7603 | /* Overkill: check which theme version the standard elm_bg uses */ | 7603 | /* Overkill: check which theme version the standard elm_bg uses */ |
7604 | Elm_Widget_Smart_Data *wd; | 7604 | Elm_Widget_Smart_Data *wd; |
7605 | const char *version; | 7605 | const char *version; |
7606 | Eo *bg; | ||
7607 | int v; | 7606 | int v; |
7608 | 7607 | ||
7609 | sd->legacy.bg_must_swallow = 1; | 7608 | sd->legacy.bg_must_swallow = 1; |
7610 | sd->legacy.bg_must_swallow_init = 1; | 7609 | sd->legacy.bg_must_swallow_init = 1; |
7611 | 7610 | ||
7612 | if (sd->legacy.ctor) | 7611 | if (sd->legacy.ctor) |
7613 | bg = elm_bg_add(sd->obj); | 7612 | *bg = elm_bg_add(sd->obj); |
7614 | else | 7613 | else |
7615 | { | 7614 | { |
7616 | // Note: This code path is probably not necessary (custom legacy | 7615 | // Note: This code path is probably not necessary (custom legacy |
7617 | // theme but efl_add'ed window -- all efl_add'ed widgets would | 7616 | // theme but efl_add'ed window -- all efl_add'ed widgets would |
7618 | // use default theme) | 7617 | // use default theme) |
7619 | bg = efl_add(EFL_UI_BG_CLASS, sd->obj); | 7618 | *bg = efl_add(EFL_UI_BG_CLASS, sd->obj); |
7620 | } | 7619 | } |
7621 | wd = efl_data_scope_get(bg, EFL_UI_WIDGET_CLASS); | 7620 | wd = efl_data_scope_get(*bg, EFL_UI_WIDGET_CLASS); |
7622 | if (wd) | 7621 | if (wd) |
7623 | { | 7622 | { |
7624 | version = edje_object_data_get(wd->resize_obj, "version"); | 7623 | version = edje_object_data_get(wd->resize_obj, "version"); |
@@ -7626,7 +7625,6 @@ _elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd) | |||
7626 | if (v >= FRAME_OBJ_THEME_MIN_VERSION) | 7625 | if (v >= FRAME_OBJ_THEME_MIN_VERSION) |
7627 | sd->legacy.bg_must_swallow = 0; | 7626 | sd->legacy.bg_must_swallow = 0; |
7628 | } | 7627 | } |
7629 | evas_object_del(bg); | ||
7630 | } | 7628 | } |
7631 | 7629 | ||
7632 | return sd->legacy.bg_must_swallow; | 7630 | return sd->legacy.bg_must_swallow; |
@@ -7637,29 +7635,33 @@ _elm_win_standard_init(Eo *obj) | |||
7637 | { | 7635 | { |
7638 | /* Support for elm_util_win_standard_add() and Efl.Ui.Win.Standard */ | 7636 | /* Support for elm_util_win_standard_add() and Efl.Ui.Win.Standard */ |
7639 | Efl_Ui_Win_Data *sd = efl_data_scope_get(obj, MY_CLASS); | 7637 | Efl_Ui_Win_Data *sd = efl_data_scope_get(obj, MY_CLASS); |
7638 | Eo *bg = NULL; | ||
7640 | 7639 | ||
7641 | ELM_SAFE_DEL(sd->bg); | 7640 | ELM_SAFE_DEL(sd->bg); |
7642 | 7641 | ||
7643 | sd->csd.need_bg_standard = 1; | 7642 | sd->csd.need_bg_standard = 1; |
7644 | if (!_elm_win_bg_must_swallow(sd)) | 7643 | if (!_elm_win_bg_must_swallow(sd, &bg)) |
7645 | { | 7644 | { |
7646 | sd->csd.need_bg_solid = EINA_TRUE; | 7645 | sd->csd.need_bg_solid = EINA_TRUE; |
7646 | evas_object_del(bg); | ||
7647 | } | 7647 | } |
7648 | else | 7648 | else |
7649 | { | 7649 | { |
7650 | Eo *bg; | ||
7651 | |||
7652 | /* Legacy theme compatibility */ | 7650 | /* Legacy theme compatibility */ |
7653 | DBG("Detected legacy theme used for elm_bg. Swallowing object."); | 7651 | DBG("Detected legacy theme used for elm_bg. Swallowing object."); |
7654 | sd->csd.need_bg_solid = EINA_FALSE; | 7652 | sd->csd.need_bg_solid = EINA_FALSE; |
7655 | if (sd->legacy.ctor) | 7653 | |
7656 | bg = elm_bg_add(obj); | 7654 | if (!bg) |
7657 | else | ||
7658 | { | 7655 | { |
7659 | // Note: This code path is probably not necessary (custom legacy | 7656 | if (sd->legacy.ctor) |
7660 | // theme but efl_add'ed window -- all efl_add'ed widgets would | 7657 | bg = elm_bg_add(obj); |
7661 | // use default theme) | 7658 | else |
7662 | bg = efl_add(EFL_UI_BG_CLASS, obj); | 7659 | { |
7660 | // Note: This code path is probably not necessary (custom legacy | ||
7661 | // theme but efl_add'ed window -- all efl_add'ed widgets would | ||
7662 | // use default theme) | ||
7663 | bg = efl_add(EFL_UI_BG_CLASS, obj); | ||
7664 | } | ||
7663 | } | 7665 | } |
7664 | _elm_win_bg_set(sd, bg); | 7666 | _elm_win_bg_set(sd, bg); |
7665 | } | 7667 | } |