summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-10-30 07:22:05 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-10-30 07:22:08 +0100
commit3a885cd6c72e7fb94c46f45bd900b8c2dcf26768 (patch)
tree0a888c5df582df400d2f6d6d180f1b15aaddb913
parentc91fc929c548129ed200285a641d92adb2df0cf8 (diff)
widget: update child_can_focus flag on focusability change
Summary: Previously child_can_focus flag could be only updated when child is deleted from object's subobject list. This patch additionally updates child_can_focus flag when focusability is changed with elm_widget_focus_can_set function. Patch solves child_can_focus issue in similar situations: elm_icon_add(layout); elm_object_content_set(layout, icon); elm_widget_child_can_focus_get(layout); // returns EINA_TRUE icon = elm_icon_add(win); elm_object_content_set(layout, icon); elm_widget_child_can_focus_get(layout); // returns EINA_FALSE @fix Reviewers: cedric, stefan_schmidt Subscribers: seoz Differential Revision: https://phab.enlightenment.org/D3237 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/elm_main.c2
-rw-r--r--src/lib/elm_widget.c23
2 files changed, 23 insertions, 2 deletions
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index d43627457..faa862432 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -1380,8 +1380,6 @@ elm_object_focus_allow_set(Evas_Object *obj,
1380{ 1380{
1381 EINA_SAFETY_ON_NULL_RETURN(obj); 1381 EINA_SAFETY_ON_NULL_RETURN(obj);
1382 elm_widget_can_focus_set(obj, enable); 1382 elm_widget_can_focus_set(obj, enable);
1383/*FIXME: According to the elm_object_focus_allow_get(), child_can_focus field
1384of the parent should be updated. Otherwise, the checking of it's child focus allow states should not be in elm_object_focus_allow_get() */
1385} 1383}
1386 1384
1387EAPI Eina_Bool 1385EAPI Eina_Bool
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 65d049a09..832ea1e75 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -1401,6 +1401,29 @@ _elm_widget_can_focus_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool can_focu
1401 } 1401 }
1402 else 1402 else
1403 { 1403 {
1404 // update child_can_focus of parents */
1405 Evas_Object *parent = elm_widget_parent_get(obj);
1406 while (parent)
1407 {
1408 const Eina_List *l;
1409 Evas_Object *subobj;
1410
1411 ELM_WIDGET_DATA_GET(parent, sdp);
1412
1413 sdp->child_can_focus = EINA_FALSE;
1414 EINA_LIST_FOREACH(sdp->subobjs, l, subobj)
1415 {
1416 if (_is_focusable(subobj))
1417 {
1418 sdp->child_can_focus = EINA_TRUE;
1419 break;
1420 }
1421 }
1422 /* break again, child_can_focus went back to
1423 * original value */
1424 if (sdp->child_can_focus) break;
1425 parent = sdp->parent_obj;
1426 }
1404 eo_do(obj, eo_event_callback_array_del(focus_callbacks(), NULL)); 1427 eo_do(obj, eo_event_callback_array_del(focus_callbacks(), NULL));
1405 } 1428 }
1406} 1429}