hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=95852ba5040467c0382d94670fd6d113041e2745

commit 95852ba5040467c0382d94670fd6d113041e2745
Author: Hermet Park <[email protected]>
Date:   Tue Jun 19 12:42:09 2018 +0900

    Revert "elementary: fix wrong signal emission"
    
    This reverts commit 1b245787fe1fc5da41b6ed77dd67cb022900afa6.
    
    This is a workaround patch, even occurs a regression bug that
    breaks widget signal emission logic. (Happened in Enventor toolbar)
    
    I reviewed this code seriously and found out
    ui_layout sub object unset logic has been changed.
    Obviously that breaks the elm compatibility.
    
    When sub-object of layout is removed, it tries to remove sub-object from
    the layout internal list. Problem is, some widgets sends internal signals
    when sub-object is removed(i.e "icon,hidden") , but layout returns the
    valid object even though sub-object unset is called prior to signal,
    means, "icon,visible" not "icon,hidden" emitted.
    
    This logic obvisouly changed from the previous efl version.
    And we need to fix that logic first.
    
    See _efl_ui_button_legacy_efl_ui_widget_widget_sub_object_del()
    to check this issue.
    
    1. button: sub_object_del()
    2. layout: sub_object_del() => sub object must be removed.
    3. button: signal emit() => for updating states
    4. layout: content_get() => returns valid object?????! (Issue)
---
 src/lib/elementary/efl_ui_button.c      | 12 ++++++------
 src/lib/elementary/efl_ui_check.c       | 12 ++++++------
 src/lib/elementary/efl_ui_progressbar.c | 12 ++++++------
 src/lib/elementary/efl_ui_radio.c       | 12 ++++++------
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/lib/elementary/efl_ui_button.c 
b/src/lib/elementary/efl_ui_button.c
index a84ba81dad..7081d8c915 100644
--- a/src/lib/elementary/efl_ui_button.c
+++ b/src/lib/elementary/efl_ui_button.c
@@ -425,12 +425,13 @@ _efl_ui_button_legacy_efl_object_constructor(Eo *obj, 
void *_pd EINA_UNUSED)
  * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
  * can changed the theme API */
 static void
-_icon_signal_emit(Evas_Object *obj, Eina_Bool vis)
+_icon_signal_emit(Evas_Object *obj)
 {
    char buf[64];
 
    if (!elm_widget_resize_object_get(obj)) return;
-   snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden");
+   snprintf(buf, sizeof(buf), "elm,state,icon,%s",
+            elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
 
    elm_layout_signal_emit(obj, buf, "elm");
    edje_object_message_signal_process(elm_layout_edje_get(obj));
@@ -447,7 +448,7 @@ _efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, 
void *_pd EINA_UNUSED)
 
    int_ret = efl_ui_widget_theme_apply(efl_super(obj, 
EFL_UI_BUTTON_LEGACY_CLASS));
    if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
-   _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon"));
+   _icon_signal_emit(obj);
 
    return int_ret;
 }
@@ -463,7 +464,7 @@ 
_efl_ui_button_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EIN
    int_ret = elm_widget_sub_object_del(efl_super(obj, 
EFL_UI_BUTTON_LEGACY_CLASS), sobj);
    if (!int_ret) return EINA_FALSE;
 
