summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2017-12-10 21:03:17 +0100
committerMarcel Hollerbach <marcel@osg.samsung.com>2017-12-11 10:46:52 +0100
commitc3a4fc7d64ccdbfa5285059054c94e7b442c4ac2 (patch)
tree3b95a3b2491da7407677c0200fab483bb9c0233c /src
parent101cc785134bbfaf102b8bccfb2c7f6ccc2aa313 (diff)
downloadefl-c3a4fc7d64ccdbfa5285059054c94e7b442c4ac2.tar.gz
efl_ui_focus_manager_calc: performe the second stage later
the second stage is not meant to be a transition in both ways, only because the one item is closer does not mean a other one is closer.
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c71
1 files changed, 36 insertions, 35 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index 8e0490c7b5..8f771da669 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -305,13 +305,18 @@ _min_max_gen(Dimension dim, Eina_Rect rect, int *min, int *max)
}
static inline void
-_calculate_node_stage1(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, Eina_Rect rect, Dimension dim, Eina_List **pos, Eina_List **neg)
+_calculate_node(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, Dimension dim, Eina_List **pos, Eina_List **neg)
{
int dim_min, dim_max, cur_pos_min = 0, cur_neg_min = 0;
Efl_Ui_Focus_Object *op;
Eina_Iterator *nodes;
+ Eina_Rect rect;
Node *n;
+ *pos = NULL;
+ *neg = NULL;
+
+ rect = efl_ui_focus_object_focus_geometry_get(node);
nodes = eina_hash_iterator_data_new(pd->node_hash);
_min_max_gen(dim, rect, &dim_min, &dim_max);
@@ -431,13 +436,15 @@ _direction_to_outside(Efl_Ui_Focus_Direction direction)
}
static inline void
-_calculate_node_stage2(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, Eina_Rect rect, Efl_Ui_Focus_Direction direction, Eina_List **lst)
+_calculate_node_indirection(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, Efl_Ui_Focus_Direction direction, Eina_List **lst)
{
Efl_Ui_Focus_Object *op;
Eina_Iterator *nodes;
int min_distance = 0;
Node *n;
+ Eina_Rect rect;
+ rect = efl_ui_focus_object_focus_geometry_get(node);
nodes = eina_hash_iterator_data_new(pd->node_hash);
EINA_ITERATOR_FOREACH(nodes, n)
@@ -476,39 +483,6 @@ _calculate_node_stage2(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *
}
}
-static inline void
-_calculate_node(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, Dimension dim, Eina_List **pos, Eina_List **neg)
-{
- Eina_Rect rect;
- Efl_Ui_Focus_Direction direction;
-
- rect = efl_ui_focus_object_focus_geometry_get(node);
-
- *pos = NULL;
- *neg = NULL;
-
- _calculate_node_stage1(pd, node, rect, dim, pos, neg);
-
- if (!*pos)
- {
- if (dim == DIMENSION_Y)
- direction = EFL_UI_FOCUS_DIRECTION_DOWN;
- else
- direction = EFL_UI_FOCUS_DIRECTION_RIGHT;
- _calculate_node_stage2(pd, node, rect, direction, pos);
- }
-
- if (!*neg)
- {
- if (dim == DIMENSION_Y)
- direction = EFL_UI_FOCUS_DIRECTION_UP;
- else
- direction = EFL_UI_FOCUS_DIRECTION_LEFT;
-
- _calculate_node_stage2(pd, node, rect, direction, neg);
- }
-}
-
#ifdef CALC_DEBUG
static void
_debug_node(Node *node)
@@ -576,6 +550,33 @@ dirty_flush_node(Efl_Ui_Focus_Manager *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Cal
convert_border_set(obj, pd, node, y_partners_neg, EFL_UI_FOCUS_DIRECTION_UP);
convert_border_set(obj, pd, node, y_partners_pos, EFL_UI_FOCUS_DIRECTION_DOWN);
+ /*
+ * Stage 2: if there is still no relation in a special direction,
+ * just take every single node that is in the given direction
+ * and take the one with the shortest direction
+ */
+ for(int i = EFL_UI_FOCUS_DIRECTION_UP; i < EFL_UI_FOCUS_DIRECTION_LAST; i++)
+ {
+ if (!DIRECTION_ACCESS(node, i).partners)
+ {
+ Eina_List *tmp = NULL;
+ Efl_Ui_Focus_Object *focusable;
+
+ _calculate_node_indirection(pd, node->focusable, i, &tmp);
+
+ EINA_LIST_FREE(tmp, focusable)
+ {
+ Border *b;
+ Node *n;
+
+ b = &DIRECTION_ACCESS(node, i);
+ n = node_get(obj, pd, focusable);
+ b->partners = eina_list_append(b->partners, n);
+ }
+
+ }
+ }
+
#ifdef CALC_DEBUG
_debug_node(node);
#endif