X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Ffocus-manager%2Ffocus-finder.cpp;h=2fdf28552bc6fbb697a7f2ab79260a57ae9f0ed3;hb=a5167c61104580ae0ab724f904537a3a01ea3061;hp=ddd03605b7bb89e0920b48d5723589d7186caae4;hpb=5a80f5b0c8814d86156be28bdcdafcfcd8486b49;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/focus-manager/focus-finder.cpp b/dali-toolkit/devel-api/focus-manager/focus-finder.cpp index ddd0360..2fdf285 100644 --- a/dali-toolkit/devel-api/focus-manager/focus-finder.cpp +++ b/dali-toolkit/devel-api/focus-manager/focus-finder.cpp @@ -343,6 +343,7 @@ bool IsBetterCandidate(Toolkit::Control::KeyboardFocus::Direction direction, Rec bool IsFocusable(Actor& actor) { return (actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) && + actor.GetProperty(DevelActor::Property::USER_INTERACTION_ENABLED) && actor.GetProperty(Actor::Property::VISIBLE) && actor.GetProperty(Actor::Property::WORLD_COLOR).a > FULLY_TRANSPARENT); } @@ -354,9 +355,9 @@ Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect& focusedRect, { // Recursively children const auto childCount = actor.GetChildCount(); - for(auto i = 0u; i < childCount; ++i) + for(auto i = childCount; i > 0u; --i) { - Dali::Actor child = actor.GetChildAt(i); + Dali::Actor child = actor.GetChildAt(i-1); if(child && child != focusedActor && IsFocusable(child)) { Rect candidateRect = DevelActor::CalculateScreenExtents(child); @@ -382,15 +383,26 @@ Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect& focusedRect, } // unnamed namespace -Actor GetNearestFocusableActor(Actor focusedActor, Toolkit::Control::KeyboardFocus::Direction direction) +Actor GetNearestFocusableActor(Actor rootActor, Actor focusedActor, Toolkit::Control::KeyboardFocus::Direction direction) { Actor nearestActor; - if(!focusedActor) + if(!rootActor) { return nearestActor; } - Rect focusedRect = DevelActor::CalculateScreenExtents(focusedActor); + Rect focusedRect; + if (!focusedActor) + { + // If there is no currently focused actor, it is searched based on the upper left corner of the current window. + Rect rootRect = DevelActor::CalculateScreenExtents(rootActor); + focusedRect = Rect(rootRect.x, rootRect.y, 0.f, 0.f); + } + else + { + focusedRect = DevelActor::CalculateScreenExtents(focusedActor); + } + // initialize the best candidate to something impossible // (so the first plausible actor will become the best choice) @@ -426,13 +438,7 @@ Actor GetNearestFocusableActor(Actor focusedActor, Toolkit::Control::KeyboardFoc ConvertCoordinate(bestCandidateRect); ConvertCoordinate(focusedRect); - - Integration::SceneHolder window = Integration::SceneHolder::Get(focusedActor); - if(window) - { - Actor rootActor = window.GetRootLayer(); - nearestActor = FindNextFocus(rootActor, focusedActor, focusedRect, bestCandidateRect, direction); - } + nearestActor = FindNextFocus(rootActor, focusedActor, focusedRect, bestCandidateRect, direction); return nearestActor; }