forked from enlightenment/efl
elm: move the focus direction definition to general
and remove the old definition
This commit is contained in:
parent
9d5cc349da
commit
8453ebfe4e
|
@ -46,7 +46,7 @@ _efl_ui_focus_layer_efl_ui_focus_manager_move(Eo *obj, Efl_Ui_Focus_Layer_Data *
|
|||
if (!pd->cycle)
|
||||
return NULL;
|
||||
|
||||
if ((direction == EFL_UI_FOCUS_DIRECTION_PREV) || (direction == EFL_UI_FOCUS_DIRECTION_NEXT))
|
||||
if ((direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS ) || (direction == EFL_UI_FOCUS_DIRECTION_NEXT))
|
||||
efl_ui_focus_manager_focus_set(pd->manager, obj);
|
||||
|
||||
return efl_ui_focus_manager_focus_get(obj);
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
enum Efl.Ui.Focus.Direction {
|
||||
[[Those values are describing a direction from the position of view from
|
||||
one item.
|
||||
|
||||
@since 1.20
|
||||
]]
|
||||
right = 0, [[Coordinate-wise the next element on the right-hand side]]
|
||||
left = 1, [[Coordinate-wise the next element on the left-hand side]]
|
||||
down = 2, [[Coordinate-wise the next element downward]]
|
||||
up = 3, [[Coorinate-wise the next element upwards]]
|
||||
next = 4, [[Logically-wise the next item in the logical tree]]
|
||||
prev = 5, [[Logically-wise the prev item in the logical tree]]
|
||||
last = 6 [[Last value for this enum, do not use]]
|
||||
}
|
||||
import elm_general;
|
||||
|
||||
struct Efl.Ui.Focus.Relations {
|
||||
[[Structure holding the graph of relations between focussable objects.
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define DIM_EFL_UI_FOCUS_DIRECTION(dim,neg) dim*2+neg
|
||||
#define NODE_DIRECTIONS_COUNT 4
|
||||
|
||||
#define DIRECTION_CHECK(dir) (dir >= 0 && dir < EFL_UI_FOCUS_DIRECTION_LAST)
|
||||
#define DIRECTION_CHECK(dir) (dir >= EFL_UI_FOCUS_DIRECTION_PREVIOUS && dir < EFL_UI_FOCUS_DIRECTION_LAST)
|
||||
|
||||
//#define CALC_DEBUG
|
||||
#define DEBUG_TUPLE(obj) efl_name_get(obj), efl_class_name_get(obj)
|
||||
|
@ -24,6 +24,8 @@ static int _focus_log_domain = -1;
|
|||
#define F_INF(...) EINA_LOG_DOM_INFO(_focus_log_domain, __VA_ARGS__)
|
||||
#define F_DBG(...) EINA_LOG_DOM_DBG(_focus_log_domain, __VA_ARGS__)
|
||||
|
||||
#define DIRECTION_ACCESS(V, ID) ((V)->graph.directions[(ID) - 2])
|
||||
|
||||
typedef struct {
|
||||
Eina_Bool positive;
|
||||
Efl_Ui_Focus_Object *anchor;
|
||||
|
@ -85,7 +87,7 @@ _complement(Efl_Ui_Focus_Direction dir)
|
|||
|
||||
COMP(EFL_UI_FOCUS_DIRECTION_RIGHT, EFL_UI_FOCUS_DIRECTION_LEFT)
|
||||
COMP(EFL_UI_FOCUS_DIRECTION_UP, EFL_UI_FOCUS_DIRECTION_DOWN)
|
||||
COMP(EFL_UI_FOCUS_DIRECTION_PREV, EFL_UI_FOCUS_DIRECTION_NEXT)
|
||||
COMP(EFL_UI_FOCUS_DIRECTION_PREVIOUS, EFL_UI_FOCUS_DIRECTION_NEXT)
|
||||
|
||||
#undef COMP
|
||||
|
||||
|
@ -101,11 +103,11 @@ border_partners_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List *lis
|
|||
{
|
||||
Node *partner;
|
||||
Eina_List *lnode;
|
||||
Border *border = &G(node).directions[direction];
|
||||
Border *border = &DIRECTION_ACCESS(node, direction);
|
||||
|
||||
EINA_LIST_FREE(border->partners, partner)
|
||||
{
|
||||
Border *comp_border = &G(partner).directions[_complement(direction)];
|
||||
Border *comp_border = &DIRECTION_ACCESS(partner, _complement(direction));
|
||||
|
||||
comp_border->partners = eina_list_remove(comp_border->partners, node);
|
||||
}
|
||||
|
@ -114,7 +116,7 @@ border_partners_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List *lis
|
|||
|
||||
EINA_LIST_FOREACH(border->partners, lnode, partner)
|
||||
{
|
||||
Border *comp_border = &G(partner).directions[_complement(direction)];
|
||||
Border *comp_border = &DIRECTION_ACCESS(partner,_complement(direction));
|
||||
|
||||
comp_border->partners = eina_list_append(comp_border->partners, node);
|
||||
}
|
||||
|
@ -164,7 +166,7 @@ node_item_free(Node *item)
|
|||
Node *n;
|
||||
Eina_List *l;
|
||||
//free the graph items
|
||||
for(int i = 0;i < NODE_DIRECTIONS_COUNT; i++)
|
||||
for(int i = EFL_UI_FOCUS_DIRECTION_UP;i < NODE_DIRECTIONS_COUNT; i++)
|
||||
{
|
||||
border_partners_set(item, i, NULL);
|
||||
}
|
||||
|
@ -373,7 +375,7 @@ _debug_node(Node *node)
|
|||
|
||||
printf("NODE %s-%s\n", DEBUG_TUPLE(node->focusable));
|
||||
|
||||
#define DIR_LIST(dir) G(node).directions[dir].partners
|
||||
#define DIR_LIST(dir) DIRECTION_ACCESS(node,dir).partners
|
||||
|
||||
#define DIR_OUT(dir)\
|
||||
tmp = DIR_LIST(dir); \
|
||||
|
@ -791,12 +793,12 @@ _efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_
|
|||
pd->focus_stack = eina_list_remove(pd->focus_stack, node);
|
||||
|
||||
//add all neighbors of the node to the dirty list
|
||||
for(int i = 0; i < 4; i++)
|
||||
for(int i = EFL_UI_FOCUS_DIRECTION_UP; i < NODE_DIRECTIONS_COUNT; i++)
|
||||
{
|
||||
Node *partner;
|
||||
Eina_List *n;
|
||||
|
||||
EINA_LIST_FOREACH(node->graph.directions[i].partners, n, partner)
|
||||
EINA_LIST_FOREACH(DIRECTION_ACCESS(node, i).partners, n, partner)
|
||||
{
|
||||
dirty_add(obj, pd, partner);
|
||||
}
|
||||
|
@ -895,10 +897,10 @@ _iterator_next(Border_Elements_Iterator *it, void **data)
|
|||
|
||||
EINA_ITERATOR_FOREACH(it->real_iterator, node)
|
||||
{
|
||||
for(int i = 0 ;i < NODE_DIRECTIONS_COUNT; i++)
|
||||
for(int i = EFL_UI_FOCUS_DIRECTION_UP ;i < NODE_DIRECTIONS_COUNT; i++)
|
||||
{
|
||||
if (node->type != NODE_TYPE_ONLY_LOGICAL &&
|
||||
!node->graph.directions[i].partners)
|
||||
!DIRECTION_ACCESS(node, i).partners)
|
||||
{
|
||||
*data = node->focusable;
|
||||
return EINA_TRUE;
|
||||
|
@ -984,7 +986,7 @@ _coords_movement(Efl_Ui_Focus_Manager_Calc_Data *pd, Node *upper, Efl_Ui_Focus_D
|
|||
//we are searching which of the partners is lower to the history
|
||||
EINA_LIST_REVERSE_FOREACH(pd->focus_stack, node_list, candidate)
|
||||
{
|
||||
if (eina_list_data_find(G(upper).directions[direction].partners, candidate))
|
||||
if (eina_list_data_find(DIRECTION_ACCESS(upper, direction).partners, candidate))
|
||||
{
|
||||
//this is the next accessable part
|
||||
return candidate;
|
||||
|
@ -993,7 +995,7 @@ _coords_movement(Efl_Ui_Focus_Manager_Calc_Data *pd, Node *upper, Efl_Ui_Focus_D
|
|||
|
||||
//if we haven't found anything in the history, use the widget with the smallest distance
|
||||
{
|
||||
Eina_List *lst = G(upper).directions[direction].partners;
|
||||
Eina_List *lst = DIRECTION_ACCESS(upper, direction).partners;
|
||||
Eina_List *n;
|
||||
Node *node, *min = NULL;
|
||||
Eina_Vector2 elem, other;
|
||||
|
@ -1157,7 +1159,7 @@ _request_move(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Fo
|
|||
|
||||
dirty_flush(obj, pd, upper);
|
||||
|
||||
if (direction == EFL_UI_FOCUS_DIRECTION_PREV
|
||||
if (direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS
|
||||
|| direction == EFL_UI_FOCUS_DIRECTION_NEXT)
|
||||
dir = _logical_movement(pd, upper, direction);
|
||||
else
|
||||
|
@ -1337,7 +1339,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_move(Eo *obj EINA_UNUSED, Efl_Ui
|
|||
n = eina_hash_find(pd->node_hash, &old_candidate);
|
||||
|
||||
if (direction == EFL_UI_FOCUS_DIRECTION_NEXT ||
|
||||
direction == EFL_UI_FOCUS_DIRECTION_PREV)
|
||||
direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS)
|
||||
{
|
||||
if (n)
|
||||
{
|
||||
|
@ -1458,7 +1460,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_fetch(Eo *obj, Efl_Ui_Focus_Mana
|
|||
|
||||
dirty_flush(obj, pd, n);
|
||||
|
||||
#define DIR_CLONE(dir) _convert(G(n).directions[dir].partners);
|
||||
#define DIR_CLONE(dir) _convert(DIRECTION_ACCESS(n,dir).partners);
|
||||
|
||||
res->right = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_RIGHT);
|
||||
res->left = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_LEFT);
|
||||
|
|
|
@ -1656,7 +1656,7 @@ _key_action_move(Evas_Object *obj, const char *params)
|
|||
Efl_Ui_Focus_Object *o;
|
||||
|
||||
if (!strcmp(dir, "previous"))
|
||||
focus_dir = EFL_UI_FOCUS_DIRECTION_PREV;
|
||||
focus_dir = EFL_UI_FOCUS_DIRECTION_PREVIOUS;
|
||||
else if (!strcmp(dir, "next"))
|
||||
focus_dir = EFL_UI_FOCUS_DIRECTION_NEXT;
|
||||
else if (!strcmp(dir, "left"))
|
||||
|
@ -1679,7 +1679,7 @@ _key_action_move(Evas_Object *obj, const char *params)
|
|||
efl_ui_focus_manager_focus_set(obj, root);
|
||||
}
|
||||
|
||||
if (!o && focus_dir == EFL_UI_FOCUS_DIRECTION_PREV)
|
||||
if (!o && focus_dir == EFL_UI_FOCUS_DIRECTION_PREVIOUS)
|
||||
{
|
||||
Efl_Ui_Focus_Manager_Logical_End_Detail last;
|
||||
Efl_Ui_Focus_Manager *rec_manager = obj;
|
||||
|
|
|
@ -129,16 +129,16 @@ enum Elm.Wrap.Type
|
|||
last [[Sentinel value to indicate last enum field during iteration]]
|
||||
}
|
||||
|
||||
enum Elm.Focus_Direction
|
||||
enum Efl.Ui.Focus.Direction
|
||||
{
|
||||
[[ Focus directions. ]]
|
||||
legacy: elm_focus;
|
||||
previous, [[ previous direction ]]
|
||||
next, [[ next direction ]]
|
||||
up, [[ up direction ]]
|
||||
down, [[ down direction ]]
|
||||
right, [[ right direction ]]
|
||||
left, [[ left direction ]]
|
||||
previous = 0, [[ previous direction ]]
|
||||
next = 1, [[ next direction ]]
|
||||
up = 2, [[ up direction ]]
|
||||
down = 3, [[ down direction ]]
|
||||
right = 4, [[ right direction ]]
|
||||
left = 5, [[ left direction ]]
|
||||
last = 6
|
||||
}
|
||||
|
||||
enum Elm.Focus.Region.Show_Mode
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
|
||||
#include "elm_general.eot.h"
|
||||
|
||||
#define ELM_FOCUS_PREVIOUS EFL_UI_FOCUS_DIRECTION_PREVIOUS
|
||||
#define ELM_FOCUS_NEXT EFL_UI_FOCUS_DIRECTION_NEXT
|
||||
#define ELM_FOCUS_UP EFL_UI_FOCUS_DIRECTION_UP
|
||||
#define ELM_FOCUS_DOWN EFL_UI_FOCUS_DIRECTION_DOWN
|
||||
#define ELM_FOCUS_RIGHT EFL_UI_FOCUS_DIRECTION_RIGHT
|
||||
#define ELM_FOCUS_LEFT EFL_UI_FOCUS_DIRECTION_LEFT
|
||||
typedef Efl_Ui_Focus_Direction Elm_Focus_Direction;
|
||||
|
||||
/**
|
||||
* Defines couple of standard Evas_Object layers to be used
|
||||
* with evas_object_layer_set().
|
||||
|
|
|
@ -501,7 +501,7 @@ class Elm.Widget.Item(Efl.Object, Elm.Interface.Atspi_Accessible,
|
|||
|
||||
@since 1.16]]
|
||||
params {
|
||||
dir: Elm.Focus_Direction; [[Focus direction]]
|
||||
dir: Efl.Ui.Focus.Direction; [[Focus direction]]
|
||||
}
|
||||
return: Efl.Canvas.Object; [[Focus next object]]
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ class Elm.Widget.Item(Efl.Object, Elm.Interface.Atspi_Accessible,
|
|||
@since 1.16]]
|
||||
params {
|
||||
next: Efl.Canvas.Object @nullable; [[Focus next object]]
|
||||
dir: Elm.Focus_Direction; [[Focus direction]]
|
||||
dir: Efl.Ui.Focus.Direction; [[Focus direction]]
|
||||
}
|
||||
}
|
||||
focus_next_item_get @const {
|
||||
|
@ -519,7 +519,7 @@ class Elm.Widget.Item(Efl.Object, Elm.Interface.Atspi_Accessible,
|
|||
|
||||
@since 1.16]]
|
||||
params {
|
||||
dir: Elm.Focus_Direction; [[Focus direction]]
|
||||
dir: Efl.Ui.Focus.Direction; [[Focus direction]]
|
||||
}
|
||||
return: Elm.Widget.Item; [[Focus next object item]]
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ class Elm.Widget.Item(Efl.Object, Elm.Interface.Atspi_Accessible,
|
|||
@since 1.16]]
|
||||
params {
|
||||
next_item: Elm.Widget.Item @nullable; [[Focus next object item]]
|
||||
dir: Elm.Focus_Direction; [[Focus direction]]
|
||||
dir: Efl.Ui.Focus.Direction; [[Focus direction]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ START_TEST(logical_chain)
|
|||
i-= 2;
|
||||
for (; i > 0; --i)
|
||||
{
|
||||
ck_assert_ptr_eq(logical_chain[i], efl_ui_focus_manager_move(m, EFL_UI_FOCUS_DIRECTION_PREV));
|
||||
ck_assert_ptr_eq(logical_chain[i], efl_ui_focus_manager_move(m, EFL_UI_FOCUS_DIRECTION_PREVIOUS));
|
||||
}
|
||||
elm_shutdown();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue