summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2017-10-17 19:35:59 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2017-10-19 10:04:59 +0200
commitd701597eb9b164bb7cd55fc4ca38175f91ccf72a (patch)
treedd840ed8703e681fce43bf22d5b5a96949e26ee7
parent0220418b84bf171403e6a98501f91217be39d401 (diff)
efl_ui_focus_manager_calc: move unfocusing the last element into its own
function
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index 6921de5d8d..3312aebd2d 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -209,7 +209,20 @@ node_item_free(Node *item)
209 209
210 free(item); 210 free(item);
211} 211}
212//FOCUS-STACK HELPERS
212 213
214static void
215_focus_stack_unfocus_last(Efl_Ui_Focus_Manager_Calc_Data *pd)
216{
217 Node *n;
218
219 n = eina_list_last_data_get(pd->focus_stack);
220
221 pd->focus_stack = eina_list_remove(pd->focus_stack, n);
222
223 if (n)
224 efl_ui_focus_object_focus_set(n->focusable, EINA_FALSE);
225}
213 226
214//CALCULATING STUFF 227//CALCULATING STUFF
215 228
@@ -1238,11 +1251,12 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_request_move(Eo *obj EINA_UNUSED
1238 } 1251 }
1239} 1252}
1240 1253
1254
1255
1241EOLIAN static void 1256EOLIAN static void
1242_efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *focus) 1257_efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *focus)
1243{ 1258{
1244 Node *node; 1259 Node *node;
1245 Node *old_focus;
1246 Efl_Ui_Focus_Manager *redirect_manager; 1260 Efl_Ui_Focus_Manager *redirect_manager;
1247 Eo *focusable; 1261 Eo *focusable;
1248 Node_Type type; 1262 Node_Type type;
@@ -1313,8 +1327,8 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
1313 if (node->type == NODE_TYPE_NORMAL) 1327 if (node->type == NODE_TYPE_NORMAL)
1314 { 1328 {
1315 Eo *node_focusable; 1329 Eo *node_focusable;
1316 //check if this is already the focused object 1330
1317 old_focus = eina_list_last_data_get(pd->focus_stack); 1331 _focus_stack_unfocus_last(pd);
1318 1332
1319 //remove the object from the list and add it again 1333 //remove the object from the list and add it again
1320 pd->focus_stack = eina_list_remove(pd->focus_stack, node); 1334 pd->focus_stack = eina_list_remove(pd->focus_stack, node);
@@ -1324,7 +1338,6 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
1324 node_focusable = node->focusable; 1338 node_focusable = node->focusable;
1325 1339
1326 //populate the new change 1340 //populate the new change
1327 if (old_focus) efl_ui_focus_object_focus_set(old_focus->focusable, EINA_FALSE);
1328 efl_ui_focus_object_focus_set(node->focusable, EINA_TRUE); 1341 efl_ui_focus_object_focus_set(node->focusable, EINA_TRUE);
1329 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, node_focusable); 1342 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, node_focusable);
1330 node = NULL; 1343 node = NULL;
@@ -1567,12 +1580,9 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_logical_end(Eo *obj EINA_UNUSED,
1567EOLIAN static void 1580EOLIAN static void
1568_efl_ui_focus_manager_calc_efl_ui_focus_manager_reset_history(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd) 1581_efl_ui_focus_manager_calc_efl_ui_focus_manager_reset_history(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd)
1569{ 1582{
1570 Node *last;
1571
1572 if (!pd->focus_stack) return; 1583 if (!pd->focus_stack) return;
1573 1584
1574 last = eina_list_last_data_get(pd->focus_stack); 1585 _focus_stack_unfocus_last(pd);
1575 efl_ui_focus_object_focus_set(last->focusable, EINA_FALSE);
1576 1586
1577 pd->focus_stack = eina_list_free(pd->focus_stack); 1587 pd->focus_stack = eina_list_free(pd->focus_stack);
1578} 1588}
@@ -1583,11 +1593,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_pop_history_stack(Eo *obj EINA_U
1583 Node *last; 1593 Node *last;
1584 1594
1585 if (!pd->focus_stack) return; 1595 if (!pd->focus_stack) return;
1586 //remove last element 1596 _focus_stack_unfocus_last(pd);
1587 last = eina_list_last_data_get(pd->focus_stack);
1588 pd->focus_stack = eina_list_remove(pd->focus_stack, last);
1589 //unfocus it
1590 efl_ui_focus_object_focus_set(last->focusable, EINA_FALSE);
1591 1597
1592 //get now the highest, and unfocus that! 1598 //get now the highest, and unfocus that!
1593 last = eina_list_last_data_get(pd->focus_stack); 1599 last = eina_list_last_data_get(pd->focus_stack);