forked from enlightenment/efl
Compare commits
2 Commits
master
...
devs/bu5hm
Author | SHA1 | Date |
---|---|---|
Marcel Hollerbach | f5ac9a3e6c | |
Marcel Hollerbach | 2677b9d480 |
|
@ -1748,7 +1748,9 @@ elm_widget_tree_unfocusable_set(Eo *obj, Eina_Bool tree_unfocusable)
|
||||||
Efl_Ui_Widget *subs;
|
Efl_Ui_Widget *subs;
|
||||||
Elm_Widget_Smart_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
|
Elm_Widget_Smart_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(pd);
|
EINA_SAFETY_ON_NULL_RETURN(pd);
|
||||||
int distance, parent_counter = (pd->parent_obj ? _tree_unfocusable_counter_get(pd->parent_obj) : 0);
|
int old_tree_unfocusable, distance, parent_counter = (pd->parent_obj ? _tree_unfocusable_counter_get(pd->parent_obj) : 0);
|
||||||
|
|
||||||
|
old_tree_unfocusable = pd->tree_unfocusable;
|
||||||
|
|
||||||
if (tree_unfocusable)
|
if (tree_unfocusable)
|
||||||
pd->tree_unfocusable ++;
|
pd->tree_unfocusable ++;
|
||||||
|
@ -1762,15 +1764,18 @@ elm_widget_tree_unfocusable_set(Eo *obj, Eina_Bool tree_unfocusable)
|
||||||
distance = MAX(MIN(tree_unfocusable, 1), 0);
|
distance = MAX(MIN(tree_unfocusable, 1), 0);
|
||||||
pd->tree_unfocusable = parent_counter + distance;
|
pd->tree_unfocusable = parent_counter + distance;
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
if (old_tree_unfocusable != pd->tree_unfocusable)
|
||||||
{
|
{
|
||||||
subs = eina_array_data_get(pd->children, i);
|
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||||
if (efl_isa(subs, EFL_UI_WIDGET_CLASS))
|
{
|
||||||
elm_widget_tree_unfocusable_set(subs, elm_widget_tree_unfocusable_get(obj));
|
subs = eina_array_data_get(pd->children, i);
|
||||||
}
|
if (efl_isa(subs, EFL_UI_WIDGET_CLASS))
|
||||||
|
elm_widget_tree_unfocusable_set(subs, elm_widget_tree_unfocusable_get(obj));
|
||||||
|
}
|
||||||
|
|
||||||
//focus state eval on all children
|
//focus state eval on all children
|
||||||
_elm_widget_full_eval_children(obj, pd);
|
_elm_widget_full_eval_children(obj, pd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2106,7 +2111,9 @@ EOLIAN static void
|
||||||
_efl_ui_widget_disabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool disabled)
|
_efl_ui_widget_disabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool disabled)
|
||||||
{
|
{
|
||||||
Efl_Ui_Widget *subs;
|
Efl_Ui_Widget *subs;
|
||||||
int distance, parent_counter = (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0);
|
int old_state, distance, parent_counter = (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0);
|
||||||
|
|
||||||
|
old_state = pd->disabled;
|
||||||
|
|
||||||
if (disabled)
|
if (disabled)
|
||||||
pd->disabled ++;
|
pd->disabled ++;
|
||||||
|
@ -2120,15 +2127,17 @@ _efl_ui_widget_disabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina
|
||||||
distance = MAX(MIN(disabled, 1), 0);
|
distance = MAX(MIN(disabled, 1), 0);
|
||||||
pd->disabled = parent_counter + distance;
|
pd->disabled = parent_counter + distance;
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
if (old_state != pd->disabled)
|
||||||
{
|
{
|
||||||
subs = eina_array_data_get(pd->children, i);
|
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||||
if (efl_isa(subs, EFL_UI_WIDGET_CLASS))
|
{
|
||||||
efl_ui_widget_disabled_set(subs, efl_ui_widget_disabled_get(obj));
|
subs = eina_array_data_get(pd->children, i);
|
||||||
|
if (efl_isa(subs, EFL_UI_WIDGET_CLASS))
|
||||||
|
efl_ui_widget_disabled_set(subs, efl_ui_widget_disabled_get(obj));
|
||||||
|
}
|
||||||
|
if (efl_finalized_get(obj))
|
||||||
|
_elm_widget_full_eval_children(obj, pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (efl_finalized_get(obj))
|
|
||||||
_elm_widget_full_eval_children(obj, pd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
|
|
|
@ -332,6 +332,76 @@ EFL_START_TEST(efl_ui_test_widget_win_provider_find)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
#define CHECK_UNFOCUSABLE_STATE(x) \
|
||||||
|
ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.box), x); \
|
||||||
|
ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.win), x); \
|
||||||
|
ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.ic), x); \
|
||||||
|
ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.btn1), x); \
|
||||||
|
ck_assert_int_eq(elm_widget_tree_unfocusable_get(s.btn2), x)
|
||||||
|
|
||||||
|
|
||||||
|
EFL_START_TEST(efl_ui_test_widget_tree_unfocusable)
|
||||||
|
{
|
||||||
|
State s;
|
||||||
|
|
||||||
|
_small_ui(&s);
|
||||||
|
CHECK_UNFOCUSABLE_STATE(0);
|
||||||
|
|
||||||
|
elm_widget_tree_unfocusable_set(s.win, EINA_TRUE);
|
||||||
|
CHECK_UNFOCUSABLE_STATE(1);
|
||||||
|
|
||||||
|
elm_widget_tree_unfocusable_set(s.win, EINA_FALSE);
|
||||||
|
CHECK_UNFOCUSABLE_STATE(0);
|
||||||
|
|
||||||
|
elm_widget_tree_unfocusable_set(s.win, EINA_TRUE);
|
||||||
|
CHECK_UNFOCUSABLE_STATE(1);
|
||||||
|
|
||||||
|
elm_widget_tree_unfocusable_set(s.win, EINA_TRUE);
|
||||||
|
CHECK_UNFOCUSABLE_STATE(1);
|
||||||
|
|
||||||
|
elm_widget_tree_unfocusable_set(s.win, EINA_FALSE);
|
||||||
|
CHECK_UNFOCUSABLE_STATE(0);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
|
#define CHECK_DISABLED_STATE(x) \
|
||||||
|
ck_assert_int_eq(efl_ui_widget_disabled_get(s.box), x); \
|
||||||
|
ck_assert_int_eq(efl_ui_widget_disabled_get(s.win), x); \
|
||||||
|
ck_assert_int_eq(efl_ui_widget_disabled_get(s.ic), x); \
|
||||||
|
ck_assert_int_eq(efl_ui_widget_disabled_get(s.btn1), x); \
|
||||||
|
ck_assert_int_eq(efl_ui_widget_disabled_get(s.btn2), x)
|
||||||
|
|
||||||
|
|
||||||
|
EFL_START_TEST(efl_ui_test_widget_disabled_repeat_call)
|
||||||
|
{
|
||||||
|
State s;
|
||||||
|
|
||||||
|
_small_ui(&s);
|
||||||
|
printf("ASD\n");
|
||||||
|
CHECK_DISABLED_STATE(0);
|
||||||
|
|
||||||
|
printf("ASD\n");
|
||||||
|
efl_ui_widget_disabled_set(s.win, EINA_TRUE);
|
||||||
|
CHECK_DISABLED_STATE(1);
|
||||||
|
|
||||||
|
printf("ASD\n");
|
||||||
|
efl_ui_widget_disabled_set(s.win, EINA_FALSE);
|
||||||
|
CHECK_DISABLED_STATE(0);
|
||||||
|
|
||||||
|
printf("ASD\n");
|
||||||
|
efl_ui_widget_disabled_set(s.win, EINA_TRUE);
|
||||||
|
CHECK_DISABLED_STATE(1);
|
||||||
|
|
||||||
|
printf("ASD\n");
|
||||||
|
efl_ui_widget_disabled_set(s.win, EINA_TRUE);
|
||||||
|
CHECK_DISABLED_STATE(1);
|
||||||
|
|
||||||
|
printf("ASD\n");
|
||||||
|
efl_ui_widget_disabled_set(s.win, EINA_FALSE);
|
||||||
|
CHECK_DISABLED_STATE(0);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
void efl_ui_test_widget(TCase *tc)
|
void efl_ui_test_widget(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
|
tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
|
||||||
|
@ -346,4 +416,6 @@ void efl_ui_test_widget(TCase *tc)
|
||||||
tcase_add_test(tc, efl_ui_test_widget_disabled_parent);
|
tcase_add_test(tc, efl_ui_test_widget_disabled_parent);
|
||||||
tcase_add_test(tc, efl_ui_test_widget_disabled_behaviour);
|
tcase_add_test(tc, efl_ui_test_widget_disabled_behaviour);
|
||||||
tcase_add_test(tc, efl_ui_test_widget_win_provider_find);
|
tcase_add_test(tc, efl_ui_test_widget_win_provider_find);
|
||||||
|
tcase_add_test(tc, efl_ui_test_widget_tree_unfocusable);
|
||||||
|
tcase_add_test(tc, efl_ui_test_widget_disabled_repeat_call);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue