diff options
author | Marcel Hollerbach <marcel@osg.samsung.com> | 2017-10-27 14:31:27 +0200 |
---|---|---|
committer | Marcel Hollerbach <marcel@osg.samsung.com> | 2017-10-27 15:29:58 +0200 |
commit | 1252b5ac29fa98949f249230f8719f634467d1e2 (patch) | |
tree | 351307abbe2e119e7b3531dbb5a7882bba8dfb54 /src/lib/elementary | |
parent | 4c74c1ebbebb4be433632dd1ce06a1e265259d5a (diff) |
efl_ui_focus_manager: correctly handle subitem directions in a redirect
in default focus just sets the focus to the first item in the redirect
manager, we now reset that back and move the focus to the last element
of a item.
Diffstat (limited to 'src/lib/elementary')
-rw-r--r-- | src/lib/elementary/efl_ui_focus_manager_calc.c | 32 |
1 files changed, 31 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 171bc7993e..3c43852500 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c | |||
@@ -1422,6 +1422,26 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_ | |||
1422 | } | 1422 | } |
1423 | } | 1423 | } |
1424 | 1424 | ||
1425 | static void | ||
1426 | _followup_previous_direction(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd) | ||
1427 | { | ||
1428 | Efl_Ui_Focus_Manager *rec_manager; | ||
1429 | rec_manager = efl_ui_focus_manager_redirect_get(obj); | ||
1430 | if (rec_manager) | ||
1431 | { | ||
1432 | Efl_Ui_Focus_Manager_Logical_End_Detail last; | ||
1433 | efl_ui_focus_manager_reset_history(rec_manager); | ||
1434 | |||
1435 | do { | ||
1436 | last = efl_ui_focus_manager_logical_end(rec_manager); | ||
1437 | EINA_SAFETY_ON_NULL_RETURN(last.element); | ||
1438 | efl_ui_focus_manager_focus_set(rec_manager, last.element); | ||
1439 | |||
1440 | rec_manager = efl_ui_focus_manager_redirect_get(rec_manager); | ||
1441 | } while (!last.is_regular_end); | ||
1442 | } | ||
1443 | } | ||
1444 | |||
1425 | EOLIAN static Efl_Ui_Focus_Object* | 1445 | EOLIAN static Efl_Ui_Focus_Object* |
1426 | _efl_ui_focus_manager_calc_efl_ui_focus_manager_move(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Direction direction) | 1446 | _efl_ui_focus_manager_calc_efl_ui_focus_manager_move(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Direction direction) |
1427 | { | 1447 | { |
@@ -1441,10 +1461,16 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_move(Eo *obj EINA_UNUSED, Efl_Ui | |||
1441 | if (DIRECTION_IS_LOGICAL(direction)) | 1461 | if (DIRECTION_IS_LOGICAL(direction)) |
1442 | { | 1462 | { |
1443 | // lets just take the last | 1463 | // lets just take the last |
1464 | |||
1444 | Node *n = eina_list_last_data_get(pd->focus_stack); | 1465 | Node *n = eina_list_last_data_get(pd->focus_stack); |
1445 | new_candidate = _request_move(obj, pd, direction, n); | 1466 | new_candidate = _request_move(obj, pd, direction, n); |
1467 | |||
1446 | if (new_candidate) | 1468 | if (new_candidate) |
1447 | efl_ui_focus_manager_focus_set(obj, new_candidate); | 1469 | efl_ui_focus_manager_focus_set(obj, new_candidate); |
1470 | |||
1471 | if (direction == ELM_FOCUS_PREVIOUS) | ||
1472 | _followup_previous_direction(obj, pd); | ||
1473 | |||
1448 | candidate = new_candidate; | 1474 | candidate = new_candidate; |
1449 | } | 1475 | } |
1450 | else | 1476 | else |
@@ -1474,7 +1500,11 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_move(Eo *obj EINA_UNUSED, Efl_Ui | |||
1474 | F_DBG("Manager: %p moved to %p %s in direction %d", obj, candidate, efl_class_name_get(candidate), direction); | 1500 | F_DBG("Manager: %p moved to %p %s in direction %d", obj, candidate, efl_class_name_get(candidate), direction); |
1475 | 1501 | ||
1476 | if (candidate) | 1502 | if (candidate) |
1477 | efl_ui_focus_manager_focus_set(obj, candidate); | 1503 | { |
1504 | efl_ui_focus_manager_focus_set(obj, candidate); | ||
1505 | if (direction == ELM_FOCUS_PREVIOUS) | ||
1506 | _followup_previous_direction(obj, pd); | ||
1507 | } | ||
1478 | } | 1508 | } |
1479 | 1509 | ||
1480 | 1510 | ||