{
Node* (*deliver)(Node *n);
Node *result;
+ Eina_List *stack = NULL;
+
if (direction == EFL_UI_FOCUS_DIRECTION_NEXT)
deliver = _next;
else
//search as long as we have a none logical parent
result = upper;
- do {
- result = deliver(result);
- } while(result && result->type == NODE_TYPE_ONLY_LOGICAL);
+ do
+ {
+ //give up, if we have already been here
+ if (!!eina_list_data_find(stack, result))
+ {
+ eina_list_free(stack);
+ ERR("Warning cycle detected\n");
+ return NULL;
+ }
+
+ stack = eina_list_append(stack, result);
+
+ result = deliver(result);
+ } while(result && result->type != NODE_TYPE_NORMAL);
+
+ if (result->type != NODE_TYPE_NORMAL)
+ abort();
+
+ eina_list_free(stack);
return result;
}
node = node_get(pd, focus);
if (!node) return;
+ if (node->type == NODE_TYPE_ONLY_LOGICAL)
+ {
+ ERR("Logical node cannot be focused");
+ return;
+ }
+
//check if this is already the focused object
old_focus = eina_list_last_data_get(pd->focus_stack);