X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Ffocus-manager%2Ffocus-finder.cpp;h=2fdf28552bc6fbb697a7f2ab79260a57ae9f0ed3;hb=784f6b2b1f66c24b1b7d920aef5b5bbff7878a99;hp=2679dda7208495a4542444035b6a5c416b3d939e;hpb=b13abf6bf040c3af7b683c9d326d304bdb5f52cc;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 2679dda..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); } @@ -350,13 +351,13 @@ bool IsFocusable(Actor& actor) Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect& focusedRect, Rect& bestCandidateRect, Toolkit::Control::KeyboardFocus::Direction direction) { Actor nearestActor; - if(actor && actor.GetProperty(Actor::Property::VISIBLE)) + if(actor && actor.GetProperty(Actor::Property::VISIBLE) && actor.GetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN)) { // 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; }