summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2017-10-27 17:02:20 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2017-10-27 17:08:08 +0200
commit5b8fbb7c698b50f4d70668b6dd8426cd21d94bd3 (patch)
tree25d3849f4d0d87e88b8a9b0530e466f65b18565e /src/lib/elementary
parent1252b5ac29fa98949f249230f8719f634467d1e2 (diff)
efl_ui_focus_manager_calc: return last object when unfocusing last
this makes code easier, and fixes a bug where the wrong last element is taken.
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index 3c43852500..c966c4f448 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -211,17 +211,23 @@ node_item_free(Node *item)
211} 211}
212//FOCUS-STACK HELPERS 212//FOCUS-STACK HELPERS
213 213
214static void 214static Efl_Ui_Focus_Object*
215_focus_stack_unfocus_last(Efl_Ui_Focus_Manager_Calc_Data *pd) 215_focus_stack_unfocus_last(Efl_Ui_Focus_Manager_Calc_Data *pd)
216{ 216{
217 Efl_Ui_Focus_Object *focusable = NULL;
217 Node *n; 218 Node *n;
218 219
219 n = eina_list_last_data_get(pd->focus_stack); 220 n = eina_list_last_data_get(pd->focus_stack);
220 221
222 if (n)
223 focusable = n->focusable;
224
221 pd->focus_stack = eina_list_remove(pd->focus_stack, n); 225 pd->focus_stack = eina_list_remove(pd->focus_stack, n);
222 226
223 if (n) 227 if (n)
224 efl_ui_focus_object_focus_set(n->focusable, EINA_FALSE); 228 efl_ui_focus_object_focus_set(n->focusable, EINA_FALSE);
229
230 return focusable;
225} 231}
226 232
227static Node* 233static Node*
@@ -1367,10 +1373,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
1367 type = node->type; 1373 type = node->type;
1368 focusable = node->focusable; 1374 focusable = node->focusable;
1369 1375
1370 if (pd->focus_stack) 1376 last_focusable = _focus_stack_unfocus_last(pd);
1371 last_focusable = ((Node*)eina_list_last_data_get(pd->focus_stack))->focusable;
1372
1373 _focus_stack_unfocus_last(pd);
1374 1377
1375 if (node->type == NODE_TYPE_NORMAL) 1378 if (node->type == NODE_TYPE_NORMAL)
1376 { 1379 {
@@ -1662,9 +1665,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_reset_history(Eo *obj EINA_UNUSE
1662 1665
1663 if (!pd->focus_stack) return; 1666 if (!pd->focus_stack) return;
1664 1667
1665 last_focusable = ((Node*)eina_list_last_data_get(pd->focus_stack))->focusable; 1668 last_focusable = _focus_stack_unfocus_last(pd);
1666
1667 _focus_stack_unfocus_last(pd);
1668 1669
1669 pd->focus_stack = eina_list_free(pd->focus_stack); 1670 pd->focus_stack = eina_list_free(pd->focus_stack);
1670 1671
@@ -1678,9 +1679,8 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_pop_history_stack(Eo *obj EINA_U
1678 Node *last; 1679 Node *last;
1679 1680
1680 if (!pd->focus_stack) return; 1681 if (!pd->focus_stack) return;
1681 _focus_stack_unfocus_last(pd);
1682 1682
1683 last_focusable = ((Node*)eina_list_last_data_get(pd->focus_stack))->focusable; 1683 last_focusable = _focus_stack_unfocus_last(pd);
1684 1684
1685 //get now the highest, and unfocus that! 1685 //get now the highest, and unfocus that!
1686 last = eina_list_last_data_get(pd->focus_stack); 1686 last = eina_list_last_data_get(pd->focus_stack);