diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index d4e272b339..5913fd6430 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -188,7 +188,6 @@ _elm_scrollable_is(const Evas_Object *obj) static void _on_sub_obj_del(void *data, const Efl_Event *event); static void _propagate_event(void *data, const Efl_Event *eo_event); -static void _elm_widget_focus_tree_unfocusable_handle(Eo *obj); static void _elm_widget_shadow_update(Efl_Ui_Widget *obj); EFL_CALLBACKS_ARRAY_DEFINE(elm_widget_subitems_callbacks, @@ -1708,6 +1707,15 @@ elm_widget_child_can_focus_get(const Eo *obj) return sd->logical.child_count > 0; } + +static int +_tree_unfocusable_counter_get(Eo *widget) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(widget, pd, -1); + + return pd->tree_unfocusable; +} + /** * @internal * @@ -1726,16 +1734,33 @@ elm_widget_child_can_focus_get(const Eo *obj) EAPI void elm_widget_tree_unfocusable_set(Eo *obj, Eina_Bool tree_unfocusable) { - Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); - if (!sd) return; + Efl_Ui_Widget *subs; + Eina_List *n; + Elm_Widget_Smart_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS); + if (!pd) return; + int distance, parent_counter = (pd->parent_obj ? _tree_unfocusable_counter_get(pd->parent_obj) : 0); - tree_unfocusable = !!tree_unfocusable; - if (sd->tree_unfocusable == tree_unfocusable) return; - sd->tree_unfocusable = tree_unfocusable; - _elm_widget_focus_tree_unfocusable_handle(obj); + if (tree_unfocusable) + pd->tree_unfocusable ++; + else + pd->tree_unfocusable --; + + distance = pd->disabled - parent_counter; + + if ((distance < 0) || (distance > 1)) + { + distance = MAX(MIN(tree_unfocusable, 1), 0); + pd->disabled = parent_counter + distance; + } + + EINA_LIST_FOREACH(pd->subobjs, n, subs) + { + if (efl_isa(subs, EFL_UI_WIDGET_CLASS)) + efl_ui_widget_disabled_set(subs, elm_widget_tree_unfocusable_get(obj)); + } //focus state eval on all children - _elm_widget_full_eval_children(obj, sd); + _elm_widget_full_eval_children(obj, pd); } /** @@ -2943,12 +2968,6 @@ elm_widget_focus_mouse_up_handle(Eo *obj) } } -static void -_elm_widget_focus_tree_unfocusable_handle(Eo *obj EINA_UNUSED) -{ - //FIXME -} - /* * @internal * diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 5ca84752e8..f8311f6e0e 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -355,6 +355,7 @@ typedef struct _Elm_Widget_Smart_Data int child_drag_x_locked; int child_drag_y_locked; int disabled; + int tree_unfocusable; Eina_Inlist *translate_strings; Eina_List *focus_chain; @@ -398,7 +399,6 @@ typedef struct _Elm_Widget_Smart_Data Eina_Bool can_focus : 1; Eina_Bool focused : 1; Eina_Bool top_win_focused : 1; - Eina_Bool tree_unfocusable : 1; Eina_Bool focus_move_policy_auto_mode : 1; /* This is TRUE by default */ Eina_Bool highlight_ignore : 1; Eina_Bool highlight_in_theme : 1;