forked from enlightenment/efl
efl_ui_focus_manager: handle logical end correctly.
This commit is contained in:
parent
6245e5a579
commit
5b3fd27931
|
@ -865,18 +865,14 @@ _coords_movement(Efl_Ui_Focus_Manager_Data *pd, Node *upper, Efl_Ui_Focus_Direct
|
||||||
|
|
||||||
|
|
||||||
static Node*
|
static Node*
|
||||||
_parent_item(Node *node, Eina_Bool next)
|
_prev_item(Node *node)
|
||||||
{
|
{
|
||||||
Node *parent;
|
Node *parent;
|
||||||
Eina_List *lnode;
|
Eina_List *lnode;
|
||||||
|
|
||||||
parent = T(node).parent;
|
parent = T(node).parent;
|
||||||
lnode = eina_list_data_find_list(T(parent).children, node);
|
lnode = eina_list_data_find_list(T(parent).children, node);
|
||||||
|
lnode = eina_list_prev(lnode);
|
||||||
if (next)
|
|
||||||
lnode = eina_list_next(lnode);
|
|
||||||
else
|
|
||||||
lnode = eina_list_prev(lnode);
|
|
||||||
|
|
||||||
if (lnode)
|
if (lnode)
|
||||||
return eina_list_data_get(lnode);
|
return eina_list_data_get(lnode);
|
||||||
|
@ -933,17 +929,24 @@ _prev(Node *node)
|
||||||
if (!T(node).parent)
|
if (!T(node).parent)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
n =_parent_item(node, EINA_FALSE);
|
n =_prev_item(node);
|
||||||
//case 1 there is a item in the parent previous to node, which has children
|
//case 1 there is a item in the parent previous to node, which has children
|
||||||
if (n && T(n).children)
|
if (n && T(n).children)
|
||||||
return eina_list_last_data_get(T(n).children);
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
n = eina_list_last_data_get(T(n).children);
|
||||||
|
}
|
||||||
|
while (T(n).children);
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
//case 2 there is a item in the parent preivous to node, which has no children
|
//case 2 there is a item in the parent preivous to node, which has no children
|
||||||
if (n)
|
if (n)
|
||||||
return n;
|
return n;
|
||||||
|
|
||||||
//case 3 there is a no item in the parent provious to this one
|
//case 3 there is a no item in the parent provious to this one
|
||||||
//if (!n)
|
|
||||||
return T(node).parent;
|
return T(node).parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1300,26 +1303,15 @@ _efl_ui_focus_manager_class_destructor(Efl_Class *c EINA_UNUSED)
|
||||||
EOLIAN static Efl_Ui_Focus_Object*
|
EOLIAN static Efl_Ui_Focus_Object*
|
||||||
_efl_ui_focus_manager_logical_end(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Data *pd)
|
_efl_ui_focus_manager_logical_end(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Data *pd)
|
||||||
{
|
{
|
||||||
//we need to return the most lower right element
|
|
||||||
Node *child = pd->root;
|
Node *child = pd->root;
|
||||||
Efl_Ui_Focus_Object *last_normal = NULL;
|
//we need to return the most lower right element
|
||||||
|
|
||||||
while(T(child).children)
|
while(T(child).children)
|
||||||
{
|
child = eina_list_last_data_get(T(child).children);
|
||||||
Efl_Ui_Focus_Object *tmp_last_normal;
|
while (child->type != NODE_TYPE_NORMAL)
|
||||||
|
child = _prev(child);
|
||||||
|
|
||||||
tmp_last_normal = _find_normal_node(child);
|
return child ? child->focusable : NULL;
|
||||||
if (tmp_last_normal)
|
|
||||||
last_normal = tmp_last_normal;
|
|
||||||
|
|
||||||
child = eina_list_last_data_get(T(child).children);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last_normal)
|
|
||||||
return last_normal;
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "efl_ui_focus_manager.eo.c"
|
#include "efl_ui_focus_manager.eo.c"
|
Loading…
Reference in New Issue