-   _icon_signal_emit(obj, EINA_FALSE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }
@@ -479,8 +480,7 @@ _efl_ui_button_legacy_content_set(Eo *obj, void *_pd 
EINA_UNUSED, const char *pa
    int_ret = efl_content_set(efl_part(efl_super(obj, 
EFL_UI_BUTTON_LEGACY_CLASS), part), content);
    if (!int_ret) return EINA_FALSE;
 
-   if (content)
-     _icon_signal_emit(obj, EINA_TRUE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }
diff --git a/src/lib/elementary/efl_ui_check.c 
b/src/lib/elementary/efl_ui_check.c
index bf536bf93c..bf6e8c2aa8 100644
--- a/src/lib/elementary/efl_ui_check.c
+++ b/src/lib/elementary/efl_ui_check.c
@@ -479,13 +479,14 @@ _efl_ui_check_legacy_efl_object_constructor(Eo *obj, void 
*pd EINA_UNUSED)
  * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
  * can changed the theme API */
 static void
-_icon_signal_emit(Evas_Object *obj, Eina_Bool vis)
+_icon_signal_emit(Evas_Object *obj)
 {
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
    char buf[64];
 
    if (!elm_widget_resize_object_get(obj)) return;
-   snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden");
+   snprintf(buf, sizeof(buf), "elm,state,icon,%s",
+            elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
 
    elm_layout_signal_emit(obj, buf, "elm");
    edje_object_message_signal_process(wd->resize_obj);
@@ -504,7 +505,7 @@ _efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, 
void *_pd EINA_UNUSED)
    int_ret = efl_ui_widget_theme_apply(efl_super(obj, 
EFL_UI_CHECK_LEGACY_CLASS));
    if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
 
-   _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon"));
+   _icon_signal_emit(obj);
 
    return int_ret;
 }
@@ -520,7 +521,7 @@ _efl_ui_check_legacy_efl_ui_widget_widget_sub_object_del(Eo 
*obj, void *_pd EINA
    int_ret = elm_widget_sub_object_del(efl_super(obj, 
EFL_UI_CHECK_LEGACY_CLASS), sobj);
    if (!int_ret) return EINA_FALSE;
 
-   _icon_signal_emit(obj, EINA_FALSE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }
@@ -536,8 +537,7 @@ _efl_ui_check_legacy_content_set(Eo *obj, void *_pd 
EINA_UNUSED, const char *par
    int_ret = efl_content_set(efl_part(efl_super(obj, 
EFL_UI_CHECK_LEGACY_CLASS), part), content);
    if (!int_ret) return EINA_FALSE;
 
-   if (content)
-     _icon_signal_emit(obj, EINA_TRUE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }
diff --git a/src/lib/elementary/efl_ui_progressbar.c 
b/src/lib/elementary/efl_ui_progressbar.c
index a1a220c53a..c1a3f1a998 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -800,12 +800,13 @@ _efl_ui_progressbar_legacy_efl_object_constructor(Eo 
*obj, void *pd EINA_UNUSED)
  * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
  * can changed the theme API */
 static void
-_icon_signal_emit(Evas_Object *obj, Eina_Bool vis)
+_icon_signal_emit(Evas_Object *obj)
 {
    char buf[64];
 
    if (!elm_widget_resize_object_get(obj)) return;
-   snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden");
+   snprintf(buf, sizeof(buf), "elm,state,icon,%s",
+            elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
 
    elm_layout_signal_emit(obj, buf, "elm");
    edje_object_message_signal_process(elm_layout_edje_get(obj));
@@ -822,7 +823,7 @@ _efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo 
*obj, void *_pd EINA_UNU
 
    int_ret = efl_ui_widget_theme_apply(efl_super(obj, 
EFL_UI_PROGRESSBAR_LEGACY_CLASS));
    if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
-   _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon"));
+   _icon_signal_emit(obj);
 
    return int_ret;
 }
@@ -838,7 +839,7 @@ 
_efl_ui_progressbar_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_p
    int_ret = elm_widget_sub_object_del(efl_super(obj, 
EFL_UI_PROGRESSBAR_LEGACY_CLASS), sobj);
    if (!int_ret) return EINA_FALSE;
 
-   _icon_signal_emit(obj, EINA_FALSE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }
@@ -854,8 +855,7 @@ _efl_ui_progressbar_legacy_content_set(Eo *obj, void *_pd 
EINA_UNUSED, const cha
    int_ret = efl_content_set(efl_part(efl_super(obj, 
EFL_UI_PROGRESSBAR_LEGACY_CLASS), part), content);
    if (!int_ret) return EINA_FALSE;
 
-   if (content)
-     _icon_signal_emit(obj, EINA_TRUE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }
diff --git a/src/lib/elementary/efl_ui_radio.c 
b/src/lib/elementary/efl_ui_radio.c
index fbd7f25ce9..16ef832d1e 100644
--- a/src/lib/elementary/efl_ui_radio.c
+++ b/src/lib/elementary/efl_ui_radio.c
@@ -398,14 +398,15 @@ _efl_ui_radio_legacy_efl_object_constructor(Eo *obj, void 
*_pd EINA_UNUSED)
  * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
  * can changed the theme API */
 static void
-_icon_signal_emit(Evas_Object *obj, Eina_Bool vis)
+_icon_signal_emit(Evas_Object *obj)
 {
    char buf[63];
    Eo *edje;
 
    edje = elm_widget_resize_object_get(obj);
    if (!edje) return;
-   snprintf(buf, sizeof(buf), "elm,state,icon,%s", vis ? "visible" : "hidden");
+   snprintf(buf, sizeof(buf), "elm,state,icon,%s",
+            elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
 
    elm_layout_signal_emit(obj, buf, "elm");
    edje_object_message_signal_process(edje);
@@ -422,7 +423,7 @@ _efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, 
void *_pd EINA_UNUSED)
    /* FIXME: replicated from elm_layout just because radio's icon
     * spot is elm.swallow.content, not elm.swallow.icon. Fix that
     * whenever we can changed the theme API */
-   _icon_signal_emit(obj, !!elm_layout_content_get(obj, "icon"));
+   _icon_signal_emit(obj);
 
    return int_ret;
 }
@@ -438,7 +439,7 @@ _efl_ui_radio_legacy_efl_ui_widget_widget_sub_object_del(Eo 
*obj, void *_pd EINA
    int_ret = elm_widget_sub_object_del(efl_super(obj, 
EFL_UI_RADIO_LEGACY_CLASS), sobj);
    if (!int_ret) return EINA_FALSE;
 
-   _icon_signal_emit(obj, EINA_FALSE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }
@@ -454,8 +455,7 @@ _efl_ui_radio_legacy_content_set(Eo *obj, void *_pd 
EINA_UNUSED, const char *par
    int_ret = efl_content_set(efl_part(efl_super(obj, 
EFL_UI_RADIO_LEGACY_CLASS), part), content);
    if (!int_ret) return EINA_FALSE;
 
-   if (content)
-     _icon_signal_emit(obj, EINA_TRUE);
+   _icon_signal_emit(obj);
 
    return EINA_TRUE;
 }

-- 


Reply via email to