summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c10
-rw-r--r--src/lib/elementary/efl_ui_focus_object.c2
-rw-r--r--src/tests/elementary/elm_test_focus.c31
-rw-r--r--src/tests/elementary/elm_test_focus_common.c21
-rw-r--r--src/tests/elementary/focus_test.eo12
5 files changed, 75 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index ce08129..851feeb 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -77,6 +77,13 @@ typedef struct {
77 Node *root; 77 Node *root;
78} Efl_Ui_Focus_Manager_Calc_Data; 78} Efl_Ui_Focus_Manager_Calc_Data;
79 79
80static void
81_manager_in_chain_set(Efl_Ui_Focus_Manager_Calc_Data *pd)
82{
83 EINA_SAFETY_ON_NULL_RETURN(pd->root);
84 efl_ui_focus_manager_focus_set(efl_ui_focus_user_manager_get(pd->root->focusable), pd->root->focusable);
85}
86
80static Efl_Ui_Focus_Direction 87static Efl_Ui_Focus_Direction
81_complement(Efl_Ui_Focus_Direction dir) 88_complement(Efl_Ui_Focus_Direction dir)
82{ 89{
@@ -1346,6 +1353,9 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
1346 1353
1347 F_DBG("Manager: %p focusing object %p %s", obj, node->focusable, efl_class_name_get(node->focusable)); 1354 F_DBG("Manager: %p focusing object %p %s", obj, node->focusable, efl_class_name_get(node->focusable));
1348 1355
1356 //make sure this manager is in the chain of redirects
1357 _manager_in_chain_set(pd);
1358
1349 if (eina_list_last_data_get(pd->focus_stack) == node) 1359 if (eina_list_last_data_get(pd->focus_stack) == node)
1350 { 1360 {
1351 //the correct one is focused 1361 //the correct one is focused
diff --git a/src/lib/elementary/efl_ui_focus_object.c b/src/lib/elementary/efl_ui_focus_object.c
index 4579b9f..990837f 100644
--- a/src/lib/elementary/efl_ui_focus_object.c
+++ b/src/lib/elementary/efl_ui_focus_object.c
@@ -2,6 +2,8 @@
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4 4
5#define EFL_UI_FOCUS_OBJECT_PROTECTED
6
5#include <Elementary.h> 7#include <Elementary.h>
6#include "elm_priv.h" 8#include "elm_priv.h"
7 9
diff --git a/src/tests/elementary/elm_test_focus.c b/src/tests/elementary/elm_test_focus.c
index c4e0836..e7b4676 100644
--- a/src/tests/elementary/elm_test_focus.c
+++ b/src/tests/elementary/elm_test_focus.c
@@ -366,6 +366,36 @@ START_TEST(logical_shift)
366} 366}
367END_TEST 367END_TEST
368 368
369START_TEST(root_redirect_chain)
370{
371 Efl_Ui_Focus_Manager *m, *m2;
372
373 elm_init(1, NULL);
374
375 TEST_OBJ_NEW(root, 0, 20, 20, 20);
376 TEST_OBJ_NEW(root2, 0, 20, 20, 20);
377 TEST_OBJ_NEW(child, 0, 20, 20, 20);
378
379 m = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL,
380 efl_ui_focus_manager_root_set(efl_added, root)
381 );
382
383 focus_test_manager_set(root2, m);
384
385 m2 = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL,
386 efl_ui_focus_manager_root_set(efl_added, root2)
387 );
388
389 efl_ui_focus_manager_calc_register(m, root2, root, m2);
390 efl_ui_focus_manager_calc_register(m2, child, root2, NULL);
391 efl_ui_focus_manager_focus_set(m2, child);
392
393 ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2);
394
395 elm_shutdown();
396}
397END_TEST
398
369void elm_test_focus(TCase *tc) 399void elm_test_focus(TCase *tc)
370{ 400{
371 tcase_add_test(tc, focus_register_twice); 401 tcase_add_test(tc, focus_register_twice);
@@ -379,4 +409,5 @@ void elm_test_focus(TCase *tc)
379 tcase_add_test(tc, invalid_args_check); 409 tcase_add_test(tc, invalid_args_check);
380 tcase_add_test(tc, order_check); 410 tcase_add_test(tc, order_check);
381 tcase_add_test(tc, logical_shift); 411 tcase_add_test(tc, logical_shift);
412 tcase_add_test(tc, root_redirect_chain);
382} 413}
diff --git a/src/tests/elementary/elm_test_focus_common.c b/src/tests/elementary/elm_test_focus_common.c
index 896d86d..3ac6397 100644
--- a/src/tests/elementary/elm_test_focus_common.c
+++ b/src/tests/elementary/elm_test_focus_common.c
@@ -1,3 +1,5 @@
1#define EFL_UI_FOCUS_OBJECT_PROTECTED
2
1#include "elm_test_focus_common.h" 3#include "elm_test_focus_common.h"
2 4
3#define Q(o,_x,_y,_w,_h) \ 5#define Q(o,_x,_y,_w,_h) \
@@ -60,6 +62,7 @@ elm_focus_test_manager_new(Efl_Ui_Focus_Object **middle)
60typedef struct { 62typedef struct {
61 Eina_Rect rect; 63 Eina_Rect rect;
62 Eina_Bool focus; 64 Eina_Bool focus;
65 Eo *manager;
63} Focus_Test_Data; 66} Focus_Test_Data;
64 67
65EOLIAN static Efl_Object* 68EOLIAN static Efl_Object*
@@ -97,5 +100,23 @@ _focus_test_efl_gfx_geometry_get(Eo *obj EINA_UNUSED, Focus_Test_Data *pd)
97 return pd->rect; 100 return pd->rect;
98} 101}
99 102
103EOLIAN static Efl_Ui_Focus_Manager*
104_focus_test_efl_ui_focus_user_manager_get(Eo *obj EINA_UNUSED, Focus_Test_Data *pd)
105{
106 return pd->manager;
107}
108
109EOLIAN static Efl_Ui_Focus_Object*
110_focus_test_efl_ui_focus_user_parent_get(Eo *obj, Focus_Test_Data *pd EINA_UNUSED)
111{
112 return efl_parent_get(obj);
113}
114
115EOLIAN static void
116_focus_test_manager_set(Eo *obj EINA_UNUSED, Focus_Test_Data *pd, Efl_Ui_Focus_Manager *manager)
117{
118 pd->manager = manager;
119}
120
100 121
101#include "focus_test.eo.c" 122#include "focus_test.eo.c"
diff --git a/src/tests/elementary/focus_test.eo b/src/tests/elementary/focus_test.eo
index 5227241..93ce998 100644
--- a/src/tests/elementary/focus_test.eo
+++ b/src/tests/elementary/focus_test.eo
@@ -1,15 +1,25 @@
1class Focus.Test(Efl.Object, Efl.Ui.Focus.Object, Efl.Gfx) { 1class Focus.Test(Efl.Object, Efl.Ui.Focus.Object, Efl.Ui.Focus.User, Efl.Gfx) {
2 methods { 2 methods {
3 size { 3 size {
4 params { 4 params {
5 rect : Eina.Rect; 5 rect : Eina.Rect;
6 } 6 }
7 } 7 }
8 @property manager {
9 set {
10
11 }
12 values {
13 manager : Efl.Ui.Focus.Manager;
14 }
15 }
8 } 16 }
9 implements { 17 implements {
10 Efl.Object.constructor; 18 Efl.Object.constructor;
11 Efl.Ui.Focus.Object.focus_geometry { get; } 19 Efl.Ui.Focus.Object.focus_geometry { get; }
12 Efl.Ui.Focus.Object.focus { set; } 20 Efl.Ui.Focus.Object.focus { set; }
21 Efl.Ui.Focus.User.manager { get; }
22 Efl.Ui.Focus.User.parent {get; }
13 Efl.Gfx.geometry { get; } 23 Efl.Gfx.geometry { get; }
14 } 24 }
15} 25}