summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermet@hermet.pe.kr>2016-08-02 22:38:30 +0900
committerHermet Park <hermet@hermet.pe.kr>2016-08-02 22:49:33 +0900
commitea2b5e40485a49b5c5aadae98ed379f1c3cf5f71 (patch)
tree2f363f6c2892ee38a1f478444eaa5be8f9f0d506
parent7a70d415411cf9da302f7b1aa678913c42d18ee7 (diff)
elementary widget: fix a wrong disabled behavior.
This is a corner case bug I spontaneously found. * Scenario. A. Disable A widget. B. Add a child B widget to A. C. Now B Widget theme will be followed to A that is performed by elm_widget_theme_apply() D. This elm_widget_theme_apply() calls elm_widget_disabled_set() (originally.) E. Now B widget will be logically disabled. D. Let's enable A widget again. E. After going through widget disabled sequence, elm_widget_disabled_eval() will be called in the last F. In this function, A widget tries to enable its children. But B widget won't be enabled because its logically disabled! Acutally, nowhere widget change children's disabled states logically, but it propagates its state to children within volatile way so that A widget perfectly keeps the disabled/enabled state with its children and recover the children's enable/disable state once their relationship is cut off. @fix
-rw-r--r--src/lib/elementary/elm_widget.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c
index d347bdcc27..fe56a87ab4 100644
--- a/src/lib/elementary/elm_widget.c
+++ b/src/lib/elementary/elm_widget.c
@@ -100,6 +100,8 @@ _elm_scrollable_is(const Evas_Object *obj)
100} 100}
101 101
102static void 102static void
103elm_widget_disabled_internal(Eo *obj, Eina_Bool disabled);
104static void
103_on_sub_obj_del(void *data, const Eo_Event *event); 105_on_sub_obj_del(void *data, const Eo_Event *event);
104static void 106static void
105_on_sub_obj_hide(void *data, const Eo_Event *event); 107_on_sub_obj_hide(void *data, const Eo_Event *event);
@@ -1020,8 +1022,7 @@ EOLIAN static Elm_Theme_Apply
1020_elm_widget_theme_apply(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED) 1022_elm_widget_theme_apply(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
1021{ 1023{
1022 _elm_widget_mirrored_reload(obj); 1024 _elm_widget_mirrored_reload(obj);
1023 1025 elm_widget_disabled_internal(obj, elm_widget_disabled_get(obj));
1024 elm_widget_disabled_set(obj, elm_widget_disabled_get(obj));
1025 1026
1026 return ELM_THEME_APPLY_SUCCESS; 1027 return ELM_THEME_APPLY_SUCCESS;
1027} 1028}
@@ -3122,12 +3123,10 @@ _elm_widget_disabled_eval(const Evas_Object *obj, Eina_Bool disabled)
3122 } 3123 }
3123} 3124}
3124 3125
3125EOLIAN static void 3126static void
3126_elm_widget_disabled_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool disabled) 3127elm_widget_disabled_internal(Eo *obj, Eina_Bool disabled)
3127{ 3128{
3128 Eina_Bool parent_state = EINA_FALSE; 3129 Eina_Bool parent_state = EINA_FALSE;
3129 if (sd->disabled == disabled) return;
3130 sd->disabled = !!disabled;
3131 3130
3132 if (disabled) 3131 if (disabled)
3133 { 3132 {
@@ -3145,6 +3144,15 @@ _elm_widget_disabled_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool disabled)
3145 } 3144 }
3146} 3145}
3147 3146
3147EOLIAN static void
3148_elm_widget_disabled_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool disabled)
3149{
3150 if (sd->disabled == disabled) return;
3151 sd->disabled = !!disabled;
3152
3153 elm_widget_disabled_internal(obj, disabled);
3154}
3155
3148EOLIAN static Eina_Bool 3156EOLIAN static Eina_Bool
3149_elm_widget_disabled_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) 3157_elm_widget_disabled_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
3150{ 3158{