This commit is contained in:
Marcel Hollerbach 2019-08-07 17:26:41 +02:00
parent 0ffc51aee0
commit 1dde64922c
3 changed files with 41 additions and 19 deletions

View File

@ -76,7 +76,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
efl_ui_collection_position_manager_set(efl_added, list));
efl_content_set(win, item_container);
printf("Building 5000 objects\n");
printf("Building 5000 objects %d\n", getpid());
for (int i = 0; i < 5000; ++i)
{
Eo *il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, item_container);

View File

@ -184,7 +184,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,
@ -273,7 +272,10 @@ _candidacy_exam(Eo *obj)
Elm_Widget_Smart_Data *wid_pd;
wid_pd = efl_data_scope_get(wid, MY_CLASS);
do {
if (wid_pd->disabled > 0) return EINA_TRUE;
if (wid_pd->tree_unfocusable > 0) return EINA_TRUE;
/* do {
if (wid_pd->disabled) return EINA_TRUE;
if (wid_pd->tree_unfocusable) return EINA_TRUE;
@ -293,9 +295,9 @@ _candidacy_exam(Eo *obj)
}
}
} while (1);
} while (1);*/
return !efl_isa(top, EFL_UI_WIN_CLASS);
return EINA_FALSE;
}
static void _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd);
@ -1675,6 +1677,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
*
@ -1693,16 +1704,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);
}
/**
@ -2910,12 +2938,6 @@ elm_widget_focus_mouse_up_handle(Eo *obj)
}
}
static void
_elm_widget_focus_tree_unfocusable_handle(Eo *obj EINA_UNUSED)
{
//FIXME
}
/*
* @internal
*

View File

@ -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;
@ -397,7 +398,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;